/* [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','34801',jdecode('Homepage'),jdecode(''),'/34801.html','true',[],''],
	['PAGE','7043',jdecode('4th+Episcopal+Bishop'),jdecode(''),'/7043.html','true',[],''],
	['PAGE','7064',jdecode('Presiding+Elder'),jdecode(''),'/7064.html','true',[],''],
	['PAGE','7106',jdecode('Churches%2FPastors'),jdecode(''),'/7106/index.html','true',[ 
		['PAGE','37001',jdecode('Reeves+Temple'),jdecode(''),'/7106/37001.html','true',[],''],
		['PAGE','112601',jdecode('Bethel'),jdecode(''),'/7106/112601.html','true',[],''],
		['PAGE','104201',jdecode('New+Hope'),jdecode(''),'/7106/104201.html','true',[],''],
		['PAGE','67901',jdecode('Mt.+Nebo%2FSt.+Paul'),jdecode(''),'/7106/67901.html','true',[],''],
		['PAGE','30501',jdecode('Merrick+Chapel'),jdecode(''),'/7106/30501.html','true',[],'']
	],''],
	['PAGE','7148',jdecode('Officers'),jdecode(''),'/7148.html','true',[],''],
	['PAGE','27101',jdecode('Forms'),jdecode(''),'/27101.html','true',[],''],
	['PAGE','7001',jdecode('Calendar+of+Events'),jdecode(''),'/7001.html','true',[],''],
	['PAGE','25801',jdecode('Announcements'),jdecode(''),'/25801.html','true',[],''],
	['PAGE','111501',jdecode('Community+Services'),jdecode(''),'/111501.html','true',[],''],
	['PAGE','31901',jdecode('Voting+Information'),jdecode(''),'/31901.html','true',[],''],
	['PAGE','27122',jdecode('Pictures%2FActivities'),jdecode(''),'/27122.html','true',[],''],
	['PAGE','6922',jdecode('Email%2FLinks%2FGuestbook'),jdecode(''),'/6922.html','true',[],'']];
var siteelementCount=17;
theSitetree.topTemplateName='Orbit';
theSitetree.paletteFamily='003366';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='175';
theSitetree.graphicsetId='202';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='003366';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Orbit',
				paletteFamily: 	'003366',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'175',
				graphicsetId: 	'202',
				contentColor: 	'FFFFFF',
				contentBGColor: '003366',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'003366',
				b_color: 		'336699',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6922',
internalId:  '',
customField: '20091009-200148'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7043',
internalId:  '',
customField: '20090905-040126'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '34801',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7064',
internalId:  '',
customField: '20090611-180648'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37001',
internalId:  '',
customField: '20091125-080719'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7106',
internalId:  '',
customField: '20091125-080504'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31901',
internalId:  '',
customField: '20081205-210746'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7148',
internalId:  '',
customField: '20090707-011501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7001',
internalId:  '',
customField: '20090925-095655'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25801',
internalId:  '',
customField: '20100303-033113'
};
webappMappings['1002']=webappMappings['1002-6922aendu0inecqf']={
webappId:    '1002',
documentId:  '6922',
internalId:  '6922aendu0inecqf',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30501',
internalId:  '',
customField: '20091010-102757'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27122',
internalId:  '',
customField: '20090728-192601'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27101',
internalId:  '',
customField: '20080927-215344'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34801',
internalId:  '',
customField: '20100303-031821'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '67901',
internalId:  '',
customField: '20100123-232041'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '104201',
internalId:  '',
customField: '20100123-232516'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '111501',
internalId:  '',
customField: '20091007-225522'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '112601',
internalId:  '',
customField: '20090911-050557'
};
var canonHostname = 'cmworker01.yourhostingaccount.com';
var accountId     = 'AENDU0INECQF';
var companyName   = 'Crowley+District+Christian+Methodist+Episcopal+Church';
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();
};
