/* [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','4201',jdecode('Home'),jdecode(''), jdecode('%2F4201%2Findex.html'), 'true',[ 
		['PAGE','4273',jdecode('Contact+Us'),jdecode(''), jdecode('%2F4201%2F4273.html'), 'true',[],'','']
	],'',''],
	['PAGE','10643',jdecode('What%26%23x27%3Bs+Happening%21'),jdecode(''), jdecode('%2F10643.html'), 'true',[],'',''],
	['PAGE','66946',jdecode('Scripture+Memory+Verses'),jdecode(''), jdecode('%2F66946.html'), 'true',[],'',''],
	['PAGE','62346',jdecode('Calvary+University'),jdecode(''), jdecode('%2F62346.html'), 'true',[],'',''],
	['PAGE','50906',jdecode('Guide+to+Prayer'),jdecode(''), jdecode('%2F50906.html'), 'true',[],'',''],
	['PAGE','24825',jdecode('Who+We+Are'),jdecode(''), jdecode('%2F24825.html'), 'true',[],'',''],
	['PAGE','66246',jdecode('Sermons'),jdecode(''), jdecode('%2F66246%2Findex.html'), 'true',[ 
		['PAGE','35634',jdecode('Sermon+Notes'),jdecode(''), jdecode('%2F66246%2F35634.html'), 'true',[],'',''],
		['PAGE','4315',jdecode('Pastors+Page'),jdecode(''), jdecode('%2F66246%2F4315.html'), 'true',[],'','']
	],'',''],
	['PAGE','4336',jdecode('Children%26%23x27%3Bs+Ministry'),jdecode(''), jdecode('%2F4336%2Findex.html'), 'true',[ 
		['PAGE','27834',jdecode('TruthQuest'),jdecode(''), jdecode('%2F4336%2F27834.html'), 'true',[],'',''],
		['PAGE','4357',jdecode('Mission+252'),jdecode(''), jdecode('%2F4336%2F4357.html'), 'true',[],'','']
	],'',''],
	['PAGE','10343',jdecode('Youth+Ministries'),jdecode(''), jdecode('%2F10343%2Findex.html'), 'true',[ 
		['PAGE','4378',jdecode('Rock+Solid+High+School'),jdecode(''), jdecode('%2F10343%2F4378.html'), 'true',[],'',''],
		['PAGE','10364',jdecode('Rock+Solid+Junior+High'),jdecode(''), jdecode('%2F10343%2F10364.html'), 'true',[],'','']
	],'',''],
	['PAGE','4399',jdecode('Adult+Discipleship'),jdecode(''), jdecode('%2F4399%2Findex.html'), 'true',[ 
		['PAGE','5101',jdecode('Men%26%23x27%3Bs+Minsitries'),jdecode(''), jdecode('%2F4399%2F5101.html'), 'true',[],'',''],
		['PAGE','5122',jdecode('Women%26%23x27%3Bs+Ministries'),jdecode(''), jdecode('%2F4399%2F5122.html'), 'true',[],'',''],
		['PAGE','9601',jdecode('Senior+Ministries'),jdecode(''), jdecode('%2F4399%2F9601.html'), 'true',[],'','']
	],'',''],
	['PAGE','4420',jdecode('Mercy+Ministries'),jdecode(''), jdecode('%2F4420.html'), 'true',[],'',''],
	['PAGE','11243',jdecode('Our+Missions'),jdecode(''), jdecode('%2F11243.html'), 'true',[],'',''],
	['PAGE','13943',jdecode('Property+Team'),jdecode(''), jdecode('%2F13943.html'), 'true',[],'',''],
	['PAGE','5001',jdecode('Helpful+Links'),jdecode(''), jdecode('%2F5001.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 prodDef={
  wl_name: 'endurance',
  product: 'WSCSYSSSSLY0XRN4'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Verve',
				paletteFamily: 	'78D949',
				keyvisualId: 	'8400',
				keyvisualName: 	'kv_8400.jpg',
				fontsetId: 		'17069',
				graphicsetId: 	'12441',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				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['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4201',
internalId:  '',
customField: '20120201-201147'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4378',
internalId:  '',
customField: '20090906-232824'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4336',
internalId:  '',
customField: '20100616-151047'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4357',
internalId:  '',
customField: '20100919-194740'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4399',
internalId:  '',
customField: '20090906-232922'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4420',
internalId:  '',
customField: '20111226-184219'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5001',
internalId:  '',
customField: '20101107-155118'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4315',
internalId:  '',
customField: '20090723-192533'
};
webappMappings['7060']=webappMappings['7060-17ed2da6e42b6ef1baedf5d51b166b32']={
webappId:    '7060',
documentId:  '66246',
internalId:  '17ed2da6e42b6ef1baedf5d51b166b32',
customField: 'language:en;country:US;'
};
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: '20100726-205754'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10643',
internalId:  '',
customField: '20120115-141447'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11243',
internalId:  '',
customField: '20100310-192134'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10343',
internalId:  '',
customField: '20110914-222808'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5101',
internalId:  '',
customField: '20111226-184251'
};
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['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '66246',
internalId:  '',
customField: '20111226-185554'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '62346',
internalId:  '',
customField: '20111226-181100'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50906',
internalId:  '',
customField: '20111009-222513'
};
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: '20120115-142410'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '66946',
internalId:  '',
customField: '20120201-201457'
};
var webAppHostname = 'cgiwsc.enhancedsitebuilder.com:80';
var canonHostname = 'cmworker02.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();
};

