/* [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','5001',jdecode('Home'),jdecode(''),'/5001.html','true',[],''],
	['PAGE','5143',jdecode('The+Foundation'),jdecode(''),'/5143.html','true',[],''],
	['PAGE','5101',jdecode('The+Run'),jdecode(''),'/5101.html','true',[],''],
	['PAGE','19201',jdecode('News%2FBlog'),jdecode(''),'/19201.html','true',[],''],
	['PAGE','6601',jdecode('Registration'),jdecode(''),'/6601.html','true',[],''],
	['PAGE','5401',jdecode('Course+Information'),jdecode(''),'/5401.html','true',[],''],
	['PAGE','5185',jdecode('Post-Run'),jdecode(''),'/5185.html','true',[],''],
	['PAGE','5122',jdecode('Sponsors'),jdecode(''),'/5122.html','true',[],''],
	['PAGE','5206',jdecode('Contact+Us'),jdecode(''),'/5206.html','true',[],'']];
var siteelementCount=9;
theSitetree.topTemplateName='Intense';
theSitetree.paletteFamily='B7622A';
theSitetree.keyvisualId='3496';
theSitetree.keyvisualName='kv_3496.jpg';
theSitetree.fontsetId='10439';
theSitetree.graphicsetId='10799';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='D58856';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Intense',
				paletteFamily: 	'B7622A',
				keyvisualId: 	'3496',
				keyvisualName: 	'kv_3496.jpg',
				fontsetId: 		'10439',
				graphicsetId: 	'10799',
				contentColor: 	'000000',
				contentBGColor: 'D58856',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'AD401A',
				e_color: 		'727171',
				f_color: 		'3F3F3F',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '5206',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:true;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5001',
internalId:  '',
customField: '20100114-142444'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5101',
internalId:  '',
customField: '20100105-224927'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6601',
internalId:  '',
customField: '20100105-225542'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5401',
internalId:  '',
customField: '20100105-225822'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5185',
internalId:  '',
customField: '20100105-225932'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5122',
internalId:  '',
customField: '20090923-145742'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5143',
internalId:  '',
customField: '20100105-224231'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5206',
internalId:  '',
customField: '20090923-151001'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19201',
internalId:  '',
customField: '20091025-234535'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5001',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-17736827']={
webappId:    '1501',
documentId:  '5001',
internalId:  '17736827',
customField: '1501'
};
webappMappings['7050']=webappMappings['7050-10393']={
webappId:    '7050',
documentId:  '19201',
internalId:  '10393',
customField: 'language:en;country:US;'
};
var canonHostname = 'cmworker03.yourhostingaccount.com';
var accountId     = 'AENDU0INE5SS';
var companyName   = 'SUNDAY%2C+OCTOBER+24%2C+2010';
var htmlTitle	  = 'The+Fall+Classic+Run';
var metaKeywords  = 'razor%2C+razor+sharp%2C+razor+sharp+minds%2C+foundation%2C+razor+sharp+minds+foundation%2C+sharp+minds%2C+fall+classic%2C+the+fall+classic+run%2C+running%2C+run%2C+race%2C+road+race%2C+wisconsin%2C+menomonee+falls%2C+milwaukee%2C+competition%2C+competitor%2C+prize%2C+charity%2C+volunteer%2C+alzheimers%2C+alzheimers+disease%2C+dementia%2C+alzheimers+disease%2C+alzheimers%2C+charity%2C+donations%2C+milwaukee%2C+grass+roots%2C+grassroots%2C+alzheimers+news%2C+dementia+news';
var metaContents  = 'The+Fall+Classic+Run%2C+offering+5km+and+10km+races%2C+is+supported+by+the+Razor+Sharp+Minds+Foundation%2C+and+is+held+in+loving+memory+of+those+who+are+suffering+or+who+have+suffered+from+Alzheimer%E2%80%99s+disease+or+dementia.++The+Foundation+proudly+supports+Alzheimer%E2%80%99s+disease+and+dementia+research%2C+clinical+practice+efforts+related+to+treating+dementia%2C+development+of+improved+therapies+for+those+living+with+dementia%2C+and+informs+the+public+about+Alzheimer%E2%80%99s+disease+and+dementia%2C+advances+in+research%2C+and+the+benefits+a+healthy+lifestyle+has+on+the+mind.+++The+5+kilometer+and+10+kilometer+runs+are+loop+courses+with+numerous+vantage+points+for+your+family+and+friends+to+watch+the+races+and+to+cheer+you+on+to+a+fast+time.++';
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();
};
