/* [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','42',jdecode('Rally+Home'),jdecode(''),'/42.html','false',[],'',''],
	['PAGE','21901',jdecode('Zzzzz....'),jdecode(''),'/21901.html','false',[],'',''],
	['PAGE','22901',jdecode('Rrrrr%21'),jdecode(''),'/22901.html','false',[],'',''],
	['PAGE','29401',jdecode('Home'),jdecode(''),'/29401.html','true',[],'',''],
	['PAGE','852',jdecode('Sierra+Rally+Videos'),jdecode(''),'/852.html','true',[],'',''],
	['PAGE','63',jdecode('Registered+Riders+%7E'),jdecode(''),'/63.html','false',[],'',''],
	['PAGE','510',jdecode('Registration+Info'),jdecode(''),'/510.html','false',[],'',''],
	['PAGE','1337',jdecode('General+Information'),jdecode(''),'/1337.html','true',[],'',''],
	['PAGE','1928',jdecode('Schedule+of+Events'),jdecode(''),'/1928.html','false',[],'',''],
	['PAGE','1859',jdecode('T-shirts'),jdecode(''),'/1859.html','false',[],'',''],
	['PAGE','72',jdecode('Riding+at+the+Rally'),jdecode(''),'/72.html','true',[],'',''],
	['PAGE','1218',jdecode('Pace+Guidelines'),jdecode(''),'/1218.html','true',[],'',''],
	['PAGE','1227',jdecode('Ride+Etiquette'),jdecode(''),'/1227.html','true',[],'',''],
	['PAGE','5801',jdecode('Route+%231'),jdecode(''),'/5801.html','true',[],'',''],
	['PAGE','11501',jdecode('Route+%232'),jdecode(''),'/11501.html','true',[],'',''],
	['PAGE','11522',jdecode('Route+%233'),jdecode(''),'/11522.html','true',[],'',''],
	['PAGE','11543',jdecode('Route+%234'),jdecode(''),'/11543.html','true',[],'',''],
	['PAGE','11564',jdecode('Area+Overview+Map'),jdecode(''),'/11564.html','true',[],'',''],
	['PAGE','519',jdecode('A+Little+About+the+Rally'),jdecode(''),'/519.html','true',[],'',''],
	['PAGE','528',jdecode('Contact+Us'),jdecode(''),'/528.html','true',[],'','']];
var siteelementCount=20;
theSitetree.topTemplateName='Alpha';
theSitetree.paletteFamily='D72B2B';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10555';
theSitetree.graphicsetId='10893';
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: 			'Alpha',
				paletteFamily: 	'D72B2B',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10555',
				graphicsetId: 	'10893',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'D72B2B',
				e_color: 		'D72B2B',
				f_color: 		'D72B2B',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '29401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42',
internalId:  '',
customField: '20110530-225534'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '63',
internalId:  '',
customField: '20110526-110911'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1337',
internalId:  '',
customField: '20110508-235720'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1928',
internalId:  '',
customField: '20110525-015552'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '510',
internalId:  '',
customField: '20110508-235451'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1859',
internalId:  '',
customField: '20110512-111904'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '72',
internalId:  '',
customField: '20110508-235811'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '519',
internalId:  '',
customField: '20110509-000351'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '528',
internalId:  '',
customField: '20110509-000417'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '852',
internalId:  '',
customField: '20110510-192240'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1218',
internalId:  '',
customField: '20110508-235922'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1227',
internalId:  '',
customField: '20110508-235956'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5801',
internalId:  '',
customField: '20110509-125142'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11501',
internalId:  '',
customField: '20110509-131240'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11522',
internalId:  '',
customField: '20110509-131205'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11543',
internalId:  '',
customField: '20110509-132832'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11564',
internalId:  '',
customField: '20110509-134904'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21901',
internalId:  '',
customField: '20101024-180839'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22901',
internalId:  '',
customField: '20101023-233925'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29401',
internalId:  '',
customField: '20110530-231940'
};
var canonHostname = 'wsc-worker02.chi.us.siteprotect.com';
var accountId     = 'AHW050INV0H4';
var companyName   = 'Sierra+Rally';
var htmlTitle	  = 'Sierra+Rally';
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();
};

