/* [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 theSitetree=[ 
	['PAGE','21401',jdecode('Home'),jdecode(''),'/21401.html','true',[],''],
	['PAGE','21452',jdecode('Meet+The+Team'),jdecode(''),'/21452.html','true',[],''],
	['PAGE','26101',jdecode('Services'),jdecode(''),'/26101.html','true',[],''],
	['PAGE','21478',jdecode('Gallery'),jdecode(''),'/21478.html','true',[],''],
	['PAGE','21504',jdecode('Testimonials'),jdecode(''),'/21504.html','true',[],''],
	['PAGE','21530',jdecode('Awards'),jdecode(''),'/21530.html','true',[],''],
	['PAGE','21556',jdecode('Contact'),jdecode(''),'/21556.html','true',[],'']];
var siteelementCount=7;
theSitetree.topTemplateName='Ragtime';
theSitetree.paletteFamily='B3CA99';
theSitetree.keyvisualId='3572';
theSitetree.keyvisualName='kv_3572.jpg';
theSitetree.fontsetId='10452';
theSitetree.graphicsetId='10852';
theSitetree.contentColor='5D6B55';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				name: 			'Ragtime',
				paletteFamily: 	'B3CA99',
				keyvisualId: 	'3572',
				keyvisualName: 	'kv_3572.jpg',
				fontsetId: 		'10452',
				graphicsetId: 	'10852',
				contentColor: 	'5D6B55',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'B3CA99',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'747475',
				e_color: 		'899D75',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-3170']={
webappId:    '7008',
documentId:  '21556',
internalId:  '3170',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21401',
internalId:  '',
customField: '20081203-130700'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21478',
internalId:  '',
customField: '20081203-132745'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21452',
internalId:  '',
customField: '20081203-130544'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '21401',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-8133613']={
webappId:    '1501',
documentId:  '21401',
internalId:  '8133613',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26101',
internalId:  '',
customField: '20081203-131849'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21504',
internalId:  '',
customField: '20090130-123525'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21556',
internalId:  '',
customField: '20081203-133503'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21530',
internalId:  '',
customField: '20081203-133357'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20INEN6X';
var companyName   = 'AWARD-WINNING+GARDEN+LANDSCAPERS';
var htmlTitle	  = 'Rex+Arnold+Landscape+Construction';
var metaKeywords  = 'HEADREX%2CARNOLD%2CGARDEN%2CLANDSCAPERS%2CDORSET%2CLANDSCAPERS%2CGARDEN%2CMAINTENANCE%2CGARDEN%2CDESIGN%2CAWARD%2CWINNING%2CGARDEN%2CDESIGN%2C%2FHEAD';
var metaContents  = 'Rex+Arnold+runs+an+award-winning+team+of+Dorset+garden+landscapers.+Rex+Arnold+Landscape+Construction+offers+a+courteous%2C+honest+and+professional+service+from+a+family+business+with+nearly+40+years+experience+in+garden+landscape+construction.';
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();
};
