/* [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','32',jdecode('Home'),jdecode(''), jdecode('%2F32.html'), 'true',[],'',''],
	['PAGE','53',jdecode('About+us'),jdecode(''), jdecode('%2F53%2Findex.html'), 'true',[ 
		['PAGE','62',jdecode('BYC+MX+Race+Team'),jdecode(''), jdecode('%2F53%2F62.html'), 'true',[],'','']
	],'',''],
	['PAGE','71',jdecode('Products'),jdecode(''), jdecode('%2F71%2Findex.html'), 'true',[ 
		['PAGE','89',jdecode('New+MX+Bike+Sales'),jdecode(''), jdecode('%2F71%2F89.html'), 'true',[],'',''],
		['PAGE','98',jdecode('Parts+%26+Accessories'),jdecode(''), jdecode('%2F71%2F98.html'), 'true',[],'','']
	],'',''],
	['PAGE','107',jdecode('Our+service'),jdecode(''), jdecode('%2F107%2Findex.html'), 'true',[ 
		['PAGE','116',jdecode('Repairs'),jdecode(''), jdecode('%2F107%2F116.html'), 'true',[],'','']
	],'',''],
	['PAGE','1540',jdecode('Race+Results'),jdecode(''), jdecode('%2F1540%2Findex.html'), 'true',[ 
		['PAGE','170',jdecode('Motorcycle+news'),jdecode(''), jdecode('%2F1540%2F170.html'), 'true',[],'','']
	],'',''],
	['PAGE','134',jdecode('Further+links'),jdecode(''), jdecode('%2F134.html'), 'true',[],'',''],
	['PAGE','125',jdecode('Events'),jdecode(''), jdecode('%2F125.html'), 'true',[],'',''],
	['PAGE','143',jdecode('Contact'),jdecode(''), jdecode('%2F143%2Findex.html'), 'true',[ 
		['PAGE','152',jdecode('Addresses'),jdecode(''), jdecode('%2F143%2F152.html'), 'true',[],'',''],
		['PAGE','161',jdecode('How+to+find+us'),jdecode(''), jdecode('%2F143%2F161.html'), 'true',[],'',''],
		['PAGE','2112',jdecode('Hours+of+operation'),jdecode(''), jdecode('%2F143%2F2112.html'), 'true',[],'','']
	],'',''],
	['PAGE','2100',jdecode('BYC+Mini+Monster'),jdecode(''), jdecode('%2F2100.html'), 'true',[],'',''],
	['PAGE','1602',jdecode('Racing+Photo%26%23x27%3Bs'),jdecode(''), jdecode('%2F1602.html'), 'true',[],'',''],
	['PAGE','1950',jdecode('Used+Machines'),jdecode(''), jdecode('%2F1950.html'), 'true',[],'',''],
	['PAGE','2404',jdecode('Hours+of+operation'),jdecode(''), jdecode('%2F2404.html'), 'true',[],'',''],
	['PAGE','2413',jdecode('LINKS'),jdecode(''), jdecode('%2F2413.html'), 'true',[],'',''],
	['PAGE','2675',jdecode('RG500+Gamma'),jdecode(''), jdecode('%2F2675.html'), 'true',[],'','']];
var siteelementCount=22;
theSitetree.topTemplateName='Pain';
theSitetree.paletteFamily='4C4C4C';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10721';
theSitetree.graphicsetId='10551';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='4C4C4C';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'optimum',
  product: 'WSCSYSSSSLYTC245'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Pain',
				paletteFamily: 	'4C4C4C',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10721',
				graphicsetId: 	'10551',
				contentColor: 	'FFFFFF',
				contentBGColor: '4C4C4C',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '32',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-1814889']={
webappId:    '1501',
documentId:  '32',
internalId:  '1814889',
customField: '1501'
};
webappMappings['7060']=webappMappings['7060-d476a86e77adaee28bab7f6cfa5a4973']={
webappId:    '7060',
documentId:  '1602',
internalId:  'd476a86e77adaee28bab7f6cfa5a4973',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-a75ab8120c646b66796859964c1109a6']={
webappId:    '7060',
documentId:  '2100',
internalId:  'a75ab8120c646b66796859964c1109a6',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32',
internalId:  '',
customField: '20071205-221637'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1602',
internalId:  '',
customField: '20061108-201151'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '53',
internalId:  '',
customField: '20120107-113910'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2675',
internalId:  '',
customField: '20120107-112814'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1540',
internalId:  '',
customField: '20120107-112222'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2100',
internalId:  '',
customField: '20070413-211047'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1950',
internalId:  '',
customField: '20120107-112609'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '125',
internalId:  '',
customField: '20120107-112310'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '134',
internalId:  '',
customField: '20061107-173123'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '143',
internalId:  '',
customField: '20120107-112436'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '62',
internalId:  '',
customField: '20061107-212834'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '71',
internalId:  '',
customField: '20120107-112016'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '89',
internalId:  '',
customField: '20061107-212951'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '98',
internalId:  '',
customField: '20080405-144333'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '107',
internalId:  '',
customField: '20120107-112159'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '116',
internalId:  '',
customField: '20061107-213158'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '170',
internalId:  '',
customField: '20061107-174258'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '152',
internalId:  '',
customField: '20061108-165729'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '161',
internalId:  '',
customField: '20061107-213609'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2112',
internalId:  '',
customField: '20120107-112523'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2404',
internalId:  '',
customField: '20120107-112630'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2413',
internalId:  '',
customField: '20120107-112751'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050IN3I0V';
var companyName   = 'Back+Yard+Cycle%2C+Inc.';
var htmlTitle	  = 'Backyardcycle.com';
var metaKeywords  = '';
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();
};

