/* [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','111',jdecode('Home'),jdecode(''),'/111.html','true',[],''],
	['PAGE','1634',jdecode('Rector%26%23x27%3Bs+Note'),jdecode(''),'/1634.html','true',[],''],
	['PAGE','1918',jdecode('Prayer'),jdecode(''),'/1918.html','true',[],''],
	['PAGE','2113',jdecode('Historical+Sketch+'),jdecode(''),'/2113.html','true',[],''],
	['PAGE','21401',jdecode('Sunday+Services+2009'),jdecode(''),'/21401/index.html','true',[ 
		['PAGE','1882',jdecode('Worship+2008'),jdecode(''),'/21401/1882.html','true',[],'']
	],''],
	['PAGE','24301',jdecode('Events+%2FNews+2009'),jdecode(''),'/24301/index.html','true',[ 
		['PAGE','177',jdecode('Scheduled+Events+2008'),jdecode(''),'/24301/177.html','true',[],'']
	],''],
	['PAGE','30001',jdecode('Rev+Mother+Ellis'),jdecode(''),'/30001.html','true',[],''],
	['PAGE','25301',jdecode('Album+2009'),jdecode(''),'/25301/index.html','true',[ 
		['PAGE','9901',jdecode('2008+Photo+Album'),jdecode(''),'/25301/9901.html','true',[],''],
		['PAGE','33101',jdecode('International+Students'),jdecode(''),'/25301/33101.html','true',[],'']
	],''],
	['PAGE','168',jdecode('C.W.+Brown+Scholarship'),jdecode(''),'/168.html','true',[],''],
	['PAGE','2902',jdecode('Our+Archives'),jdecode(''),'/2902/index.html','true',[ 
		['PAGE','2893',jdecode('Honoring+the+Graduates'),jdecode(''),'/2902/2893.html','true',[],''],
		['PAGE','3232',jdecode('Youth+Ministry'),jdecode(''),'/2902/3232.html','true',[],''],
		['PAGE','1900',jdecode('Christian+Education'),jdecode(''),'/2902/1900.html','true',[],''],
		['PAGE','240',jdecode('Outreach+Ministry'),jdecode(''),'/2902/240.html','true',[],'']
	],''],
	['PAGE','2911',jdecode('St.+Thomas+Album'),jdecode(''),'/2911.html','true',[],''],
	['PAGE','2228',jdecode('Guestbook'),jdecode(''),'/2228.html','true',[],''],
	['PAGE','2227',jdecode('Read+Guestbook'),jdecode(''),'/2227.html','false',[],''],
	['PAGE','2818',jdecode('Directions'),jdecode(''),'/2818.html','true',[],''],
	['PAGE','276',jdecode('Contact'),jdecode(''),'/276.html','true',[],''],
	['PAGE','258',jdecode('Links'),jdecode(''),'/258.html','true',[],'']];
var siteelementCount=24;
theSitetree.topTemplateName='Commander';
theSitetree.paletteFamily='CB3000';
theSitetree.keyvisualId='2386';
theSitetree.keyvisualName='leiterplatte2.jpg';
theSitetree.fontsetId='391';
theSitetree.graphicsetId='441';
theSitetree.contentColor='6E1A00';
theSitetree.contentBGColor='E0E0E0';
var theTemplate={
				name: 			'Commander',
				paletteFamily: 	'CB3000',
				keyvisualId: 	'2386',
				keyvisualName: 	'leiterplatte2.jpg',
				fontsetId: 		'391',
				graphicsetId: 	'441',
				contentColor: 	'6E1A00',
				contentBGColor: 'E0E0E0',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'E0E0E0',
				b_color: 		'6E1A00',
				c_color: 		'B74C29',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2113',
internalId:  '',
customField: '20090531-170354'
};
webappMappings['1002']=webappMappings['1002-2228AHW050IN3EQB']={
webappId:    '1002',
documentId:  '2228',
internalId:  '2228AHW050IN3EQB',
customField: 'icq=false'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '111',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1918',
internalId:  '',
customField: '20090101-213135'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '2818',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:false;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1634',
internalId:  '',
customField: '20090531-222805'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '111',
internalId:  '',
customField: '20090531-225350'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1882',
internalId:  '',
customField: '20090101-223542'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '177',
internalId:  '',
customField: '20090107-204115'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '168',
internalId:  '',
customField: '20090531-185618'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2902',
internalId:  '',
customField: '20090531-220842'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2893',
internalId:  '',
customField: '20071115-031326'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3232',
internalId:  '',
customField: '20071115-003118'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1900',
internalId:  '',
customField: '20071115-030918'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '240',
internalId:  '',
customField: '20081116-220731'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2911',
internalId:  '',
customField: '20090416-230753'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21401',
internalId:  '',
customField: '20090917-223343'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9901',
internalId:  '',
customField: '20081116-193648'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2228',
internalId:  '',
customField: '20080928-225649'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2227',
internalId:  '',
customField: '20071014-221001'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2818',
internalId:  '',
customField: '20080928-225243'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '276',
internalId:  '',
customField: '20090531-195233'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '258',
internalId:  '',
customField: '20090201-183746'
};
webappMappings['7060']=webappMappings['7060-f5e5b7cc0fb11a970969e5f1a0439576']={
webappId:    '7060',
documentId:  '9901',
internalId:  'f5e5b7cc0fb11a970969e5f1a0439576',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-a034190cc8c4bd464b87e9bea0cfb6c3']={
webappId:    '7060',
documentId:  '9901',
internalId:  'a034190cc8c4bd464b87e9bea0cfb6c3',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24301',
internalId:  '',
customField: '20090611-192147'
};
webappMappings['7060']=webappMappings['7060-c8e7d6e01cd5552f4876293e14e12561']={
webappId:    '7060',
documentId:  '25301',
internalId:  'c8e7d6e01cd5552f4876293e14e12561',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25301',
internalId:  '',
customField: '20090107-224112'
};
webappMappings['7060']=webappMappings['7060-d797fd2710f3813519f3a97c697bf43d']={
webappId:    '7060',
documentId:  '30001',
internalId:  'd797fd2710f3813519f3a97c697bf43d',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30001',
internalId:  '',
customField: '20090208-162816'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33101',
internalId:  '',
customField: '20090307-220246'
};
var canonHostname = 'wsc-worker02.chi.us.siteprotect.com';
var accountId     = 'AHW050IN3EQB';
var companyName   = 'St.+Thomas+Episcopal+Church';
var htmlTitle	  = 'http%3A%2F%2Fwww.archdeaconrybrooklyn.org';
var metaKeywords  = 'Christian%2C+spiritual%2C+worship%2C+service%2C+mass%2C+anglican';
var metaContents  = 'St+Thomas+Episcopal+Church+in+brooklyn%2C+anglican+church%2C+Episcopal%2C+Church%2C+Brooklyn+church%2C+christian+church%2C+episcopal+church+in+brooklyn%2C+';
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();
};
