/* [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','401',jdecode('Home'),jdecode(''),'/401.html','true',[],''],
	['PAGE','8901',jdecode('Calendar+%26+Events'),jdecode(''),'/8901/index.html','true',[ 
		['PAGE','163773',jdecode('Current+Announcements'),jdecode(''),'/8901/163773.html','true',[],'']
	],''],
	['PAGE','1401',jdecode('Who+We+Are'),jdecode(''),'/1401/index.html','true',[ 
		['PAGE','1422',jdecode('Meet+The+Staff'),jdecode(''),'/1401/1422.html','true',[],''],
		['PAGE','1443',jdecode('Church+Leadership'),jdecode(''),'/1401/1443.html','true',[],''],
		['PAGE','1464',jdecode('St.+Paul%26%23x27%3Bs+History'),jdecode(''),'/1401/1464.html','true',[],'']
	],''],
	['PAGE','20101',jdecode('Worship+With+Us'),jdecode(''),'/20101/index.html','true',[ 
		['PAGE','20122',jdecode('Music+%26+Choir'),jdecode(''),'/20101/20122.html','true',[],''],
		['PAGE','20206',jdecode('Life+Events'),jdecode(''),'/20101/20206.html','true',[],''],
		['PAGE','35201',jdecode('Pray+List'),jdecode(''),'/20101/35201.html','true',[],'']
	],''],
	['PAGE','20701',jdecode('Sermons'),jdecode(''),'/20701/index.html','true',[ 
		['PAGE','26901',jdecode('September+28%2C+2008'),jdecode(''),'/20701/26901.html','true',[],''],
		['PAGE','17522',jdecode('September+14%2C+2008'),jdecode(''),'/20701/17522.html','true',[],''],
		['PAGE','28601',jdecode('October+12%2C+2008'),jdecode(''),'/20701/28601.html','true',[],''],
		['PAGE','29701',jdecode('October+19%2C+2008'),jdecode(''),'/20701/29701.html','true',[],''],
		['PAGE','31501',jdecode('October+26%2C+2008'),jdecode(''),'/20701/31501.html','true',[],''],
		['PAGE','36501',jdecode('November+16%2C+2008'),jdecode(''),'/20701/36501.html','true',[],''],
		['PAGE','36522',jdecode('November+23%2C+2008'),jdecode(''),'/20701/36522.html','true',[],''],
		['PAGE','36543',jdecode('Novembr+23%2C+2008+Thanksgiving'),jdecode(''),'/20701/36543.html','true',[],''],
		['PAGE','38912',jdecode('November+30%2C+2008'),jdecode(''),'/20701/38912.html','true',[],''],
		['PAGE','39112',jdecode('December+14%2C+2008'),jdecode(''),'/20701/39112.html','true',[],''],
		['PAGE','39312',jdecode('December+21%2C+2008'),jdecode(''),'/20701/39312.html','true',[],''],
		['PAGE','41412',jdecode('December+24%2C+2008+Christmas'),jdecode(''),'/20701/41412.html','true',[],''],
		['PAGE','45112',jdecode('January+18%2C+2009'),jdecode(''),'/20701/45112.html','true',[],''],
		['PAGE','45133',jdecode('January+25%2C+2009'),jdecode(''),'/20701/45133.html','true',[],''],
		['PAGE','45154',jdecode('February+8%2C+2009'),jdecode(''),'/20701/45154.html','true',[],''],
		['PAGE','47712',jdecode('February+22%2C+2009'),jdecode(''),'/20701/47712.html','true',[],''],
		['PAGE','50712',jdecode('March+8%2C+2009'),jdecode(''),'/20701/50712.html','true',[],''],
		['PAGE','54312',jdecode('March+15%2C+2009'),jdecode(''),'/20701/54312.html','true',[],'']
	],''],
	['PAGE','20143',jdecode('Faith+Formation'),jdecode(''),'/20143/index.html','true',[ 
		['PAGE','1548',jdecode('Church+School'),jdecode(''),'/20143/1548.html','true',[],''],
		['PAGE','56212',jdecode('Church+School+Events'),jdecode(''),'/20143/56212.html','true',[],''],
		['PAGE','20164',jdecode('Adult+Formation'),jdecode(''),'/20143/20164.html','true',[],'']
	],''],
	['PAGE','1590',jdecode('Faith+in+Action'),jdecode(''),'/1590/index.html','true',[ 
		['PAGE','191173',jdecode('Youth+Ministries'),jdecode(''),'/1590/191173.html','true',[],''],
		['PAGE','191215',jdecode('Worship+%26+Music'),jdecode(''),'/1590/191215.html','true',[],''],
		['PAGE','25601',jdecode('Altar+Guild'),jdecode(''),'/1590/25601.html','true',[],''],
		['PAGE','192673',jdecode('Outreach+Committee'),jdecode(''),'/1590/192673.html','true',[],''],
		['PAGE','191236',jdecode('Inreach+Committee'),jdecode(''),'/1590/191236.html','true',[],''],
		['PAGE','191257',jdecode('Fellowship'),jdecode(''),'/1590/191257.html','true',[],''],
		['PAGE','191278',jdecode('Administration'),jdecode(''),'/1590/191278.html','true',[],'']
	],''],
	['PAGE','20185',jdecode('Parish+Life'),jdecode(''),'/20185.html','false',[],''],
	['PAGE','34901',jdecode('Newsletter+and+Links'),jdecode(''),'/34901.html','true',[],''],
	['PAGE','20248',jdecode('Directions'),jdecode(''),'/20248/index.html','true',[ 
		['PAGE','11001',jdecode('Map'),jdecode(''),'/20248/11001.html','true',[],'']
	],''],
	['PAGE','9501',jdecode('Read+Guestbook'),jdecode(''),'/9501.html','false',[],''],
	['PAGE','1632',jdecode('Contact+Us'),jdecode(''),'/1632.html','true',[],''],
	['PAGE','9506',jdecode('Guestbook'),jdecode(''),'/9506.html','false',[],''],
	['PAGE','67512',jdecode('LinkTest'),jdecode(''),'/67512.html','false',[],'']];
var siteelementCount=50;
theSitetree.topTemplateName='Blossom';
theSitetree.paletteFamily='AC2E53';
theSitetree.keyvisualId='7105';
theSitetree.keyvisualName='kv_7105.jpg';
theSitetree.fontsetId='16395';
theSitetree.graphicsetId='12128';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='E5E2E2';
var theTemplate={
				name: 			'Blossom',
				paletteFamily: 	'AC2E53',
				keyvisualId: 	'7105',
				keyvisualName: 	'kv_7105.jpg',
				fontsetId: 		'16395',
				graphicsetId: 	'12128',
				contentColor: 	'000000',
				contentBGColor: 'E5E2E2',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1401',
internalId:  '',
customField: '20100207-122755'
};
webappMappings['1002']=webappMappings['1002-9506ahw050invdgi']={
webappId:    '1002',
documentId:  '9506',
internalId:  '9506ahw050invdgi',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20100227-195540'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '11001',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:false;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20101',
internalId:  '',
customField: '20100212-122848'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20122',
internalId:  '',
customField: '20100227-201428'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20143',
internalId:  '',
customField: '20100227-144108'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1548',
internalId:  '',
customField: '20100227-193204'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20164',
internalId:  '',
customField: '20100227-193341'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1590',
internalId:  '',
customField: '20100227-201742'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25601',
internalId:  '',
customField: '20100228-193317'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20701',
internalId:  '',
customField: '20100301-191936'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26901',
internalId:  '',
customField: '20081001-233756'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17522',
internalId:  '',
customField: '20080917-133708'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28601',
internalId:  '',
customField: '20081026-202033'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29701',
internalId:  '',
customField: '20081026-202238'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20185',
internalId:  '',
customField: '20090703-083643'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1443',
internalId:  '',
customField: '20100228-193035'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20206',
internalId:  '',
customField: '20100227-201455'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1422',
internalId:  '',
customField: '20100227-103725'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1464',
internalId:  '',
customField: '20100227-195847'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36543',
internalId:  '',
customField: '20081126-134352'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20248',
internalId:  '',
customField: '20100208-113823'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1632',
internalId:  '',
customField: '20100227-194052'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8901',
internalId:  '',
customField: '20100227-195626'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '191173',
internalId:  '',
customField: '20100228-193151'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9506',
internalId:  '',
customField: '20080829-213800'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9501',
internalId:  '',
customField: '20080829-213800'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11001',
internalId:  '',
customField: '20080830-085643'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36501',
internalId:  '',
customField: '20081126-134550'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36522',
internalId:  '',
customField: '20081126-134456'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31501',
internalId:  '',
customField: '20081031-231931'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34901',
internalId:  '',
customField: '20100301-191403'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35201',
internalId:  '',
customField: '20100227-200123'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38912',
internalId:  '',
customField: '20081227-101515'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39112',
internalId:  '',
customField: '20081227-101807'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39312',
internalId:  '',
customField: '20081227-102215'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41412',
internalId:  '',
customField: '20081231-002246'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45112',
internalId:  '',
customField: '20090207-203802'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45133',
internalId:  '',
customField: '20090207-204005'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45154',
internalId:  '',
customField: '20090207-204331'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '47712',
internalId:  '',
customField: '20090304-094849'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50712',
internalId:  '',
customField: '20090310-084606'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '54312',
internalId:  '',
customField: '20090402-094041'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '56212',
internalId:  '',
customField: '20100208-114744'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '191236',
internalId:  '',
customField: '20100228-193419'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '67512',
internalId:  '',
customField: '20090714-152235'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '191215',
internalId:  '',
customField: '20100228-193230'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '163773',
internalId:  '',
customField: '20100226-183759'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '192673',
internalId:  '',
customField: '20100227-185747'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '191257',
internalId:  '',
customField: '20100228-193527'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '191278',
internalId:  '',
customField: '20100227-202637'
};
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050INVDGI';
var companyName   = 'St.+Paul%27s+Episcopal+Church+%E2%80%A2+North+Andover%2C+MA';
var htmlTitle	  = 'St.+Paul%27s+Episcopal+Church%2C+North+Andover%2C+MA';
var metaKeywords  = 'episcopal+pauls+church+andover+ma+north+services+christian+anglican+massachusetts+parish+';
var metaContents  = 'St.+Pauls+is+an+Episcopal+Church+located+in+North+Andover%2C+Massachusetts.';
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();
};
