/* [nodename, id, name, navigationtext, href, isnavigation, childs[], templatename] */

if (typeof(decodeURIComponent) == 'undefined') {
  decodeURIComponent = function(s) {
    return unescape(s);
  }
}

function jdecode(s) {
    s = s.replace(/\+/g, "%20")
    return decodeURIComponent(s);
}

var POS_NODENAME=0;
var POS_ID=1;
var POS_NAME=2;
var POS_NAVIGATIONTEXT=3;
var POS_HREF=4;
var POS_ISNAVIGATION=5;
var POS_CHILDS=6;
var POS_TEMPLATENAME=7;
var POS_TARGET=8;
var theSitetree=[ 
	['PAGE','1412',jdecode('Home'),jdecode(''),'/1412.html','true',[],'',''],
	['PAGE','1433',jdecode('About+me'),jdecode(''),'/1433.html','true',[],'',''],
	['PAGE','5801',jdecode('CV'),jdecode(''),'/5801.html','true',[],'',''],
	['PAGE','5827',jdecode('Air+Displays'),jdecode(''),'/5827.html','true',[],'',''],
	['PAGE','7801',jdecode('Planned+Events+2010'),jdecode(''),'/7801.html','true',[],'',''],
	['PAGE','5853',jdecode('Consultancy'),jdecode(''),'/5853.html','true',[],'',''],
	['PAGE','1454',jdecode('My+Photos'),jdecode(''),'/1454/index.html','true',[ 
		['PAGE','7201',jdecode('A+Tiger+Bimble'),jdecode(''),'/1454/7201.html','true',[],'','']
	],'',''],
	['PAGE','4501',jdecode('Family+History'),jdecode(''),'/4501.html','true',[],'',''],
	['PAGE','1475',jdecode('My+Blog'),jdecode(''),'/1475.html','true',[],'',''],
	['PAGE','1486',jdecode('Guestbook'),jdecode(''),'/1486.html','true',[],'',''],
	['PAGE','1507',jdecode('Contact'),jdecode(''),'/1507.html','true',[],'','']];
var siteelementCount=12;
theSitetree.topTemplateName='Plant';
theSitetree.paletteFamily='1A4F84';
theSitetree.keyvisualId='9452';
theSitetree.keyvisualName='kv_9452.jpg';
theSitetree.fontsetId='17484';
theSitetree.graphicsetId='12818';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='CBD9E8';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Plant',
				paletteFamily: 	'1A4F84',
				keyvisualId: 	'9452',
				keyvisualName: 	'kv_9452.jpg',
				fontsetId: 		'17484',
				graphicsetId: 	'12818',
				contentColor: 	'000000',
				contentBGColor: 'CBD9E8',
				a_color: 		'608DBA',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7060']=webappMappings['7060-6a7ecccc391351c7be34745833103039']={
webappId:    '7060',
documentId:  '1454',
internalId:  '6a7ecccc391351c7be34745833103039',
customField: 'language:en;country:GB;'
};
webappMappings['7050']=webappMappings['7050-3017']={
webappId:    '7050',
documentId:  '1475',
internalId:  '3017',
customField: 'language:en;country:GB;'
};
webappMappings['7002']=webappMappings['7002-2760']={
webappId:    '7002',
documentId:  '1486',
internalId:  '2760',
customField: 'language:en;country:GB;'
};
webappMappings['7008']=webappMappings['7008-5796']={
webappId:    '7008',
documentId:  '1507',
internalId:  '5796',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1412',
internalId:  '',
customField: '20091130-225138'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1433',
internalId:  '',
customField: '20091009-171623'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1454',
internalId:  '',
customField: '20091008-155814'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1475',
internalId:  '',
customField: '20091008-151229'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1486',
internalId:  '',
customField: '20091008-151229'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1507',
internalId:  '',
customField: '20091008-160230'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4501',
internalId:  '',
customField: '20091008-172032'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5827',
internalId:  '',
customField: '20091012-200800'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5801',
internalId:  '',
customField: '20091012-123918'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5853',
internalId:  '',
customField: '20091012-123739'
};
webappMappings['7060']=webappMappings['7060-880094e7cc7e296f2d406e2dfff00b18']={
webappId:    '7060',
documentId:  '7201',
internalId:  '880094e7cc7e296f2d406e2dfff00b18',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7201',
internalId:  '',
customField: '20091011-192635'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7801',
internalId:  '',
customField: '20100209-162808'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10IN35UN';
var companyName   = 'home+of+vintage+ATCO';
var htmlTitle	  = 'Steve+Le-Vien+Is+Online%21';
var metaKeywords  = '';
var metaContents  = '';
theSitetree.getById = function(id, ar) {
	if (typeof(ar) == 'undefined'){
		ar = this;
	}
	for (var i=0; i < ar.length; i++) {
		if (ar[i][POS_ID] == id){
			return ar[i];
		}
		if (ar[i][POS_CHILDS].length > 0) {
			var result=this.getById(id, ar[i][POS_CHILDS]);
			if (result != null){
				return result;
			}
		}
	}
	return null;
};

theSitetree.getParentById = function(id, ar) {
	if (typeof(ar) == 'undefined'){
		ar = this;
	}
	for (var i=0; i < ar.length; i++) {
		for (var j = 0; j < ar[i][POS_CHILDS].length; j++) {
			if (ar[i][POS_CHILDS][j][POS_ID] == id) {
				// child found
				return ar[i];
			}
			var result=this.getParentById(id, ar[i][POS_CHILDS]);
			if (result != null){
				return result;
			}
		}
	}
	return null;
};

theSitetree.getName = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_NAME];
	}
	return null;
};

theSitetree.getNavigationText = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_NAVIGATIONTEXT];
	}
	return null;
};

theSitetree.getHREF = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_HREF];
	}
	return null;
};

theSitetree.getIsNavigation = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_ISNAVIGATION];
	}
	return null;
};

theSitetree.getTemplateName = function(id, lastTemplateName, ar) {
	if (typeof(lastTemplateName) == 'undefined'){
		lastTemplateName = this.topTemplateName;
	}
	if (typeof(ar) == 'undefined'){
		ar = this;
	}
	for (var i=0; i < ar.length; i++) {
		var actTemplateName = ar[i][POS_TEMPLATENAME];
		if (actTemplateName == ''){
			actTemplateName = lastTemplateName;
		}
		if (ar[i][POS_ID] == id) {
			return actTemplateName;
		}
		if (ar[i][POS_CHILDS].length > 0) {
			var result=this.getTemplateName(id, actTemplateName, ar[i][POS_CHILDS]);
			if (result != null){
				return result;
			}
		}
	}
	return null;
};

theSitetree.getByXx = function(lookup, xx, ar) {
    if (typeof(ar) == 'undefined'){
    	ar = this;
    }
    for (var i=0; i < ar.length; i++) {
        if (ar[i][xx] == lookup){
        	return ar[i];
        }
        if (ar[i][POS_CHILDS].length > 0) {
        	var result=this.getByXx(lookup, xx, ar[i][POS_CHILDS]);
            if (result != null){
                return result;
               }
        }
    }
    return null;
};

function gotoPage(lookup) {
	if(__path_prefix__ == "/servlet/CMServeRES" && typeof (changePage) == 'function'){
		changePage(lookup);
		return;
	}
	var page = theSitetree.getHREF(lookup);
	if (!page) {
		var testFor = [ POS_NAME, POS_NAVIGATIONTEXT ];
		for (var i=0 ; i < testFor.length ; i++) {
			var p = theSitetree.getByXx(lookup, testFor[i]);
			if (p != null) {
				page = p[POS_HREF];
				break;
			}
		}
	}
	document.location.href = (new URL(__path_prefix__ + page, true, true)).toString();
};
