/* [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','401',jdecode('Home'),jdecode(''),'/401.html','true',[],''],
	['PAGE','452',jdecode('About+us'),jdecode(''),'/452.html','true',[],''],
	['PAGE','494',jdecode('Installation'),jdecode(''),'/494/index.html','true',[ 
		['PAGE','10601',jdecode('Rewires'),jdecode(''),'/494/10601.html','true',[],''],
		['PAGE','515',jdecode('Lighting+and+Extra+Sockets'),jdecode(''),'/494/515.html','true',[],''],
		['PAGE','536',jdecode('Electric+Heating'),jdecode(''),'/494/536.html','true',[],''],
		['PAGE','557',jdecode('Security+and+Fire+Systems'),jdecode(''),'/494/557.html','true',[],''],
		['PAGE','578',jdecode('Network+and+Data'),jdecode(''),'/494/578.html','true',[],'']
	],''],
	['PAGE','13901',jdecode('Maintenance'),jdecode(''),'/13901.html','true',[],''],
	['PAGE','13922',jdecode('Periodic+Inspection+and+Testing'),jdecode(''),'/13922.html','true',[],''],
	['PAGE','620',jdecode('Portable+Appliance+Testing'),jdecode(''),'/620.html','true',[],''],
	['PAGE','473',jdecode('Quality+Assurance'),jdecode(''),'/473.html','true',[],''],
	['PAGE','641',jdecode('Testimonials'),jdecode(''),'/641.html','true',[],''],
	['PAGE','662',jdecode('Contact'),jdecode(''),'/662.html','true',[],''],
	['PAGE','5601',jdecode('How+To+Find+Us'),jdecode(''),'/5601.html','true',[],'']];
var siteelementCount=15;
theSitetree.topTemplateName='Logg';
theSitetree.paletteFamily='2A7871';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='421';
theSitetree.graphicsetId='473';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='2A7871';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				name: 			'Logg',
				paletteFamily: 	'2A7871',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'421',
				graphicsetId: 	'473',
				contentColor: 	'FFFFFF',
				contentBGColor: '2A7871',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'2A7871',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '5601',
internalId:  'location',
customField: 'language:en;country:GB;isIncluded:false;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20080312-142706'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '473',
internalId:  '',
customField: '20070913-151112'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '494',
internalId:  '',
customField: '20070913-150557'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '578',
internalId:  '',
customField: '20070724-190931'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '452',
internalId:  '',
customField: '20070913-150845'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '515',
internalId:  '',
customField: '20070913-130606'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '536',
internalId:  '',
customField: '20070913-130927'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '557',
internalId:  '',
customField: '20070913-125716'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '620',
internalId:  '',
customField: '20070913-143353'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '641',
internalId:  '',
customField: '20070913-143617'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '662',
internalId:  '',
customField: '20070913-143645'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5601',
internalId:  '',
customField: '20070913-143859'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10601',
internalId:  '',
customField: '20070913-130455'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13901',
internalId:  '',
customField: '20070913-145027'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13922',
internalId:  '',
customField: '20070913-143336'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10INXSUR';
var companyName   = 'Armstrong+Electrical+Services+Ltd';
var htmlTitle	  = 'armstrong+electrical';
var metaKeywords  = 'META+name%3Dkeywords+content%3Delectricians+lancashire%2Celectrical+contractor+lancashire%2Celectrical+engineers+united+kingdom+%2Celectrician+preston%2Celectrical+wiring+regulations%2Cdomestic+electrical+wiring%2Celectrical+work+installation%2Cindustrial+electrical+installation+%2Cuk+electric+storage+heater%2Cnight++storage+heaters+uk%2Cstorage+heaters+uk%2Cdimplex+storage+heater%2Ccreda+storage+heater%2Clancashire+cctv%2Cfire+alarms+united+kingdom+%2Ccctv+cameras+uk%2Cuk+fire+alarm+systems+%2Ccctv+equipment+uk%2Ccctv+installers+uk%2Celectrical+appliance+repair+services%2Cuk+portable+appliance+testing+%2Cequipment+pat+testing%2Celectrical+portable+appliance+testing%2Celectrical+pat+testing%2C+www.armstrongelectrical.co.uk';
var metaContents  = 'META+name%3Dkeywords+content%3Delectricians+lancashire%2Celectrical+contractor+lancashire%2Celectrical+engineers+united+kingdom+%2Celectrician+preston%2Celectrical+wiring+regulations%2Cdomestic+electrical+wiring%2Celectrical+work+installation%2Cindustrial+electrical+installation+%2Cuk+electric+storage+heater%2Cnight++storage+heaters+uk%2Cstorage+heaters+uk%2Cdimplex+storage+heater%2Ccreda+storage+heater%2Clancashire+cctv%2Cfire+alarms+united+kingdom+%2Ccctv+cameras+uk%2Cuk+fire+alarm+systems+%2Ccctv+equipment+uk%2Ccctv+installers+uk%2Celectrical+appliance+repair+services%2Cuk+portable+appliance+testing+%2Cequipment+pat+testing%2Celectrical+portable+appliance+testing%2Celectrical+pat+testing%2C+www.armstrongelectrical.co.uk';
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();
};
