/* [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','9201',jdecode('Home'),jdecode(''), jdecode('%2F9201.html'), 'true',[],'',''],
	['PAGE','9273',jdecode('About+DIHN'),jdecode(''), jdecode('%2F9273%2Findex.html'), 'true',[ 
		['PAGE','11301',jdecode('History'),jdecode(''), jdecode('%2F9273%2F11301.html'), 'true',[],'',''],
		['PAGE','11343',jdecode('Staff'),jdecode(''), jdecode('%2F9273%2F11343.html'), 'true',[],'',''],
		['PAGE','11322',jdecode('Board+Members'),jdecode(''), jdecode('%2F9273%2F11322.html'), 'true',[],'','']
	],'',''],
	['PAGE','10501',jdecode('DIHN+News'),jdecode(''), jdecode('%2F10501%2Findex.html'), 'true',[ 
		['PAGE','11364',jdecode('Family+News'),jdecode(''), jdecode('%2F10501%2F11364.html'), 'true',[],'',''],
		['PAGE','11385',jdecode('Other+Happenings'),jdecode(''), jdecode('%2F10501%2F11385.html'), 'true',[],'',''],
		['PAGE','11406',jdecode('Newsletters%2FAnnual+Report'),jdecode(''), jdecode('%2F10501%2F11406.html'), 'true',[],'','']
	],'',''],
	['PAGE','25701',jdecode('2011+Gala'),jdecode(''), jdecode('%2F25701.html'), 'true',[],'',''],
	['PAGE','9294',jdecode('Congregations'),jdecode(''), jdecode('%2F9294%2Findex.html'), 'true',[ 
		['PAGE','11427',jdecode('Responsibilities'),jdecode(''), jdecode('%2F9294%2F11427.html'), 'true',[],'',''],
		['PAGE','11448',jdecode('Host+and+Support+Congregations'),jdecode(''), jdecode('%2F9294%2F11448.html'), 'true',[],'','']
	],'',''],
	['PAGE','9315',jdecode('How+You+Can+Help'),jdecode(''), jdecode('%2F9315%2Findex.html'), 'true',[ 
		['PAGE','11469',jdecode('Volunteer'),jdecode(''), jdecode('%2F9315%2F11469.html'), 'true',[],'',''],
		['PAGE','11490',jdecode('Donate'),jdecode(''), jdecode('%2F9315%2F11490.html'), 'true',[],'',''],
		['PAGE','27501',jdecode('Adopt+a+Family%21'),jdecode(''), jdecode('%2F9315%2F27501.html'), 'true',[],'',''],
		['PAGE','11532',jdecode('Host+a+Fund+Raiser'),jdecode(''), jdecode('%2F9315%2F11532.html'), 'true',[],'',''],
		['PAGE','28701',jdecode('Circles+of+Support'),jdecode(''), jdecode('%2F9315%2F28701.html'), 'true',[],'',''],
		['PAGE','11511',jdecode('Wish+List'),jdecode(''), jdecode('%2F9315%2F11511.html'), 'true',[],'','']
	],'',''],
	['PAGE','29801',jdecode('Blog'),jdecode(''), jdecode('%2F29801.html'), 'false',[],'',''],
	['PAGE','40812',jdecode('Faith+Institute'),jdecode(''), jdecode('%2F40812.html'), 'false',[],'',''],
	['PAGE','38412',jdecode('Buy+tickets+for+gala%21'),jdecode(''), jdecode('%2F38412.html'), 'false',[],'',''],
	['PAGE','9336',jdecode('Contact+Us'),jdecode(''), jdecode('%2F9336.html'), 'true',[],'','']];
var siteelementCount=24;
theSitetree.topTemplateName='Easylife';
theSitetree.paletteFamily='AD1D1D';
theSitetree.keyvisualId='5841';
theSitetree.keyvisualName='kv_5841.jpg';
theSitetree.fontsetId='11095';
theSitetree.graphicsetId='11868';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'hps_testtown',
  product: 'WSCSYSSSSLYTC245'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Easylife',
				paletteFamily: 	'AD1D1D',
				keyvisualId: 	'5841',
				keyvisualName: 	'kv_5841.jpg',
				fontsetId: 		'11095',
				graphicsetId: 	'11868',
				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:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9201',
internalId:  '',
customField: '20111027-172013'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9273',
internalId:  '',
customField: '20110928-103548'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10501',
internalId:  '',
customField: '20110705-110425'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9294',
internalId:  '',
customField: '20110110-112209'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9315',
internalId:  '',
customField: '20110705-143600'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9336',
internalId:  '',
customField: '20110117-115204'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11301',
internalId:  '',
customField: '20100801-090154'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11322',
internalId:  '',
customField: '20110908-112700'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11343',
internalId:  '',
customField: '20110928-174912'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11364',
internalId:  '',
customField: '20111028-085738'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11385',
internalId:  '',
customField: '20110705-150910'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11427',
internalId:  '',
customField: '20110117-113719'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11448',
internalId:  '',
customField: '20110401-101034'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11469',
internalId:  '',
customField: '20110401-100526'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11490',
internalId:  '',
customField: '20110328-172303'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11511',
internalId:  '',
customField: '20100801-093135'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11532',
internalId:  '',
customField: '20110117-114436'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11406',
internalId:  '',
customField: '20110705-110746'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25701',
internalId:  '',
customField: '20111031-135115'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27501',
internalId:  '',
customField: '20110110-125012'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28701',
internalId:  '',
customField: '20110117-114114'
};
webappMappings['7050']=webappMappings['7050-3355']={
webappId:    '7050',
documentId:  '29801',
internalId:  '3355',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29801',
internalId:  '',
customField: '20110128-104151'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38412',
internalId:  '',
customField: '20110828-144432'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40812',
internalId:  '',
customField: '20110828-150613'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050INZ66X';
var companyName   = 'Durham+Interfaith+Hospitality+Network';
var htmlTitle	  = 'Durham+IHN';
var metaKeywords  = 'Homeless%2C+homelessness%2C+IHN%2C+DIHN%2C+Interfaith+Hospitality+Network';
var metaContents  = 'Durham+Interfaith+Hospitality+Network';
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();
};

