/* [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','15501',jdecode('you+found+us'),jdecode(''), jdecode('%2F15501.html'), 'true',[],'',''],
	['PAGE','13701',jdecode('plant+of+the+moment'),jdecode(''), jdecode('%2F13701.html'), 'true',[],'',''],
	['PAGE','14401',jdecode('the+garden+this+week'),jdecode(''), jdecode('%2F14401.html'), 'true',[],'',''],
	['PAGE','32201',jdecode('portfolio'),jdecode(''), jdecode('%2F32201.html'), 'true',[],'',''],
	['PAGE','43001',jdecode('customers+said'),jdecode(''), jdecode('%2F43001.html'), 'true',[],'',''],
	['PAGE','60812',jdecode('gallery'),jdecode(''), jdecode('%2F60812.html'), 'true',[],'',''],
	['PAGE','71112',jdecode('organic+edible+gardens'),jdecode(''), jdecode('%2F71112.html'), 'true',[],'',''],
	['PAGE','16201',jdecode('contact+us'),jdecode(''), jdecode('%2F16201.html'), 'true',[],'',''],
	['PAGE','34301',jdecode('places+of+interest'),jdecode(''), jdecode('%2F34301.html'), 'true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Court';
theSitetree.paletteFamily='72AD5C';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='16442';
theSitetree.graphicsetId='12146';
theSitetree.contentColor='345C24';
theSitetree.contentBGColor='BEF0AB';
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: 			'Court',
				paletteFamily: 	'72AD5C',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'16442',
				graphicsetId: 	'12146',
				contentColor: 	'345C24',
				contentBGColor: 'BEF0AB',
				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:  '15501',
internalId:  '',
customField: '20110819-115033'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16201',
internalId:  '',
customField: '20110106-122630'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13701',
internalId:  '',
customField: '20111206-175323'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14401',
internalId:  '',
customField: '20111206-174010'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32201',
internalId:  '',
customField: '20100611-070903'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34301',
internalId:  '',
customField: '20090111-115137'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '71112',
internalId:  '',
customField: '20100329-121547'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43001',
internalId:  '',
customField: '20091113-155847'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '60812',
internalId:  '',
customField: '20100920-133356'
};
var webAppHostname = 'cgi.easily.co.uk:80';
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10INXHG2';
var companyName   = 'Edens+Design';
var htmlTitle	  = 'Gardening+Services+in+London+by+Edens+Design';
var metaKeywords  = 'META+name%3Dkeywords+content%3Dgarden+landscaping+london%2Clondon+garden+maintenance+%2Clondon+garden+designer+%2Clondon+garden+landscaping+services%2Cdecking+and+garden+design%2Cgardening+landscape+design+%2Chome+landscape+design+and+idea%2Cgarden+cottage+design+%2Csloping+garden+design%2Cgarden+design+plans%2Clondon+garden+design+%2Clondon+gardening+services+%2Ccontemporary+garden+design%2Cgarden+pond+design%2Cgarden+design+online+%2Cgarden+patio+design+%2Cgarden+wall+design%2Cgarden+design+uk%2Cfuchsias+pruning+%2Clawn+garden+maintenance+services%2Cgarden+lawn+edging%2Ccommercial+garden+maintenance%2Cwaterbuts%2Cresidential+garden+maintenance%2C+';
var metaContents  = 'Gardening+Services+London';
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();
};

