/* [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','801',jdecode('Home'),jdecode(''),'/801.html','true',[],'',''],
	['PAGE','6322',jdecode('White+Metalling+Services'),jdecode(''),'/6322/index.html','true',[ 
		['PAGE','6343',jdecode('Engine+rebuilder+instructions'),jdecode(''),'/6322/6343.html','true',[],'',''],
		['PAGE','6385',jdecode('Machine+shop+instructions'),jdecode(''),'/6322/6385.html','true',[],'',''],
		['PAGE','17801',jdecode('Other+Engine+Services'),jdecode(''),'/6322/17801.html','true',[],'','']
	],'',''],
	['PAGE','6406',jdecode('Contact+us'),jdecode(''),'/6406.html','true',[],'',''],
	['PAGE','7301',jdecode('Gallery'),jdecode(''),'/7301.html','true',[],'',''],
	['PAGE','6490',jdecode('Questions+%26+Answers'),jdecode(''),'/6490.html','true',[],'',''],
	['PAGE','6301',jdecode('Our+History'),jdecode(''),'/6301.html','true',[],'',''],
	['PAGE','22701',jdecode('Friends+%26+Customers'),jdecode(''),'/22701.html','true',[],'',''],
	['PAGE','6469',jdecode('Clubs'),jdecode(''),'/6469/index.html','true',[ 
		['PAGE','11901',jdecode('Clubs+-+USA'),jdecode(''),'/6469/11901.html','true',[],'',''],
		['PAGE','11922',jdecode('Clubs+-+Rest+of+the+world'),jdecode(''),'/6469/11922.html','true',[],'',''],
		['PAGE','11943',jdecode('Clubs+-+Motorcycle'),jdecode(''),'/6469/11943.html','true',[],'','']
	],'',''],
	['PAGE','13301',jdecode('Museums'),jdecode(''),'/13301/index.html','true',[ 
		['PAGE','13322',jdecode('Museums+-+World+wide'),jdecode(''),'/13301/13322.html','true',[],'',''],
		['PAGE','13343',jdecode('Museums+-+Motor+Cycle'),jdecode(''),'/13301/13343.html','true',[],'','']
	],'',''],
	['PAGE','45701',jdecode('Vintage+resources'),jdecode(''),'/45701/index.html','false',[ 
		['PAGE','45722',jdecode('Engines'),jdecode(''),'/45701/45722.html','false',[],'',''],
		['PAGE','45743',jdecode('Transmission'),jdecode(''),'/45701/45743.html','false',[],'',''],
		['PAGE','45764',jdecode('Chassis'),jdecode(''),'/45701/45764.html','false',[],'',''],
		['PAGE','45785',jdecode('Electrical'),jdecode(''),'/45701/45785.html','false',[],'',''],
		['PAGE','45806',jdecode('Body+work'),jdecode(''),'/45701/45806.html','false',[],'',''],
		['PAGE','45827',jdecode('Upholstery'),jdecode(''),'/45701/45827.html','false',[],'','']
	],'','']];
var siteelementCount=24;
theSitetree.topTemplateName='Easy';
theSitetree.paletteFamily='000000';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='50';
theSitetree.graphicsetId='51';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Easy',
				paletteFamily: 	'000000',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'50',
				graphicsetId: 	'51',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'FFFFFF',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7060']=webappMappings['7060-ab6535c7be10a087c1a8af47d3c5b5c1']={
webappId:    '7060',
documentId:  '7301',
internalId:  'ab6535c7be10a087c1a8af47d3c5b5c1',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '801',
internalId:  '',
customField: '20100830-164848'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7301',
internalId:  '',
customField: '20080220-152540'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6322',
internalId:  '',
customField: '20080208-143013'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6343',
internalId:  '',
customField: '20080115-155219'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6385',
internalId:  '',
customField: '20080115-155359'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17801',
internalId:  '',
customField: '20080208-143251'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6406',
internalId:  '',
customField: '20080129-153329'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6490',
internalId:  '',
customField: '20080528-151329'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6301',
internalId:  '',
customField: '20090318-162953'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22701',
internalId:  '',
customField: '20101024-024102'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6469',
internalId:  '',
customField: '20110716-030345'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11901',
internalId:  '',
customField: '20080113-153204'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11922',
internalId:  '',
customField: '20080113-153722'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11943',
internalId:  '',
customField: '20080113-155041'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13301',
internalId:  '',
customField: '20080114-154203'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13322',
internalId:  '',
customField: '20080114-154734'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13343',
internalId:  '',
customField: '20100114-151913'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45701',
internalId:  '',
customField: '20080421-144000'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45722',
internalId:  '',
customField: '20080421-143527'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45743',
internalId:  '',
customField: '20080421-135431'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45764',
internalId:  '',
customField: '20080421-135431'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45785',
internalId:  '',
customField: '20080421-135431'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45806',
internalId:  '',
customField: '20080421-135431'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45827',
internalId:  '',
customField: '20080421-135431'
};
var canonHostname = 'cmworker01.yourhostingaccount.com';
var accountId     = 'AENDU0INXFX5';
var companyName   = 'Formhalls+Vintage+%26+Racing+Ltd';
var htmlTitle	  = 'Formhalls+White+Metalling+-+White+Metal+Bearings+-+Guaranteed+for+Life';
var metaKeywords  = 'White+metalling++White+metal+bearings++White+metal++Babbit++Vintage+engine';
var metaContents  = 'White+metalling++-+White+metal+bearings+-+Guaranteed+for+life';
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();
};

