/* [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','42',jdecode('Home'),jdecode(''),'/42.html','true',[],''],
	['PAGE','1226',jdecode('Worship'),jdecode(''),'/1226/index.html','true',[ 
		['PAGE','2227',jdecode('Service+Schedule'),jdecode(''),'/1226/2227.html','true',[],''],
		['PAGE','112712',jdecode('Lent+%26+Holy+Week+2010+Schedule'),jdecode(''),'/1226/112712.html','true',[],''],
		['PAGE','3008',jdecode('Ministers+of+the+Liturgy+Schedule'),jdecode(''),'/1226/3008.html','true',[],'']
	],''],
	['PAGE','1244',jdecode('Lay+Leaders'),jdecode(''),'/1244.html','true',[],''],
	['PAGE','108201',jdecode('Sermons'),jdecode(''),'/108201/index.html','true',[ 
		['PAGE','42401',jdecode('2009+Sermons'),jdecode(''),'/108201/42401.html','true',[],'']
	],''],
	['PAGE','1235',jdecode('Clergy+%26+Staff+Contact+Info'),jdecode(''),'/1235.html','true',[],''],
	['PAGE','2119',jdecode('Directions'),jdecode(''),'/2119/index.html','true',[ 
		['PAGE','2164',jdecode('Public+Transit'),jdecode(''),'/2119/2164.html','true',[],'']
	],''],
	['PAGE','1864',jdecode('Weekly+Calendar'),jdecode(''),'/1864/index.html','true',[ 
		['PAGE','102001',jdecode('Week+of+Feb.+28-March+6%2C+2010'),jdecode(''),'/1864/102001.html','true',[],''],
		['PAGE','83401',jdecode('Week+of+March+7-13%2C+2010'),jdecode(''),'/1864/83401.html','true',[],'']
	],''],
	['PAGE','1298',jdecode('Upcoming+Events'),jdecode(''),'/1298/index.html','true',[ 
		['PAGE','112733',jdecode('Lenten+Educational+Opportunties'),jdecode(''),'/1298/112733.html','true',[],'']
	],''],
	['PAGE','1280',jdecode('Music+%26+Cultural+Offerings'),jdecode(''),'/1280/index.html','true',[ 
		['PAGE','89801',jdecode('2009-10+Concert+Schedule'),jdecode(''),'/1280/89801.html','true',[],''],
		['PAGE','2449',jdecode('Choral+Repertoire'),jdecode(''),'/1280/2449.html','true',[],'']
	],''],
	['PAGE','1253',jdecode('Outreach+Ministries'),jdecode(''),'/1253.html','true',[],''],
	['PAGE','1271',jdecode('Children+%26+Youth'),jdecode(''),'/1271.html','true',[],''],
	['PAGE','1289',jdecode('Programs+%26+Activities'),jdecode(''),'/1289.html','true',[],''],
	['PAGE','105901',jdecode('Close+Call+Newsletter'),jdecode(''),'/105901/index.html','true',[ 
		['PAGE','41101',jdecode('Newsletter+Archive'),jdecode(''),'/105901/41101.html','true',[],'']
	],''],
	['PAGE','1307',jdecode('Baptisms%2C+Weddings+%26+Funerals'),jdecode(''),'/1307.html','true',[],''],
	['PAGE','7077',jdecode('Hall+Education+Fund'),jdecode(''),'/7077.html','true',[],''],
	['PAGE','90',jdecode('About+us'),jdecode(''),'/90.html','true',[],''],
	['PAGE','2101',jdecode('Guestbook'),jdecode(''),'/2101/index.html','true',[ 
		['PAGE','2100',jdecode('Read+Guestbook'),jdecode(''),'/2101/2100.html','false',[],'']
	],'']];
var siteelementCount=29;
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 theTemplate={
				name: 			'Alpha',
				paletteFamily: 	'9C42BD',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10555',
				graphicsetId: 	'10897',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				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: '20100225-100027'
};
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: '20100212-093800'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1298',
internalId:  '',
customField: '20100225-101441'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '112712',
internalId:  '',
customField: '20100212-092622'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1226',
internalId:  '',
customField: '20090805-121154'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2227',
internalId:  '',
customField: '20090603-091650'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3008',
internalId:  '',
customField: '20100301-112129'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1244',
internalId:  '',
customField: '20100212-094943'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1235',
internalId:  '',
customField: '20091029-091259'
};
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:  '42401',
internalId:  '',
customField: '20100108-110444'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1280',
internalId:  '',
customField: '20100212-090812'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2449',
internalId:  '',
customField: '20090603-112020'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '102001',
internalId:  '',
customField: '20100225-100124'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1253',
internalId:  '',
customField: '20100212-091028'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1271',
internalId:  '',
customField: '20091029-092432'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1289',
internalId:  '',
customField: '20070430-175455'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '108201',
internalId:  '',
customField: '20100225-111513'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41101',
internalId:  '',
customField: '20091229-115822'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1307',
internalId:  '',
customField: '20080902-124013'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7077',
internalId:  '',
customField: '20080418-165040'
};
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: '20100301-105807'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '112733',
internalId:  '',
customField: '20100212-093402'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '89801',
internalId:  '',
customField: '20091210-091728'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '83401',
internalId:  '',
customField: '20100219-120426'
};
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();
};
