/* [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','6801',jdecode('Home'),jdecode(''),'/6801.html','true',[],''],
	['PAGE','16601',jdecode('Pastors+Message'),jdecode(''),'/16601.html','true',[],''],
	['PAGE','16622',jdecode('About+Us'),jdecode(''),'/16622/index.html','true',[ 
		['PAGE','19101',jdecode('Our+Pastor'),jdecode(''),'/16622/19101.html','true',[],''],
		['PAGE','19122',jdecode('Our+History'),jdecode(''),'/16622/19122.html','true',[],''],
		['PAGE','19143',jdecode('The+Staff'),jdecode(''),'/16622/19143.html','true',[],''],
		['PAGE','19164',jdecode('Session+%2F+Deacons'),jdecode(''),'/16622/19164.html','true',[],''],
		['PAGE','19185',jdecode('Directions'),jdecode(''),'/16622/19185.html','true',[],''],
		['PAGE','19206',jdecode('Contact+Us'),jdecode(''),'/16622/19206.html','true',[],'']
	],''],
	['PAGE','16643',jdecode('Worship'),jdecode(''),'/16643/index.html','true',[ 
		['PAGE','19227',jdecode('Sunday+Service'),jdecode(''),'/16643/19227.html','true',[],''],
		['PAGE','19248',jdecode('Special+Services'),jdecode(''),'/16643/19248.html','true',[],'']
	],''],
	['PAGE','16664',jdecode('Children+%26+Youth'),jdecode(''),'/16664.html','true',[],''],
	['PAGE','16685',jdecode('Adult+Sunday+School'),jdecode(''),'/16685.html','true',[],''],
	['PAGE','16706',jdecode('Bible+Study'),jdecode(''),'/16706.html','true',[],''],
	['PAGE','16727',jdecode('Choir'),jdecode(''),'/16727.html','true',[],''],
	['PAGE','16748',jdecode('Outreach+%26+Mission'),jdecode(''),'/16748/index.html','true',[ 
		['PAGE','19701',jdecode('US+%26+World+Mission'),jdecode(''),'/16748/19701.html','true',[],''],
		['PAGE','19269',jdecode('North+Shore+Sheltering'),jdecode(''),'/16748/19269.html','true',[],'']
	],''],
	['PAGE','19311',jdecode('Giving'),jdecode(''),'/19311.html','true',[],''],
	['PAGE','19332',jdecode('Events+'),jdecode(''),'/19332.html','true',[],''],
	['PAGE','19353',jdecode('Calendar'),jdecode(''),'/19353.html','true',[],''],
	['PAGE','30501',jdecode('Congregational+Retreat'),jdecode(''),'/30501.html','true',[],''],
	['PAGE','19374',jdecode('The+Gregarians'),jdecode(''),'/19374.html','true',[],''],
	['PAGE','19395',jdecode('OutNAbout+Glen+Cove'),jdecode(''),'/19395.html','true',[],''],
	['PAGE','19416',jdecode('Holocaust+Center'),jdecode(''),'/19416.html','true',[],''],
	['PAGE','30522',jdecode('In+the+News'),jdecode(''),'/30522.html','true',[],''],
	['PAGE','45701',jdecode('Newsletter'),jdecode(''),'/45701.html','true',[],''],
	['PAGE','19437',jdecode('Photo+Gallery'),jdecode(''),'/19437.html','true',[],''],
	['PAGE','19458',jdecode('Contact+Us'),jdecode(''),'/19458.html','true',[],'']];
var siteelementCount=30;
theSitetree.topTemplateName='Grace';
theSitetree.paletteFamily='CECDD0';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='32053';
theSitetree.graphicsetId='13873';
theSitetree.contentColor='484848';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Grace',
				paletteFamily: 	'CECDD0',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'32053',
				graphicsetId: 	'13873',
				contentColor: 	'484848',
				contentBGColor: 'FFFFFF',
				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: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6801',
internalId:  '',
customField: '20100311-091920'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16601',
internalId:  '',
customField: '20090615-084844'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16622',
internalId:  '',
customField: '20090512-105826'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16643',
internalId:  '',
customField: '20091212-083423'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16664',
internalId:  '',
customField: '20090826-074254'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16685',
internalId:  '',
customField: '20100313-085417'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16706',
internalId:  '',
customField: '20091212-094513'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16727',
internalId:  '',
customField: '20091211-093244'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16748',
internalId:  '',
customField: '20090501-083730'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19227',
internalId:  '',
customField: '20090501-161620'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19101',
internalId:  '',
customField: '20090512-105841'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19122',
internalId:  '',
customField: '20091212-094414'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19143',
internalId:  '',
customField: '20090501-144903'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19164',
internalId:  '',
customField: '20090424-083822'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19185',
internalId:  '',
customField: '20090501-133321'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19206',
internalId:  '',
customField: '20090425-075731'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19248',
internalId:  '',
customField: '20100120-060919'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19701',
internalId:  '',
customField: '20090501-083937'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19269',
internalId:  '',
customField: '20090501-084031'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19311',
internalId:  '',
customField: '20090501-084440'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19332',
internalId:  '',
customField: '20100313-090133'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19353',
internalId:  '',
customField: '20100312-073934'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19374',
internalId:  '',
customField: '20100311-071851'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19395',
internalId:  '',
customField: '20100311-074650'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19416',
internalId:  '',
customField: '20090501-162208'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19437',
internalId:  '',
customField: '20090615-081516'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19458',
internalId:  '',
customField: '20090425-075955'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30501',
internalId:  '',
customField: '20100313-083910'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30522',
internalId:  '',
customField: '20090826-075225'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45701',
internalId:  '',
customField: '20100120-062516'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '6801',
internalId:  '1006',
customField: '1006'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0IN3QHS';
var companyName   = 'First+Presbyterian+Church+of+Glen+Cove';
var htmlTitle	  = 'First+Presbyterian+Church+of+Glen+Cove+An+Open+and+Affirming+Church';
var metaKeywords  = 'Glen+Cove+Presbyterian+Church%2C+First+Presbyterian+Church+Glen+Cove%2C+Church+Glen+Cove%2C+Gay+church+long+island%2C+city+of+Glen+Cove+Church';
var metaContents  = 'First+Presbyterian+Church+of+Glen+Cove+-+An+Open+and+Affirming+Church+in+the+Heart+of+Glen+Cove';
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();
};
