/* [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','2601',jdecode('Home'),jdecode(''),'/2601.html','true',[],'',''],
	['PAGE','20701',jdecode('Parts+Request'),jdecode(''),'/20701.html','true',[],'',''],
	['PAGE','2652',jdecode('About+us'),jdecode(''),'/2652/index.html','true',[ 
		['PAGE','2673',jdecode('Repair+shop'),jdecode(''),'/2652/2673.html','true',[],'',''],
		['PAGE','2715',jdecode('How+to+find+us'),jdecode(''),'/2652/2715.html','true',[],'','']
	],'',''],
	['PAGE','2736',jdecode('Contact'),jdecode(''),'/2736.html','true',[],'',''],
	['PAGE','13601',jdecode('Prices'),jdecode(''),'/13601.html','true',[],'',''],
	['PAGE','13706',jdecode('Used+vehicles'),jdecode(''),'/13706.html','true',[],'',''],
	['PAGE','13901',jdecode('Opening+hours'),jdecode(''),'/13901.html','true',[],'',''],
	['PAGE','13922',jdecode('Service'),jdecode(''),'/13922/index.html','true',[ 
		['PAGE','13964',jdecode('Off+Road'),jdecode(''),'/13922/13964.html','true',[],'',''],
		['PAGE','14048',jdecode('Windshield+%26+Glass'),jdecode(''),'/13922/14048.html','true',[],'','']
	],'','']];
var siteelementCount=12;
theSitetree.topTemplateName='NewYork';
theSitetree.paletteFamily='86862D';
theSitetree.keyvisualId='965';
theSitetree.keyvisualName='autofahrer.jpg';
theSitetree.fontsetId='170';
theSitetree.graphicsetId='196';
theSitetree.contentColor='006633';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'NewYork',
				paletteFamily: 	'86862D',
				keyvisualId: 	'965',
				keyvisualName: 	'autofahrer.jpg',
				fontsetId: 		'170',
				graphicsetId: 	'196',
				contentColor: 	'006633',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'86862D',
				c_color: 		'000000',
				d_color: 		'2C331B',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2601',
internalId:  '',
customField: '20091129-174210'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2652',
internalId:  '',
customField: '20100520-163223'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2736',
internalId:  '',
customField: '20091129-171556'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2601',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2673',
internalId:  '',
customField: '20090815-120954'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2715',
internalId:  '',
customField: '20090815-121049'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13706',
internalId:  '',
customField: '20100708-171648'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13601',
internalId:  '',
customField: '20091129-170935'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13901',
internalId:  '',
customField: '20100520-171030'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13922',
internalId:  '',
customField: '20090920-170516'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13964',
internalId:  '',
customField: '20090920-170955'
};
webappMappings['7008']=webappMappings['7008-2297']={
webappId:    '7008',
documentId:  '20701',
internalId:  '2297',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14048',
internalId:  '',
customField: '20090920-165137'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20701',
internalId:  '',
customField: '20090909-110150'
};
webappMappings['1501']=webappMappings['1501-21610631']={
webappId:    '1501',
documentId:  '2601',
internalId:  '21610631',
customField: '1501'
};
var canonHostname = 'wscwrk02.ehost-services.com';
var accountId     = 'AEN330INFWIZ';
var companyName   = 'Valley+4x4+Spares+%26+Repairs';
var htmlTitle	  = 'Valley4x4+';
var metaKeywords  = 'accrington+lancs+lancashire+4x4+spares+repairs+japinese+toyota+daihatsu+nissan+isuzu+mitsubishi+shogun+service+mot+supply+and+fit+engine+gearbox+axle+transaxle+door+bumper+lights+bodywork+paintshop+new+used+reconditioned+japanese%2C4x4%2C4wd%2Cfour+by+four%2C+accrington%2C+lancashire%2Cdaihatsu%2Cisuzu%2Cmitsubishi%2Cmazda%2Cnissan%2Csuzuki%2Ctoyota%2Cford%2Cvauxhall%2Csubaru%2Coff+road%2Cfourtrak%2Csportrak%2Ctrooper%2Cpatrol%2Clandcruiser%2Cspares%2Cparts%2Cspares+and+accessories%2C+where+can+I+find+spares+for+a+4x4%3F%2C+japanese+cars%2C4wd+spare+parts%2Cshogun%2Chilux%2Chilux+spares%2Cnew+4x4+parts%2Csj410%2Csj413%2Cvitara%2Cterrano%2Cmaverick%2Cfrontera%2Cmonterey%2Cd22%2Clegacy%2Clseries%2Cbrava%2Cpajero%2Ckia+sportage%2Cssangyong+musso%2Cshogun%2Chilux%2Chilux+spares%2Cnew+4x4%2Csj410%2Csj413%2Cvitara%2Cterrano%2Cmaverick%2Cfrontera%2Cmonterey%2Cd22+d21%2Cd40%2Clegacy%2Cbrava%2Cpajero%2CDaihatsu%2C+Mitsubishi%2C+Toyota%2C+Isuzu%2C+SuzukiJapanese+4x4+parts%2C+pajero+parts%2C+shogun+parts%2C+Nissan+parts%2C+L200+parts%2C+cylinder+head%2C+filter+kits%2C+hilux+parts%2C+isuzu+parts%2C+double+cab%2C+Japanese+imports%2C+suspension+parts%2C+ford+ranger+parts%2C+poly+bush+kits%2C+exhaust+systems.';
var metaContents  = 'New+and+used+japanese+4x4+spares+and+repairs%2C+contact+us+with+your+requirements%2C+have+your+4x4+serviced+and+repaired+in+our+own+workshops%2C+very+reasonable+rates%2C+over+30+years+experience.';
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();
};
