/* [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','32',jdecode('Home'),jdecode(''),'/32.html','true',[],''],
	['PAGE','53',jdecode('About+us'),jdecode(''),'/53/index.html','true',[ 
		['PAGE','62',jdecode('BYC+MX+Race+Team'),jdecode(''),'/53/62.html','true',[],'']
	],''],
	['PAGE','71',jdecode('Products'),jdecode(''),'/71/index.html','true',[ 
		['PAGE','89',jdecode('New+MX+Bike+Sales'),jdecode(''),'/71/89.html','true',[],''],
		['PAGE','98',jdecode('Parts+%26+Accessories'),jdecode(''),'/71/98.html','true',[],'']
	],''],
	['PAGE','107',jdecode('Our+service'),jdecode(''),'/107/index.html','true',[ 
		['PAGE','116',jdecode('Repairs'),jdecode(''),'/107/116.html','true',[],'']
	],''],
	['PAGE','1540',jdecode('Race+Results'),jdecode(''),'/1540/index.html','true',[ 
		['PAGE','170',jdecode('Motorcycle+news'),jdecode(''),'/1540/170.html','true',[],'']
	],''],
	['PAGE','134',jdecode('Further+links'),jdecode(''),'/134.html','true',[],''],
	['PAGE','125',jdecode('Events'),jdecode(''),'/125.html','true',[],''],
	['PAGE','143',jdecode('Contact'),jdecode(''),'/143/index.html','true',[ 
		['PAGE','152',jdecode('Addresses'),jdecode(''),'/143/152.html','true',[],''],
		['PAGE','161',jdecode('How+to+find+us'),jdecode(''),'/143/161.html','true',[],''],
		['PAGE','2112',jdecode('Hours+of+operation'),jdecode(''),'/143/2112.html','true',[],'']
	],''],
	['PAGE','2100',jdecode('BYC+Mini+Monster'),jdecode(''),'/2100.html','true',[],''],
	['PAGE','1602',jdecode('Racing+Photo%26%23x27%3Bs'),jdecode(''),'/1602.html','true',[],''],
	['PAGE','1950',jdecode('Used+Machines'),jdecode(''),'/1950.html','true',[],''],
	['PAGE','2404',jdecode('Hours+of+operation'),jdecode(''),'/2404.html','true',[],''],
	['PAGE','2413',jdecode('LINKS'),jdecode(''),'/2413.html','true',[],''],
	['PAGE','2675',jdecode('RG500+Gamma'),jdecode(''),'/2675.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 theTemplate={
				name: 			'Pain',
				paletteFamily: 	'4C4C4C',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10721',
				graphicsetId: 	'10551',
				contentColor: 	'FFFFFF',
				contentBGColor: '4C4C4C',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				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: '20070919-192535'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2675',
internalId:  '',
customField: '20071018-184204'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1540',
internalId:  '',
customField: '20071205-222313'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2100',
internalId:  '',
customField: '20070413-211047'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1950',
internalId:  '',
customField: '20080403-190801'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '125',
internalId:  '',
customField: '20070116-214237'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '134',
internalId:  '',
customField: '20061107-173123'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '143',
internalId:  '',
customField: '20070827-205954'
};
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();
};
