/* [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','2001',jdecode('Home'),jdecode(''),'/2001.html','true',[],''],
	['PAGE','16733',jdecode('Shop+News'),jdecode(''),'/16733.html','false',[],''],
	['PAGE','16105',jdecode('C-Type+Replica'),jdecode(''),'/16105/index.html','true',[ 
		['PAGE','16129',jdecode('Chassis'),jdecode(''),'/16105/16129.html','true',[],''],
		['PAGE','16138',jdecode('Body+Panels'),jdecode(''),'/16105/16138.html','true',[],''],
		['PAGE','16147',jdecode('Componets'),jdecode(''),'/16105/16147.html','true',[],''],
		['PAGE','16185',jdecode('Options+%26+Pricing'),jdecode(''),'/16105/16185.html','true',[],''],
		['PAGE','16246',jdecode('C-Type+Photo+Album'),jdecode(''),'/16105/16246.html','true',[],''],
		['PAGE','16194',jdecode('C-Type+FAQ%26%23x27%3Bs'),jdecode(''),'/16105/16194.html','true',[],'']
	],''],
	['PAGE','16021',jdecode('Restoration+Services'),jdecode(''),'/16021/index.html','true',[ 
		['PAGE','9001',jdecode('1967+Mark+2+Restoration'),jdecode(''),'/16021/9001.html','true',[],''],
		['PAGE','9022',jdecode('1960+Mark+2+Partial+Restoration'),jdecode(''),'/16021/9022.html','true',[],''],
		['PAGE','16071',jdecode('1958+XK150+Mechanical+Restoration'),jdecode(''),'/16021/16071.html','true',[],'']
	],''],
	['PAGE','2052',jdecode('Modification+%26+Repair+Services'),jdecode(''),'/2052/index.html','true',[ 
		['PAGE','8901',jdecode('XKE+6-Speed+Trans+Conversion'),jdecode(''),'/2052/8901.html','true',[],''],
		['PAGE','16285',jdecode('E-Type+Engine+Enhancements'),jdecode(''),'/2052/16285.html','true',[],''],
		['PAGE','17101',jdecode('Building+the+7.4+Litre+Engine'),jdecode(''),'/2052/17101.html','true',[],'']
	],''],
	['PAGE','2073',jdecode('Component+Rebuilding'),jdecode(''),'/2073.html','true',[],''],
	['PAGE','2094',jdecode('Parts+Sales'),jdecode(''),'/2094.html','true',[],''],
	['PAGE','16890',jdecode('Featured+Item'),jdecode(''),'/16890.html','true',[],''],
	['PAGE','2115',jdecode('Consulting'),jdecode(''),'/2115.html','true',[],''],
	['PAGE','2136',jdecode('About+Us'),jdecode(''),'/2136.html','true',[],''],
	['PAGE','16803',jdecode('Contact+Us'),jdecode(''),'/16803.html','true',[],''],
	['PAGE','16792',jdecode('Search'),jdecode(''),'/16792.html','true',[],'']];
var siteelementCount=24;
theSitetree.topTemplateName='Alpha';
theSitetree.paletteFamily='479949';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10461';
theSitetree.graphicsetId='10895';
theSitetree.contentColor='476649';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Alpha',
				paletteFamily: 	'479949',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10461',
				graphicsetId: 	'10895',
				contentColor: 	'476649',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'479949',
				e_color: 		'479949',
				f_color: 		'479949',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2001',
internalId:  '',
customField: '20100202-155114'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2115',
internalId:  '',
customField: '20080806-111933'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16890',
internalId:  '',
customField: '20091222-170749'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2136',
internalId:  '',
customField: '20080717-163447'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2094',
internalId:  '',
customField: '20090917-145607'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2052',
internalId:  '',
customField: '20090814-110504'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9001',
internalId:  '',
customField: '20080802-150207'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2073',
internalId:  '',
customField: '20090401-150607'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9022',
internalId:  '',
customField: '20080806-154835'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8901',
internalId:  '',
customField: '20080806-154937'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2001',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16021',
internalId:  '',
customField: '20090513-160757'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16071',
internalId:  '',
customField: '20090513-165522'
};
webappMappings['7050']=webappMappings['7050-65']={
webappId:    '7050',
documentId:  '16733',
internalId:  '65',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16105',
internalId:  '',
customField: '20090513-145705'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16129',
internalId:  '',
customField: '20090513-160002'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16138',
internalId:  '',
customField: '20090513-160138'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16147',
internalId:  '',
customField: '20090513-145823'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16194',
internalId:  '',
customField: '20090513-160438'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16185',
internalId:  '',
customField: '20090513-171158'
};
webappMappings['7060']=webappMappings['7060-38806209b2da09386b0a51dea3da7403']={
webappId:    '7060',
documentId:  '16246',
internalId:  '38806209b2da09386b0a51dea3da7403',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16246',
internalId:  '',
customField: '20100105-115404'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16285',
internalId:  '',
customField: '20090512-135239'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16733',
internalId:  '',
customField: '20090528-154544'
};
webappMappings['8002']=webappMappings['8002-search']={
webappId:    '8002',
documentId:  '16792',
internalId:  'search',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16792',
internalId:  '',
customField: '20090729-170430'
};
webappMappings['7008']=webappMappings['7008-458']={
webappId:    '7008',
documentId:  '16803',
internalId:  '458',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16803',
internalId:  '',
customField: '20090729-164033'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17101',
internalId:  '',
customField: '20090814-114636'
};
var canonHostname = 'cm4all01.west-datacenter.net';
var accountId     = 'AWH030IN2R6J';
var companyName   = '';
var htmlTitle	  = 'Vintage+Jag+Works';
var metaKeywords  = 'Vintage+Jag+Works%2C+Jaguar%2C+Jag%2C+restoration%2C+full+restoration%2C+partial+restoration%2C+service%2C+modification%2C+rebuild%2C+rebuilding%2C+components%2C+parts%2C+C-Type%2C+C+Type%2C+E-Type%2C+E+Type%2C+XKE%2C+Mark+1%2C+Mark+I%2C+Mark+2%2C+Mark+II%2C+';
var metaContents  = 'At+Vintage+Jag+Works+we+specialize+in+mechanical+and+restoration+services%2C+component+rebuilding+and+parts+sales+for+older+Jaguars.+We+also+manufacture+C-Type+Replicas';
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();
};
