/* [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','6801',jdecode('Home'),jdecode(''),'/6801.html','true',[],''],
	['PAGE','54901',jdecode('Events'),jdecode(''),'/54901.html','true',[],''],
	['PAGE','51101',jdecode('Walk+to+Washington+DC'),jdecode(''),'/51101.html','false',[],''],
	['PAGE','51122',jdecode('STL+Walk+for+Depression+Awareness'),jdecode(''),'/51122.html','false',[],''],
	['PAGE','35090',jdecode('Contact+Us'),jdecode(''),'/35090/index.html','true',[ 
		['PAGE','35111',jdecode('Directions'),jdecode(''),'/35090/35111.html','true',[],'']
	],''],
	['PAGE','53822',jdecode('Courses%2FContinuing+Education'),jdecode(''),'/53822/index.html','true',[ 
		['PAGE','46801',jdecode('QPR+Slides'),jdecode(''),'/53822/46801.html','true',[],'']
	],''],
	['PAGE','53701',jdecode('DBSA+Self+Help+Center'),jdecode(''),'/53701.html','true',[],''],
	['PAGE','35132',jdecode('Donate+Now'),jdecode(''),'/35132.html','true',[],''],
	['PAGE','35027',jdecode('Our+Programs'),jdecode(''),'/35027/index.html','true',[ 
		['PAGE','34943',jdecode('Groups%2C+Classes%2C+and+More'),jdecode(''),'/35027/34943.html','true',[],''],
		['PAGE','34985',jdecode('Angel%26%23x27%3Bs+Place'),jdecode(''),'/35027/34985.html','true',[],''],
		['PAGE','35006',jdecode('Peer+Specialist+Services'),jdecode(''),'/35027/35006.html','true',[],'']
	],''],
	['PAGE','54301',jdecode('Peer+Specialist+Services'),jdecode(''),'/54301.html','true',[],''],
	['PAGE','53801',jdecode('Publications'),jdecode(''),'/53801.html','true',[],''],
	['PAGE','35048',jdecode('Resources'),jdecode(''),'/35048/index.html','true',[ 
		['PAGE','26001',jdecode('SHC+Documents'),jdecode(''),'/35048/26001.html','true',[],'']
	],'']];
var siteelementCount=18;
theSitetree.topTemplateName='Valiant';
theSitetree.paletteFamily='A841B7';
theSitetree.keyvisualId='9814';
theSitetree.keyvisualName='kv_9814.jpg';
theSitetree.fontsetId='17630';
theSitetree.graphicsetId='13035';
theSitetree.contentColor='646464';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Valiant',
				paletteFamily: 	'A841B7',
				keyvisualId: 	'9814',
				keyvisualName: 	'kv_9814.jpg',
				fontsetId: 		'17630',
				graphicsetId: 	'13035',
				contentColor: 	'646464',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '54901',
internalId:  '',
customField: '20100518-145824'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46801',
internalId:  '',
customField: '20091028-211400'
};
webappMappings['2002']=webappMappings['2002-routing']={
webappId:    '2002',
documentId:  '35111',
internalId:  'routing',
customField: 'en_US'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6801',
internalId:  '',
customField: '20100602-233757'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '53701',
internalId:  '',
customField: '20100504-225027'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35027',
internalId:  '',
customField: '20090922-213604'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35090',
internalId:  '',
customField: '20100410-143825'
};
webappMappings['7008']=webappMappings['7008-21027']={
webappId:    '7008',
documentId:  '35090',
internalId:  '21027',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35111',
internalId:  '',
customField: '20090922-213432'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '6801',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '51122',
internalId:  '',
customField: '20100410-023422'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '53822',
internalId:  '',
customField: '20100503-093820'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '53801',
internalId:  '',
customField: '20100503-093820'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35132',
internalId:  '',
customField: '20090922-201811'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34943',
internalId:  '',
customField: '20100409-202303'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35048',
internalId:  '',
customField: '20090922-201408'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34985',
internalId:  '',
customField: '20090922-214256'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35006',
internalId:  '',
customField: '20090922-214416'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '54301',
internalId:  '',
customField: '20100518-214000'
};
webappMappings['1501']=webappMappings['1501-14182328']={
webappId:    '1501',
documentId:  '6801',
internalId:  '14182328',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26001',
internalId:  '',
customField: '20090928-210047'
};
webappMappings['7050']=webappMappings['7050-7792']={
webappId:    '7050',
documentId:  '54901',
internalId:  '7792',
customField: 'language:en;country:US;'
};
webappMappings['7005']=webappMappings['7005-2414']={
webappId:    '7005',
documentId:  '35027',
internalId:  '2414',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '51101',
internalId:  '',
customField: '20100410-025303'
};
var canonHostname = 'cmworker03.yourhostingaccount.com';
var accountId     = 'AENDU0INE6SX';
var companyName   = 'Self+Help+Center%3A+Restoring+Hope+for+Healing+Minds';
var htmlTitle	  = 'Self+Help+Center';
var metaKeywords  = 'support+groups%2C+mental+health%2C+depression%2C+bi-polar+disorder%2C+schizophrenia%2C+schizoaffective+disorder%2C+anxiety%2C+OCD%2C+paranoia%2C+DBSA%2C+Procovery%2C+food+pantry%2C+eating+disorders%2C+missouri%2C+saint+louis%2C+affton%2C+st.+louis+county%2C+st.+louis%2C+non-profit%2C+donations%2C+missouri+department+of+mental+health%2C+peer+specialist';
var metaContents  = 'Self+Help+Center+is+a+Consumer+Operated+Services+Program+for+adults+diagnosed+with+mental+illness+and+co-occurring+disorders.++Services+include+support+and+educational+groups%2C+social+interactions+and+opportunities%2C+and+a+food+pantry.';
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();
};
