/* [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','53',jdecode('home'),jdecode(''),'/53.html','true',[],'',''],
	['PAGE','2490',jdecode('contact+us'),jdecode(''),'/2490/index.html','true',[ 
		['PAGE','3995',jdecode('Contact+%2F+Location+%28follow+up+page%29'),jdecode(''),'/2490/3995.html','false',[],'','']
	],'',''],
	['PAGE','2499',jdecode('tuning+%26+performance'),jdecode(''),'/2499.html','true',[],'',''],
	['PAGE','4313',jdecode('industry+links'),jdecode(''),'/4313.html','true',[],'',''],
	['PAGE','4322',jdecode('bikes+for+sale'),jdecode(''),'/4322.html','true',[],'',''],
	['PAGE','10901',jdecode('specials'),jdecode(''),'/10901.html','true',[],'',''],
	['PAGE','3513',jdecode('shop+photos'),jdecode(''),'/3513.html','true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Card';
theSitetree.paletteFamily='990000';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='429';
theSitetree.graphicsetId='479';
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: 			'Card',
				paletteFamily: 	'990000',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'429',
				graphicsetId: 	'479',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'FFFFFF',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '53',
internalId:  '1006',
customField: '1006'
};
webappMappings['7060']=webappMappings['7060-cc714f3cd382b415ac80a3d1293ec7ba']={
webappId:    '7060',
documentId:  '3513',
internalId:  'cc714f3cd382b415ac80a3d1293ec7ba',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '53',
internalId:  '',
customField: '20090430-181257'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2490',
internalId:  '',
customField: '20090430-193259'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3995',
internalId:  '',
customField: '20080202-182206'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2499',
internalId:  '',
customField: '20090430-192559'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4313',
internalId:  '',
customField: '20090430-164911'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4322',
internalId:  '',
customField: '20090430-183947'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3513',
internalId:  '',
customField: '20090430-191034'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10901',
internalId:  '',
customField: '20090612-133300'
};
webappMappings['7008']=webappMappings['7008-8567']={
webappId:    '7008',
documentId:  '2490',
internalId:  '8567',
customField: 'language:en;country:US;'
};
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050IN3PT9';
var companyName   = 'located+at+Las+Vegas+Motor+Speedway++++++++++702.644.9412';
var htmlTitle	  = 'Las+Vegas+Dyno+Tech';
var metaKeywords  = 'dyno+tuning%2C+las+vegas%2C+dynojet%2C+motorcycle+repair%2C+motorcycle+service%2C+power+commander%2C+dyno+tech%2C+dynotech%2C+las+vegas+speedway%2C+motorcycle+tires%2C+race+tires%2C+702+sportbikes%2C+fuel+injection+mapping%2C+motorcycle+accidents%2C+harley+davidson%2C+yamaha%2C+suzuki%2C+kawasaki%2C+scooter+repair%2C+motorcycle+racing%2C+track+days%2C+powder+coating%2C+brakes%2C+WERA%2C+myspace%2C+parts+unlimited%2C+lockhart+phillips%2C+barnett';
var metaContents  = '';
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();
};
