/* [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','42',jdecode('Home'),jdecode(''), jdecode('%2F42.html'), 'true',[],'',''],
	['PAGE','1226',jdecode('Worship'),jdecode(''), jdecode('%2F1226%2Findex.html'), 'true',[ 
		['PAGE','2227',jdecode('Service+Schedule'),jdecode(''), jdecode('%2F1226%2F2227.html'), 'true',[],'','']
	],'',''],
	['PAGE','3008',jdecode('Ministers+of+the+Liturgy+Schedule'),jdecode(''), jdecode('%2F3008.html'), 'true',[],'',''],
	['PAGE','1244',jdecode('Lay+Leaders'),jdecode(''), jdecode('%2F1244.html'), 'true',[],'',''],
	['PAGE','200012',jdecode('Sermons'),jdecode(''), jdecode('%2F200012%2Findex.html'), 'true',[ 
		['PAGE','157712',jdecode('2011+Sermons'),jdecode(''), jdecode('%2F200012%2F157712.html'), 'true',[],'',''],
		['PAGE','108201',jdecode('2010+Sermons'),jdecode(''), jdecode('%2F200012%2F108201.html'), 'true',[],'','']
	],'',''],
	['PAGE','1235',jdecode('Clergy+%26+Staff+Contact+Info'),jdecode(''), jdecode('%2F1235.html'), 'true',[],'',''],
	['PAGE','2119',jdecode('Directions'),jdecode(''), jdecode('%2F2119%2Findex.html'), 'true',[ 
		['PAGE','2164',jdecode('Public+Transit'),jdecode(''), jdecode('%2F2119%2F2164.html'), 'true',[],'','']
	],'',''],
	['PAGE','1864',jdecode('Weekly+Calendar'),jdecode(''), jdecode('%2F1864%2Findex.html'), 'true',[ 
		['PAGE','152612',jdecode('January+29-Feb.+4%2C+2012'),jdecode(''), jdecode('%2F1864%2F152612.html'), 'true',[],'',''],
		['PAGE','152812',jdecode('February+5-11%2C+2011'),jdecode(''), jdecode('%2F1864%2F152812.html'), 'true',[],'','']
	],'',''],
	['PAGE','140212',jdecode('Stewardship'),jdecode(''), jdecode('%2F140212%2Findex.html'), 'true',[ 
		['PAGE','140233',jdecode('Pledge+Form'),jdecode(''), jdecode('%2F140212%2F140233.html'), 'true',[],'','']
	],'',''],
	['PAGE','1298',jdecode('Upcoming+Events'),jdecode(''), jdecode('%2F1298.html'), 'true',[],'',''],
	['PAGE','1280',jdecode('Music+%26+Cultural+Offerings'),jdecode(''), jdecode('%2F1280%2Findex.html'), 'true',[ 
		['PAGE','2449',jdecode('Choral+Repertoire'),jdecode(''), jdecode('%2F1280%2F2449.html'), 'true',[],'','']
	],'',''],
	['PAGE','1253',jdecode('Outreach+Ministries'),jdecode(''), jdecode('%2F1253.html'), 'true',[],'',''],
	['PAGE','1271',jdecode('Children+%26+Youth'),jdecode(''), jdecode('%2F1271.html'), 'true',[],'',''],
	['PAGE','105901',jdecode('Close+Call+Newsletter'),jdecode(''), jdecode('%2F105901%2Findex.html'), 'true',[ 
		['PAGE','41101',jdecode('Newsletter+Archive'),jdecode(''), jdecode('%2F105901%2F41101.html'), 'true',[],'','']
	],'',''],
	['PAGE','1307',jdecode('Baptisms%2C+Weddings+%26+Funerals'),jdecode(''), jdecode('%2F1307.html'), 'true',[],'',''],
	['PAGE','7077',jdecode('Hall+Education+Fund'),jdecode(''), jdecode('%2F7077.html'), 'true',[],'',''],
	['PAGE','90',jdecode('About+us'),jdecode(''), jdecode('%2F90.html'), 'true',[],'',''],
	['PAGE','2101',jdecode('Guestbook'),jdecode(''), jdecode('%2F2101%2Findex.html'), 'true',[ 
		['PAGE','2100',jdecode('Read+Guestbook'),jdecode(''), jdecode('%2F2101%2F2100.html'), 'false',[],'','']
	],'','']];
var siteelementCount=28;
theSitetree.topTemplateName='Alpha';
theSitetree.paletteFamily='9C42BD';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10555';
theSitetree.graphicsetId='10897';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'optimum',
  product: 'WSCSYSSSSLYTC245'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Alpha',
				paletteFamily: 	'9C42BD',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10555',
				graphicsetId: 	'10897',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'9C42BD',
				e_color: 		'9C42BD',
				f_color: 		'9C42BD',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '42',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1864',
internalId:  '',
customField: '20120127-115701'
};
webappMappings['1002']=webappMappings['1002-2101AHW050INXXZU']={
webappId:    '1002',
documentId:  '2101',
internalId:  '2101AHW050INXXZU',
customField: 'icq=false'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '2119',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:false;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42',
internalId:  '',
customField: '20120106-110150'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1298',
internalId:  '',
customField: '20120127-121254'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1226',
internalId:  '',
customField: '20101001-103954'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2227',
internalId:  '',
customField: '20100629-100007'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3008',
internalId:  '',
customField: '20120131-093025'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1244',
internalId:  '',
customField: '20111223-102550'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1235',
internalId:  '',
customField: '20111005-074702'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2119',
internalId:  '',
customField: '20070726-140157'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2164',
internalId:  '',
customField: '20070726-140508'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '200012',
internalId:  '',
customField: '20120131-092901'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1280',
internalId:  '',
customField: '20120201-081535'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2449',
internalId:  '',
customField: '20110715-104844'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1253',
internalId:  '',
customField: '20100212-091028'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1271',
internalId:  '',
customField: '20110916-105815'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '108201',
internalId:  '',
customField: '20111021-101512'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41101',
internalId:  '',
customField: '20091229-115822'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1307',
internalId:  '',
customField: '20110916-105604'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7077',
internalId:  '',
customField: '20110323-084032'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '90',
internalId:  '',
customField: '20070509-145002'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2101',
internalId:  '',
customField: '20070726-135146'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2100',
internalId:  '',
customField: '20070726-135146'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '105901',
internalId:  '',
customField: '20120131-093458'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '157712',
internalId:  '',
customField: '20120119-120231'
};
webappMappings['7008']=webappMappings['7008-9694']={
webappId:    '7008',
documentId:  '140233',
internalId:  '9694',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '140212',
internalId:  '',
customField: '20111021-103819'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '140233',
internalId:  '',
customField: '20111021-094552'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '152612',
internalId:  '',
customField: '20120127-120157'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '152812',
internalId:  '',
customField: '20120119-115228'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker03.chi.us.siteprotect.com';
var accountId     = 'AHW050INXXZU';
var companyName   = 'Christ+Church+New+Brunswick';
var htmlTitle	  = 'Christ+Church+New+Brunswick';
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();
};

