/* [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','22',jdecode('Home'),jdecode(''),'/22.html','true',[],''],
	['PAGE','2105',jdecode('2009+Autocross+Results'),jdecode(''),'/2105/index.html','true',[ 
		['PAGE','17330',jdecode('Season+Finale+Autocross'),jdecode(''),'/2105/17330.html','false',[],''],
		['PAGE','17930',jdecode('2009+Autocross+Results'),jdecode(''),'/2105/17930.html','false',[],''],
		['PAGE','16630',jdecode('October+12%2C+2008+Runoff'),jdecode(''),'/2105/16630.html','false',[],''],
		['PAGE','15630',jdecode('Zone+1+Autocross'),jdecode(''),'/2105/15630.html','false',[],''],
		['PAGE','14730',jdecode('September+13%2C+2008'),jdecode(''),'/2105/14730.html','false',[],''],
		['PAGE','13830',jdecode('August+10%2C+2008'),jdecode(''),'/2105/13830.html','false',[],''],
		['PAGE','12830',jdecode('July+19%2C+2008'),jdecode(''),'/2105/12830.html','false',[],''],
		['PAGE','6206',jdecode('June+8%2C+2008'),jdecode(''),'/2105/6206.html','false',[],''],
		['PAGE','6032',jdecode('May+17%2C+2008'),jdecode(''),'/2105/6032.html','false',[],''],
		['PAGE','2114',jdecode('April+27%2C+2008'),jdecode(''),'/2105/2114.html','false',[],''],
		['PAGE','2523',jdecode('April+13%2C+2008'),jdecode(''),'/2105/2523.html','false',[],''],
		['PAGE','2532',jdecode('March+30%2C+2008'),jdecode(''),'/2105/2532.html','false',[],''],
		['PAGE','19330',jdecode('June+28%2C+2009'),jdecode(''),'/2105/19330.html','true',[],''],
		['PAGE','18130',jdecode('May+24%2C+2009'),jdecode(''),'/2105/18130.html','true',[],''],
		['PAGE','18151',jdecode('April+26%2C+2009'),jdecode(''),'/2105/18151.html','true',[],'']
	],''],
	['PAGE','3961',jdecode('Season+Standings'),jdecode(''),'/3961.html','true',[],''],
	['PAGE','2177',jdecode('Contact'),jdecode(''),'/2177.html','true',[],'']];
var siteelementCount=19;
theSitetree.topTemplateName='Circulation';
theSitetree.paletteFamily='FC2323';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10587';
theSitetree.graphicsetId='10561';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='000000';
var theTemplate={
				name: 			'Circulation',
				paletteFamily: 	'FC2323',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10587',
				graphicsetId: 	'10561',
				contentColor: 	'FFFFFF',
				contentBGColor: '000000',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'FFFFFF',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '22',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22',
internalId:  '',
customField: '20090602-212815'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2105',
internalId:  '',
customField: '20080914-213950'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17330',
internalId:  '',
customField: '20081110-224036'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16630',
internalId:  '',
customField: '20081016-221404'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15630',
internalId:  '',
customField: '20081001-073010'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14730',
internalId:  '',
customField: '20080914-214144'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13830',
internalId:  '',
customField: '20080812-221427'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12830',
internalId:  '',
customField: '20080812-220805'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6206',
internalId:  '',
customField: '20080719-202904'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6032',
internalId:  '',
customField: '20080519-031102'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2114',
internalId:  '',
customField: '20080519-025843'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2523',
internalId:  '',
customField: '20080430-025606'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2532',
internalId:  '',
customField: '20080430-023716'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3961',
internalId:  '',
customField: '20081001-070731'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2177',
internalId:  '',
customField: '20080430-105438'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18151',
internalId:  '',
customField: '20090602-212454'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18130',
internalId:  '',
customField: '20090706-152636'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17930',
internalId:  '',
customField: '20090602-210227'
};
webappMappings['1501']=webappMappings['1501-4735196']={
webappId:    '1501',
documentId:  '22',
internalId:  '4735196',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19330',
internalId:  '',
customField: '20090706-152506'
};
var canonHostname = 'wsc-worker03.chi.us.siteprotect.com';
var accountId     = 'AHW050IN3985';
var companyName   = 'Metro+NY+Autocross';
var htmlTitle	  = '';
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();
};
