/* [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','2401',jdecode('Home'),jdecode(''),'/2401.html','true',[],'',''],
	['PAGE','40243',jdecode('Contact+Us'),jdecode(''),'/40243.html','true',[],'',''],
	['PAGE','19801',jdecode('Shelter+Schedule'),jdecode(''),'/19801.html','true',[],'',''],
	['PAGE','19522',jdecode('The+Warming+Center'),jdecode(''),'/19522.html','true',[],'',''],
	['PAGE','17601',jdecode('Volunteer+Information'),jdecode(''),'/17601/index.html','true',[ 
		['PAGE','17622',jdecode('Training'),jdecode(''),'/17601/17622.html','true',[],'','']
	],'',''],
	['PAGE','36743',jdecode('Volunteer+Positions'),jdecode(''),'/36743/index.html','true',[ 
		['PAGE','37043',jdecode('Check+In+Shift'),jdecode(''),'/36743/37043.html','true',[],'',''],
		['PAGE','37064',jdecode('10-2+Shift'),jdecode(''),'/36743/37064.html','true',[],'',''],
		['PAGE','37085',jdecode('2-6+Shift'),jdecode(''),'/36743/37085.html','true',[],'',''],
		['PAGE','37148',jdecode('Shelter+Set-Up'),jdecode(''),'/36743/37148.html','true',[],'',''],
		['PAGE','37169',jdecode('Shelter+Break-Down'),jdecode(''),'/36743/37169.html','true',[],'',''],
		['PAGE','37190',jdecode('Laundry'),jdecode(''),'/36743/37190.html','true',[],'','']
	],'',''],
	['PAGE','8922',jdecode('Church+Coordinators'),jdecode(''),'/8922/index.html','true',[ 
		['PAGE','53857',jdecode('Current+Calendar'),jdecode(''),'/8922/53857.html','true',[],'',''],
		['PAGE','44757',jdecode('Admin'),jdecode(''),'/8922/44757.html','true',[],'','']
	],'',''],
	['PAGE','44778',jdecode('Donations'),jdecode(''),'/44778.html','true',[],'','']];
var siteelementCount=17;
theSitetree.topTemplateName='Applicant';
theSitetree.paletteFamily='72AD5C';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='26575';
theSitetree.graphicsetId='13382';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='bef0ab';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Applicant',
				paletteFamily: 	'72AD5C',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'26575',
				graphicsetId: 	'13382',
				contentColor: 	'000000',
				contentBGColor: 'bef0ab',
				a_color: 		'72AD5C',
				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:  '2401',
internalId:  '',
customField: '20100526-072230'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19522',
internalId:  '',
customField: '20100526-072302'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8922',
internalId:  '',
customField: '20100511-062234'
};
webappMappings['7060']=webappMappings['7060-fd311ce99c6a478f7eb14f80d2ae4d1c']={
webappId:    '7060',
documentId:  '17601',
internalId:  'fd311ce99c6a478f7eb14f80d2ae4d1c',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19801',
internalId:  '',
customField: '20100228-050641'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17622',
internalId:  '',
customField: '20100309-133134'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17601',
internalId:  '',
customField: '20100305-171503'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40243',
internalId:  '',
customField: '20100605-021700'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36743',
internalId:  '',
customField: '20100305-161514'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37043',
internalId:  '',
customField: '20100227-154850'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37064',
internalId:  '',
customField: '20100304-154959'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37085',
internalId:  '',
customField: '20100304-155104'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '53857',
internalId:  '',
customField: '20100713-063235'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37148',
internalId:  '',
customField: '20100228-040618'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37169',
internalId:  '',
customField: '20100227-165442'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37190',
internalId:  '',
customField: '20100227-165756'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '44757',
internalId:  '',
customField: '20100305-162000'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '44778',
internalId:  '',
customField: '20100307-133153'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '44757',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:true;'
};
var canonHostname = 'localhost';
var accountId     = 'ANFI20IN2KPO';
var companyName   = 'Room+at+the+Inn+Homeless+Shelter';
var htmlTitle	  = 'Room+at+the+Inn+Homepage';
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();
};
