/* [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','301',jdecode('Home'),jdecode(''),'/301.html','true',[],'',''],
	['PAGE','352',jdecode('Who+We+Are'),jdecode(''),'/352.html','true',[],'',''],
	['PAGE','373',jdecode('Our+History'),jdecode(''),'/373.html','true',[],'',''],
	['PAGE','415',jdecode('Worship'),jdecode(''),'/415/index.html','true',[ 
		['PAGE','478',jdecode('Volunteer+Schedule'),jdecode(''),'/415/478.html','true',[],'',''],
		['PAGE','457',jdecode('Music'),jdecode(''),'/415/457.html','true',[],'','']
	],'',''],
	['PAGE','436',jdecode('Classes'),jdecode(''),'/436.html','true',[],'',''],
	['PAGE','31301',jdecode('Youth'),jdecode(''),'/31301/index.html','true',[ 
		['PAGE','31322',jdecode('Activities'),jdecode(''),'/31301/31322.html','true',[],'',''],
		['PAGE','34301',jdecode('Yo-Fam+Photos'),jdecode(''),'/31301/34301.html','true',[],'',''],
		['PAGE','134001',jdecode('YoYoFam'),jdecode(''),'/31301/134001.html','true',[],'','']
	],'',''],
	['PAGE','26201',jdecode('Calendar+of+Activities'),jdecode(''),'/26201/index.html','true',[ 
		['PAGE','36901',jdecode('Special+Events'),jdecode(''),'/26201/36901.html','true',[],'',''],
		['PAGE','6101',jdecode('Bargain+Sale'),jdecode(''),'/26201/6101.html','true',[],'',''],
		['PAGE','42401',jdecode('Basket+Auction'),jdecode(''),'/26201/42401.html','true',[],'',''],
		['PAGE','46101',jdecode('Soup+Cook-off'),jdecode(''),'/26201/46101.html','true',[],'','']
	],'',''],
	['PAGE','59401',jdecode('Vacation+Bible+School'),jdecode(''),'/59401.html','true',[],'',''],
	['PAGE','39201',jdecode('Groups'),jdecode(''),'/39201/index.html','true',[ 
		['PAGE','39901',jdecode('Presbyterian+Women'),jdecode(''),'/39201/39901.html','true',[],'',''],
		['PAGE','39922',jdecode('Ruth+Circle'),jdecode(''),'/39201/39922.html','true',[],'',''],
		['PAGE','39943',jdecode('Esther+Circle'),jdecode(''),'/39201/39943.html','true',[],'',''],
		['PAGE','39964',jdecode('WFF'),jdecode(''),'/39201/39964.html','true',[],'',''],
		['PAGE','39985',jdecode('Presbyterian+Men'),jdecode(''),'/39201/39985.html','true',[],'',''],
		['PAGE','40027',jdecode('Prayer+Group'),jdecode(''),'/39201/40027.html','true',[],'',''],
		['PAGE','40048',jdecode('Music'),jdecode(''),'/39201/40048.html','true',[],'',''],
		['PAGE','40090',jdecode('Prayer+Quilt+Ministry'),jdecode(''),'/39201/40090.html','true',[],'','']
	],'',''],
	['PAGE','82101',jdecode('ArkALMIGHTY'),jdecode(''),'/82101.html','true',[],'',''],
	['PAGE','520',jdecode('Contact'),jdecode(''),'/520/index.html','true',[ 
		['PAGE','499',jdecode('Staff'),jdecode(''),'/520/499.html','true',[],'',''],
		['PAGE','38201',jdecode('How+to+Find+Us'),jdecode(''),'/520/38201.html','true',[],'','']
	],'','']];
var siteelementCount=30;
theSitetree.topTemplateName='Shadows';
theSitetree.paletteFamily='FFB573';
theSitetree.keyvisualId='1835';
theSitetree.keyvisualName='generationen.jpg';
theSitetree.fontsetId='313';
theSitetree.graphicsetId='368';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFDAB9';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Shadows',
				paletteFamily: 	'FFB573',
				keyvisualId: 	'1835',
				keyvisualName: 	'generationen.jpg',
				fontsetId: 		'313',
				graphicsetId: 	'368',
				contentColor: 	'000000',
				contentBGColor: 'FFDAB9',
				a_color: 		'FFB573',
				b_color: 		'000000',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7060']=webappMappings['7060-a251a43f51eb129e9a568331d7d8c2a2']={
webappId:    '7060',
documentId:  '6101',
internalId:  'a251a43f51eb129e9a568331d7d8c2a2',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-4f768d1e5e21fc6394c0474854ce1936']={
webappId:    '7060',
documentId:  '34301',
internalId:  '4f768d1e5e21fc6394c0474854ce1936',
customField: 'language:en;country:US;'
};
webappMappings['7008']=webappMappings['7008-952']={
webappId:    '7008',
documentId:  '520',
internalId:  '952',
customField: 'language:en;country:US;'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '38201',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:false;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '134001',
internalId:  '',
customField: '20100728-171057'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '301',
internalId:  '',
customField: '20100719-090530'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '82101',
internalId:  '',
customField: '20090721-162252'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '415',
internalId:  '',
customField: '20100719-093307'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '478',
internalId:  '',
customField: '20100728-163748'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31301',
internalId:  '',
customField: '20100719-090610'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26201',
internalId:  '',
customField: '20100728-171308'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36901',
internalId:  '',
customField: '20100811-164451'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39201',
internalId:  '',
customField: '20100618-171311'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39901',
internalId:  '',
customField: '20100728-165454'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39922',
internalId:  '',
customField: '20100811-164900'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '352',
internalId:  '',
customField: '20100719-092623'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42401',
internalId:  '',
customField: '20100512-143631'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '373',
internalId:  '',
customField: '20091116-104524'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '436',
internalId:  '',
customField: '20100718-085243'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '457',
internalId:  '',
customField: '20090721-151101'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31322',
internalId:  '',
customField: '20100127-105638'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34301',
internalId:  '',
customField: '20090721-154146'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6101',
internalId:  '',
customField: '20100811-164358'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46101',
internalId:  '',
customField: '20091028-172859'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39943',
internalId:  '',
customField: '20100718-085819'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39964',
internalId:  '',
customField: '20100718-085838'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39985',
internalId:  '',
customField: '20100728-165612'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40027',
internalId:  '',
customField: '20090721-162021'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40048',
internalId:  '',
customField: '20090721-162104'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40090',
internalId:  '',
customField: '20090721-162230'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '520',
internalId:  '',
customField: '20091028-173040'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '499',
internalId:  '',
customField: '20091216-161304'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38201',
internalId:  '',
customField: '20090721-162558'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '59401',
internalId:  '',
customField: '20100719-092425'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '301',
internalId:  '1006',
customField: '1006'
};
var canonHostname = 'cmworker01.yourhostingaccount.com';
var accountId     = 'AENDU0INXECX';
var companyName   = 'First+Presbyterian+Church+of+Derby';
var htmlTitle	  = '';
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();
};
