/* [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','5101',jdecode('Home'),jdecode(''),'/5101.html','true',[],''],
	['PAGE','5152',jdecode('About+us'),jdecode(''),'/5152.html','true',[],''],
	['PAGE','5178',jdecode('Service'),jdecode(''),'/5178.html','true',[],''],
	['PAGE','5204',jdecode('News'),jdecode(''),'/5204.html','true',[],''],
	['PAGE','5230',jdecode('Contact+us'),jdecode(''),'/5230.html','true',[],''],
	['PAGE','53301',jdecode('E.P.C.'),jdecode(''),'/53301.html','true',[],''],
	['PAGE','53501',jdecode('H.I.P'),jdecode(''),'/53501.html','true',[],''],
	['PAGE','55201',jdecode('Email'),jdecode(''),'/55201.html','true',[],''],
	['PAGE','60001',jdecode('Special+offers'),jdecode(''),'/60001.html','true',[],'']];
var siteelementCount=9;
theSitetree.topTemplateName='Global';
theSitetree.paletteFamily='CC3300';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='85';
theSitetree.graphicsetId='107';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				name: 			'Global',
				paletteFamily: 	'CC3300',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'85',
				graphicsetId: 	'107',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'CB1C00',
				b_color: 		'FF9900',
				c_color: 		'000000',
				d_color: 		'EAEAEA',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5101',
internalId:  '',
customField: '20080821-104432'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5152',
internalId:  '',
customField: '20100104-120103'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5230',
internalId:  '',
customField: '20100104-120138'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5178',
internalId:  '',
customField: '20100104-115655'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5204',
internalId:  '',
customField: '20100104-115747'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5101',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '53301',
internalId:  '',
customField: '20080821-110754'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '53501',
internalId:  '',
customField: '20080820-143329'
};
webappMappings['1501']=webappMappings['1501-6777243']={
webappId:    '1501',
documentId:  '5101',
internalId:  '6777243',
customField: '1501'
};
webappMappings['7008']=webappMappings['7008-1950']={
webappId:    '7008',
documentId:  '55201',
internalId:  '1950',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '55201',
internalId:  '',
customField: '20080716-182014'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '60001',
internalId:  '',
customField: '20080820-145651'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20INE0MG';
var companyName   = 'Clarkes+Property+Services';
var htmlTitle	  = 'Wolverhampton+Energy+Assessors+%26+Home+Information+Pack+Providers';
var metaKeywords  = 'HIP%2C+DEA%2C+EPC%2CBRE%2CABBE%2CSearches%2CLocal%2C+Midlands%2CWales%2CSwansea%2CWolverhampton%2CHome+Information+Packs%2C+Rental%2C+Letting%2C+Estate+Agents%2C+Solicitors%2C+Conveyancing%2C+Local+Authority+Reports%2C+energy+assessors%2C+local%2C+professional%2C+qualified%2C+insured%2C+property%2C+sales%2C+property+sales%2C+land+lords%2C+tenancy%2C+SAP%2C+RDSAP%2C+Energy+Saving%2C+CPS%2C+Clarkes%2C+clarkes%2C+cps%2C+clarkes+property+services%2C+rental%2C+letting%2C+lettings%2C+rentals%2C+property%2C+properties%2C+portfolio%2C+domestic%2C+commercial%2C+energy+consultants%2C+wolves%2C+swans%2C+llanelli%2C+neath%2C+port+talbot%2C+welsh%2C+english%2C+codsall%2C+albrighton%2C+tettenhall%2C+claregate%2C+wv1%2C+wv2%2C+wv3%2C+wv4%2C+wv5%2C+wv6%2C+wv7%2C+wv8%2C+wv9%2C+wv10%2C+wv%2C+sw%2C+sw1%2C+condensing+boiler%2C+ground+source+heat+pump%2C+gas%2C+electric%2C';
var metaContents  = 'CPS+Clarkes+Property+Services%2C+Home+Information+Pack+Providers%2C+Domestic+Energy+AssessorsWolverhamptonSouth+Wales';
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();
};
