/* [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','55732',jdecode('Home'),jdecode(''), jdecode('%2F55732.html'), 'true',[],'',''],
	['PAGE','4901',jdecode('Accountant%2FDirector'),jdecode(''), jdecode('%2F4901%2Findex.html'), 'true',[ 
		['PAGE','4952',jdecode('Lanham+and+Company'),jdecode(''), jdecode('%2F4901%2F4952.html'), 'true',[],'',''],
		['PAGE','10801',jdecode('Quick+CV'),jdecode(''), jdecode('%2F4901%2F10801.html'), 'true',[],'','']
	],'',''],
	['PAGE','20227',jdecode('Author+Garden+Farming'),jdecode(''), jdecode('%2F20227%2Findex.html'), 'true',[ 
		['PAGE','5030',jdecode('Food+pictures'),jdecode(''), jdecode('%2F20227%2F5030.html'), 'true',[],'','']
	],'',''],
	['PAGE','12901',jdecode('Music'),jdecode(''), jdecode('%2F12901%2Findex.html'), 'true',[ 
		['PAGE','57232',jdecode('The+Pennington+Project'),jdecode(''), jdecode('%2F12901%2F57232.html'), 'true',[],'','']
	],'',''],
	['PAGE','5082',jdecode('New+House'),jdecode(''), jdecode('%2F5082.html'), 'true',[],'',''],
	['PAGE','15301',jdecode('Guests+%26+contact'),jdecode(''), jdecode('%2F15301.html'), 'true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Displace';
theSitetree.paletteFamily='2E2E2E';
theSitetree.keyvisualId='11075';
theSitetree.keyvisualName='kv_11075.jpg';
theSitetree.fontsetId='31958';
theSitetree.graphicsetId='13798';
theSitetree.contentColor='D8D8D5';
theSitetree.contentBGColor='2E2E2E';
var localeDef={
  language: 'en',
  country: 'GB'
};
var prodDef={
  wl_name: 'easily_co_uk',
  product: 'WSCSYSSSSLY0XVDX'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Displace',
				paletteFamily: 	'2E2E2E',
				keyvisualId: 	'11075',
				keyvisualName: 	'kv_11075.jpg',
				fontsetId: 		'31958',
				graphicsetId: 	'13798',
				contentColor: 	'D8D8D5',
				contentBGColor: '2E2E2E',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4901',
internalId:  '',
customField: '20110713-132235'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4952',
internalId:  '',
customField: '20101118-145247'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12901',
internalId:  '',
customField: '20120118-180545'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15301',
internalId:  '',
customField: '20100814-220706'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5030',
internalId:  '',
customField: '20110618-162639'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5082',
internalId:  '',
customField: '20101120-172242'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10801',
internalId:  '',
customField: '20100912-132231'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '55732',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '57232',
internalId:  '',
customField: '20120118-185032'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20227',
internalId:  '',
customField: '20120118-185401'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '55732',
internalId:  '',
customField: '20120118-185541'
};
webappMappings['1002']=webappMappings['1002-15301anbt20in2iq8']={
webappId:    '1002',
documentId:  '15301',
internalId:  '15301anbt20in2iq8',
customField: 'icq=false'
};
var webAppHostname = 'cgi.easily.co.uk:80';
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20IN2IQ8';
var companyName   = 'Hugh+Lanham';
var htmlTitle	  = 'Hugh+Lanham';
var metaKeywords  = 'Chartered+Accountants%2C+Finance+Director%2C+Musician%2C+Flautist%2C+Singer%2C+Baritone%2C+New+House%2C+Self+Build%2C+Smallholder.+Accountant%2C+Consultant%2C+Auditor%2C++Cambridge%2C+Norfolk%2C+Garden+Farming%2C+Flute%2C+Voice%2C+Chairman%2C+Director%2C+Board+Member%2C+Housing';
var metaContents  = 'Founder+and+Chairman+of+Lanham+and+Company+Chartered+Accountants+and+Statutory+Auditors%2C+Finance+Director%2C+Musician%2C+Flautist%2C+Singer%2C+Baritone%2C+New+House%2C+Self+Build%2C+Smallholder.+';
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();
};

