/* [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','4201',jdecode('Home'),jdecode(''),'/4201/index.html','true',[ 
		['PAGE','4273',jdecode('Contact+Us'),jdecode(''),'/4201/4273.html','true',[],'']
	],''],
	['PAGE','10643',jdecode('What%26%23x27%3Bs+Happening%21'),jdecode(''),'/10643.html','true',[],''],
	['PAGE','24825',jdecode('Who+We+Are'),jdecode(''),'/24825.html','true',[],''],
	['PAGE','4252',jdecode('Photos'),jdecode(''),'/4252.html','true',[],''],
	['PAGE','4315',jdecode('Pastors+Page'),jdecode(''),'/4315.html','true',[],''],
	['PAGE','35634',jdecode('Sermon+Notes'),jdecode(''),'/35634.html','true',[],''],
	['PAGE','4336',jdecode('Children%26%23x27%3Bs+Ministry'),jdecode(''),'/4336/index.html','true',[ 
		['PAGE','4294',jdecode('VBS'),jdecode(''),'/4336/4294.html','true',[],''],
		['PAGE','4357',jdecode('Mission+252'),jdecode(''),'/4336/4357.html','true',[],''],
		['PAGE','27834',jdecode('TruthQuest'),jdecode(''),'/4336/27834.html','true',[],'']
	],''],
	['PAGE','10343',jdecode('Youth+Ministries'),jdecode(''),'/10343/index.html','true',[ 
		['PAGE','4378',jdecode('Rock+Solid+High+School'),jdecode(''),'/10343/4378.html','true',[],''],
		['PAGE','10364',jdecode('Rock+Solid+Junior+High'),jdecode(''),'/10343/10364.html','true',[],'']
	],''],
	['PAGE','4399',jdecode('Adult+Discipleship'),jdecode(''),'/4399/index.html','true',[ 
		['PAGE','5101',jdecode('Men%26%23x27%3Bs+Minsitries'),jdecode(''),'/4399/5101.html','true',[],''],
		['PAGE','5122',jdecode('Women%26%23x27%3Bs+Ministries'),jdecode(''),'/4399/5122.html','true',[],''],
		['PAGE','9601',jdecode('Senior+Ministries'),jdecode(''),'/4399/9601.html','true',[],'']
	],''],
	['PAGE','4420',jdecode('Mercy+Ministries'),jdecode(''),'/4420/index.html','true',[ 
		['PAGE','22441',jdecode('Faith+In+Action'),jdecode(''),'/4420/22441.html','true',[],'']
	],''],
	['PAGE','11243',jdecode('Our+Missions'),jdecode(''),'/11243.html','true',[],''],
	['PAGE','4441',jdecode('iMinistries'),jdecode(''),'/4441.html','true',[],''],
	['PAGE','13943',jdecode('Property+Team'),jdecode(''),'/13943.html','true',[],''],
	['PAGE','5001',jdecode('Helpful+Links'),jdecode(''),'/5001.html','true',[],'']];
var siteelementCount=24;
theSitetree.topTemplateName='Verve';
theSitetree.paletteFamily='78D949';
theSitetree.keyvisualId='8400';
theSitetree.keyvisualName='kv_8400.jpg';
theSitetree.fontsetId='17069';
theSitetree.graphicsetId='12441';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Verve',
				paletteFamily: 	'78D949',
				keyvisualId: 	'8400',
				keyvisualName: 	'kv_8400.jpg',
				fontsetId: 		'17069',
				graphicsetId: 	'12441',
				contentColor: 	'000000',
				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:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7060']=webappMappings['7060-073752392f85e4af43b96cd1289fb4d5']={
webappId:    '7060',
documentId:  '4294',
internalId:  '073752392f85e4af43b96cd1289fb4d5',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4201',
internalId:  '',
customField: '20100228-192228'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4252',
internalId:  '',
customField: '20090913-195053'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4294',
internalId:  '',
customField: '20100203-185943'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4378',
internalId:  '',
customField: '20090906-232824'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4336',
internalId:  '',
customField: '20100228-192628'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4357',
internalId:  '',
customField: '20090907-223506'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4399',
internalId:  '',
customField: '20090906-232922'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4420',
internalId:  '',
customField: '20100203-190115'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5001',
internalId:  '',
customField: '20100217-184053'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4315',
internalId:  '',
customField: '20090723-192533'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4441',
internalId:  '',
customField: '20090813-113026'
};
webappMappings['7008']=webappMappings['7008-18933']={
webappId:    '7008',
documentId:  '4273',
internalId:  '18933',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4273',
internalId:  '',
customField: '20090724-220257'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10643',
internalId:  '',
customField: '20100228-192150'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11243',
internalId:  '',
customField: '20100217-184315'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10343',
internalId:  '',
customField: '20100228-193242'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5101',
internalId:  '',
customField: '20090920-080452'
};
webappMappings['7008']=webappMappings['7008-19585']={
webappId:    '7008',
documentId:  '13943',
internalId:  '19585',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13943',
internalId:  '',
customField: '20100110-210753'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5122',
internalId:  '',
customField: '20090906-232942'
};
webappMappings['7060']=webappMappings['7060-f750223d9f9184fbeb52e481e18a6049']={
webappId:    '7060',
documentId:  '4252',
internalId:  'f750223d9f9184fbeb52e481e18a6049',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-0caee23a88f9e6b2ca704535663ce960']={
webappId:    '7060',
documentId:  '22441',
internalId:  '0caee23a88f9e6b2ca704535663ce960',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22441',
internalId:  '',
customField: '20090817-110726'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9601',
internalId:  '',
customField: '20090906-232957'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10364',
internalId:  '',
customField: '20090906-232845'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24825',
internalId:  '',
customField: '20100207-173609'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27834',
internalId:  '',
customField: '20090920-081323'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35634',
internalId:  '',
customField: '20100228-194735'
};
var canonHostname = 'cmworker03.yourhostingaccount.com';
var accountId     = 'AENDU0IN3LBZ';
var companyName   = 'Calvary+Baptist+Church%3A+Real+People%2C+Real+Faith';
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();
};
