/* [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','401',jdecode('Home'),jdecode(''),'/401.html','true',[],'',''],
	['PAGE','44801',jdecode('Peterborough'),jdecode(''),'/44801.html','true',[],'',''],
	['PAGE','536',jdecode('LRO+Show+Peterborough'),jdecode(''),'/536.html','true',[],'',''],
	['PAGE','49501',jdecode('Investment+or+Money+Pit%3F'),jdecode(''),'/49501.html','true',[],'',''],
	['PAGE','55801',jdecode('Tortworth+Vintage+Sortout+++'),jdecode(''),'/55801.html','true',[],'',''],
	['PAGE','57101',jdecode('Selling+Hints+'),jdecode(''),'/57101.html','true',[],'',''],
	['PAGE','63201',jdecode('Vintage+Booking+Form'),jdecode(''),'/63201.html','true',[],'',''],
	['PAGE','60001',jdecode('Peterborough+Booking+'),jdecode(''),'/60001.html','false',[],'',''],
	['PAGE','515',jdecode('Great+Northern+'),jdecode(''),'/515.html','true',[],'',''],
	['PAGE','59401',jdecode('Speed+Dating+for+Land+Rovers+'),jdecode(''),'/59401.html','true',[],'',''],
	['PAGE','62701',jdecode('Bristol+Vintage+'),jdecode(''),'/62701.html','true',[],'',''],
	['PAGE','452',jdecode('Beaulieu'),jdecode(''),'/452.html','true',[],'',''],
	['PAGE','51301',jdecode('Beaulieu+Booking+Form+'),jdecode(''),'/51301.html','true',[],'',''],
	['PAGE','5522',jdecode('Newark+'),jdecode(''),'/5522.html','true',[],'',''],
	['PAGE','599',jdecode('Appraisals'),jdecode(''),'/599.html','true',[],'',''],
	['PAGE','44853',jdecode('Available+Projects'),jdecode(''),'/44853.html','true',[],'',''],
	['PAGE','50001',jdecode('Wanted++to+purchase+'),jdecode(''),'/50001.html','true',[],'',''],
	['PAGE','11501',jdecode('Dustbin+Films+'),jdecode(''),'/11501.html','true',[],'',''],
	['PAGE','50027',jdecode('Useful+People+to+know+'),jdecode(''),'/50027.html','true',[],'',''],
	['PAGE','578',jdecode('Contact'),jdecode(''),'/578.html','true',[],'',''],
	['PAGE','620',jdecode('To+email+us+'),jdecode(''),'/620.html','true',[],'',''],
	['PAGE','42005',jdecode('Imprint'),jdecode(''),'/42005.html','true',[],'',''],
	['PAGE','41901',jdecode('About+us'),jdecode(''),'/41901.html','true',[],'','']];
var siteelementCount=23;
theSitetree.topTemplateName='Wire';
theSitetree.paletteFamily='CD3234';
theSitetree.keyvisualId='7829';
theSitetree.keyvisualName='kv_7829.jpg';
theSitetree.fontsetId='16822';
theSitetree.graphicsetId='12280';
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: 			'Wire',
				paletteFamily: 	'CD3234',
				keyvisualId: 	'7829',
				keyvisualName: 	'kv_7829.jpg',
				fontsetId: 		'16822',
				graphicsetId: 	'12280',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'9D2E2E',
				e_color: 		'9D2E2E',
				f_color: 		'9D2E2E',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20100702-183618'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '536',
internalId:  '',
customField: '20100730-153731'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '452',
internalId:  '',
customField: '20100322-214612'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '515',
internalId:  '',
customField: '20100322-221901'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '578',
internalId:  '',
customField: '20090101-210204'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41901',
internalId:  '',
customField: '20090218-125233'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5522',
internalId:  '',
customField: '20091125-143658'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '599',
internalId:  '',
customField: '20090218-111213'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '620',
internalId:  '',
customField: '20081128-222655'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11501',
internalId:  '',
customField: '20090218-124227'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42005',
internalId:  '',
customField: '20090101-210652'
};
webappMappings['7060']=webappMappings['7060-d6bb42359c11c29cc8162c77affbcfb4']={
webappId:    '7060',
documentId:  '42005',
internalId:  'd6bb42359c11c29cc8162c77affbcfb4',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50001',
internalId:  '',
customField: '20100222-154246'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50027',
internalId:  '',
customField: '20090902-171030'
};
webappMappings['1501']=webappMappings['1501-8257428']={
webappId:    '1501',
documentId:  '401',
internalId:  '8257428',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '44801',
internalId:  '',
customField: '20100730-142346'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '49501',
internalId:  '',
customField: '20091125-110258'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '44853',
internalId:  '',
customField: '20091025-205310'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '51301',
internalId:  '',
customField: '20100222-152920'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '55801',
internalId:  '',
customField: '20100702-192013'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '57101',
internalId:  '',
customField: '20100702-185153'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '59401',
internalId:  '',
customField: '20090902-172827'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '60001',
internalId:  '',
customField: '20100730-150532'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '55801',
internalId:  'location',
customField: 'language:en;country:GB;isIncluded:true;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '62701',
internalId:  '',
customField: '20100322-222846'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '63201',
internalId:  '',
customField: '20100702-190117'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10INXS8W';
var companyName   = 'Old+Sodbury%27s+Sortout+';
var htmlTitle	  = 'Old+Sodburys+Sortout+Agricultural+Vintage+and+Land+Rovers++Junk+galore.';
var metaKeywords  = 'Land+Rover+Sortout+Old+Sodbury+Sale+Vintage+Machinery+Beaulieu+Newark++Peterborough+Harrogate+Brimham++Tractor+Stationary+Engine++junk+Wroughton';
var metaContents  = 'Desription+of+specialist+enthusiasts+sales+of+Land+Rover+Spares+and+Vintage+Agricultural+Machinery.++Sortout+a+gathering+of+enthusiasts+rummaging+through+piles+of+rusty+metal+in+the+hopes+of+pouncing+on+the+part+they+have+been+seeking+for+so+long.+';
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();
};
