/* [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','4601',jdecode('Home'),jdecode(''), jdecode('%2F4601.html'), 'true',[],'',''],
	['PAGE','4652',jdecode('Officers'),jdecode(''), jdecode('%2F4652.html'), 'true',[],'',''],
	['PAGE','4694',jdecode('Calendar+of+Events'),jdecode(''), jdecode('%2F4694.html'), 'true',[],'',''],
	['PAGE','5301',jdecode('Legion+Programs'),jdecode(''), jdecode('%2F5301%2Findex.html'), 'true',[ 
		['PAGE','5322',jdecode('Boys+State'),jdecode(''), jdecode('%2F5301%2F5322.html'), 'true',[],'',''],
		['PAGE','5343',jdecode('Oratorical'),jdecode(''), jdecode('%2F5301%2F5343.html'), 'true',[],'',''],
		['PAGE','5364',jdecode('Children+and+Youth'),jdecode(''), jdecode('%2F5301%2F5364.html'), 'true',[],'',''],
		['PAGE','5385',jdecode('Scouting'),jdecode(''), jdecode('%2F5301%2F5385.html'), 'true',[],'',''],
		['PAGE','5406',jdecode('Junior+Shooting+Sports'),jdecode(''), jdecode('%2F5301%2F5406.html'), 'true',[],'','']
	],'',''],
	['PAGE','7822',jdecode('The+Preamble+Explained'),jdecode(''), jdecode('%2F7822.html'), 'true',[],'',''],
	['PAGE','7801',jdecode('Service+Branch+Info'),jdecode(''), jdecode('%2F7801.html'), 'true',[],'',''],
	['PAGE','4757',jdecode('Auxillary'),jdecode(''), jdecode('%2F4757%2Findex.html'), 'true',[ 
		['PAGE','11901',jdecode('Auxiliary+Officers'),jdecode(''), jdecode('%2F4757%2F11901.html'), 'true',[],'',''],
		['PAGE','11922',jdecode('Auxiliary+Programs'),jdecode(''), jdecode('%2F4757%2F11922.html'), 'true',[],'',''],
		['PAGE','11943',jdecode('Calendar'),jdecode(''), jdecode('%2F4757%2F11943.html'), 'true',[],'','']
	],'',''],
	['PAGE','4673',jdecode('Special+Projects'),jdecode(''), jdecode('%2F4673.html'), 'true',[],'',''],
	['PAGE','4715',jdecode('Newsletter'),jdecode(''), jdecode('%2F4715.html'), 'true',[],'',''],
	['PAGE','4736',jdecode('Become+a+Member'),jdecode(''), jdecode('%2F4736.html'), 'true',[],'',''],
	['PAGE','4778',jdecode('History%2FPhotos'),jdecode(''), jdecode('%2F4778.html'), 'true',[],'',''],
	['PAGE','4799',jdecode('Links'),jdecode(''), jdecode('%2F4799.html'), 'true',[],'',''],
	['PAGE','4820',jdecode('Contact+Us'),jdecode(''), jdecode('%2F4820.html'), 'true',[],'','']];
var siteelementCount=21;
theSitetree.topTemplateName='Diamond';
theSitetree.paletteFamily='BFD4ED';
theSitetree.keyvisualId='6250';
theSitetree.keyvisualName='kv_6250.jpg';
theSitetree.fontsetId='11090';
theSitetree.graphicsetId='11865';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='BFD4ED';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'endurance',
  product: 'WSCSYSSSSLY0XRN4'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Diamond',
				paletteFamily: 	'BFD4ED',
				keyvisualId: 	'6250',
				keyvisualName: 	'kv_6250.jpg',
				fontsetId: 		'11090',
				graphicsetId: 	'11865',
				contentColor: 	'000000',
				contentBGColor: 'BFD4ED',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4601',
internalId:  '',
customField: '20110806-182436'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4652',
internalId:  '',
customField: '20110720-181959'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4673',
internalId:  '',
customField: '20101120-011453'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5301',
internalId:  '',
customField: '20110726-165000'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5322',
internalId:  '',
customField: '20110726-171639'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5364',
internalId:  '',
customField: '20110726-165341'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7801',
internalId:  '',
customField: '20101109-195801'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7822',
internalId:  '',
customField: '20101109-200236'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5343',
internalId:  '',
customField: '20110715-182534'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5385',
internalId:  '',
customField: '20110726-172646'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4694',
internalId:  '',
customField: '20110915-193043'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4736',
internalId:  '',
customField: '20110726-173616'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4757',
internalId:  '',
customField: '20101120-154612'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11901',
internalId:  '',
customField: '20110715-184708'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4778',
internalId:  '',
customField: '20101108-234618'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4799',
internalId:  '',
customField: '20110809-162321'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4820',
internalId:  '',
customField: '20110809-165157'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4601',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5406',
internalId:  '',
customField: '20101109-000011'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11922',
internalId:  '',
customField: '20101120-154323'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11943',
internalId:  '',
customField: '20101120-154323'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4715',
internalId:  '',
customField: '20110806-174752'
};
var webAppHostname = 'cgiwsc.enhancedsitebuilder.com:80';
var canonHostname = 'cmworker03.yourhostingaccount.com';
var accountId     = 'AENDU0INLZYA';
var companyName   = 'American+Legion+Post+604';
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();
};

