/* [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','9401',jdecode('Home'),jdecode(''),'/9401.html','true',[],'',''],
	['PAGE','27301',jdecode('Motorcycle+MOT%26%23x27%3Bs'),jdecode(''),'/27301.html','true',[],'',''],
	['PAGE','25127',jdecode('Motorcycle+Services'),jdecode(''),'/25127.html','true',[],'',''],
	['PAGE','36101',jdecode('Car+Services'),jdecode(''),'/36101.html','true',[],'',''],
	['PAGE','36301',jdecode('Snap-On+Diagnostics'),jdecode(''),'/36301.html','true',[],'',''],
	['PAGE','25153',jdecode('Air+Conditioning+Recharging'),jdecode(''),'/25153.html','true',[],'',''],
	['PAGE','10161',jdecode('Contact'),jdecode(''),'/10161.html','true',[],'',''],
	['PAGE','36701',jdecode('Opening+Hours'),jdecode(''),'/36701.html','true',[],'',''],
	['PAGE','33901',jdecode('How+To+Find+Us'),jdecode(''),'/33901.html','true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Capri';
theSitetree.paletteFamily='737272';
theSitetree.keyvisualId='7163';
theSitetree.keyvisualName='kv_7163.jpg';
theSitetree.fontsetId='16409';
theSitetree.graphicsetId='12138';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Capri',
				paletteFamily: 	'737272',
				keyvisualId: 	'7163',
				keyvisualName: 	'kv_7163.jpg',
				fontsetId: 		'16409',
				graphicsetId: 	'12138',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				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:  '9401',
internalId:  '',
customField: '20100905-141703'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10161',
internalId:  '',
customField: '20101125-115257'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33901',
internalId:  '',
customField: '20100816-144950'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25153',
internalId:  '',
customField: '20100816-152647'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27301',
internalId:  '',
customField: '20100816-145339'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25127',
internalId:  '',
customField: '20100829-204100'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '33901',
internalId:  'location',
customField: 'language:en;country:GB;isIncluded:true;'
};
webappMappings['7008']=webappMappings['7008-7596']={
webappId:    '7008',
documentId:  '10161',
internalId:  '7596',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36101',
internalId:  '',
customField: '20100816-145947'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36701',
internalId:  '',
customField: '20100816-145011'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36301',
internalId:  '',
customField: '20100816-151358'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '9401',
internalId:  '1006',
customField: '1006'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT30IN3T6F';
var companyName   = 'Short+Stop+Tyres+-+01704+573022';
var htmlTitle	  = 'Short+Stop+Tyres%2C+Motorcycle+repair+specialist';
var metaKeywords  = '%3CMETA+name%3D%22keywords%22+content%3D%22car+tyres+uk%2Cpirelli+car+tyres%2Cspare+car+tyres%2Creplacement+car+tyres%2Cquick+fit+tyres+lancashire%2Ctyres+lancashire%2Cbridgestone+motorcycle+tyres%2Cmotorcycle+tyres+for+sale%2Cdunlop+motorcycle+tyres%2Cmotorcycle+tyre+fitters+lancashire%2Cpirelli+motorcycle+tyres%2Cmot+centre+motorcycles+lancashire%2Cmotorcycle+servicing+lancashire%2Ccar+garage+services%2Ccar+maintenance+repair+%2Ccar+repair+tire%2Cuk+car+services%2Cmotorcycle+engineering+and+repairs+%2Cengine+motorcycle+repair%2Cmotorcycle+wheel+repair+%2Ccar+air+conditioning+lancashire%2Ccar+air+conditioning+installers%2Cair+car+conditioning+%2Ccar+air+conditioning+specialists+lancashire+uk%2C+www.shortstoptyres.co.uk%22%3E';
var metaContents  = 'Short+Stop+Tyres+%2C+160+Sandbrook+Road%2C+Ainsdale%2C+Southport%2C+Merseyside%2C+PR8+3RJ%0D%0AMotorcycle+repair+specialist+and+motorcycle+MOT+station%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A160+Sandbrook+Road%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0AAinsdale%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0ASouthport%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0AMerseyside%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0APR8+3RJ%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0AShort+Stop+Tyres+specialises+in+Motorcycle+repairs+and+is+a+designated+Motorcycle+MOT+testing+station.+It+also+carries+out+car+repairs%2C+services%2C+engine+diagnostics+and+air+conditioning+recharging.';
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();
};

