/* [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','501',jdecode('Home'),jdecode(''),'/501.html','true',[],'',''],
	['PAGE','552',jdecode('Programs'),jdecode(''),'/552/index.html','true',[ 
		['PAGE','29801',jdecode('TLC'),jdecode(''),'/552/29801.html','false',[],'',''],
		['PAGE','29822',jdecode('Thrift+Shop'),jdecode(''),'/552/29822.html','false',[],'','']
	],'',''],
	['PAGE','615',jdecode('News'),jdecode(''),'/615.html','true',[],'',''],
	['PAGE','636',jdecode('Events'),jdecode(''),'/636/index.html','true',[ 
		['PAGE','37301',jdecode('AnnivReg'),jdecode(''),'/636/37301.html','false',[],'',''],
		['PAGE','22522',jdecode('Archer+Art+Auction'),jdecode(''),'/636/22522.html','false',[],'',''],
		['PAGE','35901',jdecode('Auction+Reg'),jdecode(''),'/636/35901.html','false',[],'',''],
		['PAGE','22501',jdecode('CUMAC+Auction'),jdecode(''),'/636/22501.html','false',[],'',''],
		['PAGE','25501',jdecode('Feinstein'),jdecode(''),'/636/25501.html','false',[],'',''],
		['PAGE','30501',jdecode('Food+Drive'),jdecode(''),'/636/30501.html','false',[],'',''],
		['PAGE','14001',jdecode('Golf+Registration'),jdecode(''),'/636/14001.html','false',[],'',''],
		['PAGE','28801',jdecode('Golf+Update'),jdecode(''),'/636/28801.html','false',[],'',''],
		['PAGE','24501',jdecode('MLK+Celebration'),jdecode(''),'/636/24501.html','false',[],'','']
	],'',''],
	['PAGE','657',jdecode('Ways+to+Help'),jdecode(''),'/657.html','true',[],'',''],
	['PAGE','573',jdecode('Food+List'),jdecode(''),'/573.html','true',[],'',''],
	['PAGE','2701',jdecode('Stats+and+Links'),jdecode(''),'/2701.html','true',[],'',''],
	['PAGE','678',jdecode('Contact+Us'),jdecode(''),'/678.html','true',[],'',''],
	['PAGE','699',jdecode('Donate+Now'),jdecode(''),'/699.html','true',[],'','']];
var siteelementCount=20;
theSitetree.topTemplateName='Common';
theSitetree.paletteFamily='D40202';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='26633';
theSitetree.graphicsetId='13449';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Common',
				paletteFamily: 	'D40202',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'26633',
				graphicsetId: 	'13449',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				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['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '501',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-1116']={
webappId:    '7008',
documentId:  '699',
internalId:  '1116',
customField: 'language:en;country:US;'
};
webappMappings['7008']=webappMappings['7008-1117']={
webappId:    '7008',
documentId:  '14001',
internalId:  '1117',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '501',
internalId:  '',
customField: '20100817-142841'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '552',
internalId:  '',
customField: '20100706-113356'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '636',
internalId:  '',
customField: '20100729-124758'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '615',
internalId:  '',
customField: '20100817-141416'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14001',
internalId:  '',
customField: '20100322-161922'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '657',
internalId:  '',
customField: '20100729-125000'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '573',
internalId:  '',
customField: '20080408-100557'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2701',
internalId:  '',
customField: '20100114-151952'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '678',
internalId:  '',
customField: '20100817-111501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '699',
internalId:  '',
customField: '20100817-142857'
};
webappMappings['1501']=webappMappings['1501-7363328']={
webappId:    '1501',
documentId:  '501',
internalId:  '7363328',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22501',
internalId:  '',
customField: '20090210-153044'
};
webappMappings['7008']=webappMappings['7008-12242']={
webappId:    '7008',
documentId:  '22501',
internalId:  '12242',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22522',
internalId:  '',
customField: '20090108-150209'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24501',
internalId:  '',
customField: '20090109-114248'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25501',
internalId:  '',
customField: '20090210-161828'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28801',
internalId:  '',
customField: '20090529-154553'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29801',
internalId:  '',
customField: '20100706-113722'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29822',
internalId:  '',
customField: '20090624-153855'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30501',
internalId:  '',
customField: '20090722-130032'
};
webappMappings['7008']=webappMappings['7008-24899']={
webappId:    '7008',
documentId:  '35901',
internalId:  '24899',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35901',
internalId:  '',
customField: '20100114-153724'
};
webappMappings['7008']=webappMappings['7008-26691']={
webappId:    '7008',
documentId:  '37301',
internalId:  '26691',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37301',
internalId:  '',
customField: '20100322-161845'
};
var canonHostname = 'cmworker01.yourhostingaccount.com';
var accountId     = 'AENDU0INXXWD';
var companyName   = 'www.cumacecho.org';
var htmlTitle	  = 'CUMAC+-+Feeding+People+and+Changing+Lives';
var metaKeywords  = 'food+pantry%2C+food+depot%2C+hunger%2C+Paterson%2C+Passaic+County%2C+New+Jersey%2C+NJ%2C+food+donations%2C+clothing+donations%2C+furniture+donations%2C+volunteer';
var metaContents  = 'CUMAC+is+an+outreach+ministry+of+the+United+Methodist+Church+located+in+downtown+Paterson.++We+run+a+food+pantry%2C+food+depot%2C+thrift+shop%2C+job+training%2C+after-school+program+and+advocacy+efforts.++We+are+always+open+to+donations+of+food%2C+money%2C+clothing%2C+furniture+or+household+items+and+in+need+of+volunteers.';
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();
};
