/* [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','6001',jdecode('Home'),jdecode(''),'/6001.html','true',[],''],
	['PAGE','7522',jdecode('Senior+Pastor'),jdecode(''),'/7522.html','true',[],''],
	['PAGE','7501',jdecode('Pastor'),jdecode(''),'/7501.html','true',[],''],
	['PAGE','31101',jdecode('Prayer+Request'),jdecode(''),'/31101.html','true',[],''],
	['PAGE','44623',jdecode('Events'),jdecode(''),'/44623.html','true',[],''],
	['PAGE','27501',jdecode('H.O.P.E.'),jdecode(''),'/27501.html','true',[],''],
	['PAGE','8701',jdecode('Ministries'),jdecode(''),'/8701/index.html','true',[ 
		['PAGE','27522',jdecode('Ignite+Student+Ministry'),jdecode(''),'/8701/27522.html','true',[],''],
		['PAGE','27543',jdecode('Young+Life'),jdecode(''),'/8701/27543.html','true',[],''],
		['PAGE','27564',jdecode('Beacons+%28Seniors+Group%29'),jdecode(''),'/8701/27564.html','true',[],''],
		['PAGE','27585',jdecode('Men+Of+Iron'),jdecode(''),'/8701/27585.html','true',[],''],
		['PAGE','27606',jdecode('L.I.F.T.+%28Ladies+Ministry%29'),jdecode(''),'/8701/27606.html','true',[],''],
		['PAGE','27627',jdecode('Sunday+School'),jdecode(''),'/8701/27627.html','true',[],''],
		['PAGE','27648',jdecode('Kid%26%23x27%3Bs+Church'),jdecode(''),'/8701/27648.html','true',[],'']
	],''],
	['PAGE','7564',jdecode('About+Us'),jdecode(''),'/7564.html','true',[],''],
	['PAGE','7585',jdecode('Contact+Us'),jdecode(''),'/7585.html','true',[],''],
	['PAGE','30501',jdecode('Guest+Form'),jdecode(''),'/30501.html','true',[],'']];
var siteelementCount=17;
theSitetree.topTemplateName='Movement';
theSitetree.paletteFamily='333F65';
theSitetree.keyvisualId='1819';
theSitetree.keyvisualName='kv_dummy.jpg';
theSitetree.fontsetId='289';
theSitetree.graphicsetId='355';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='333F65';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Movement',
				paletteFamily: 	'333F65',
				keyvisualId: 	'1819',
				keyvisualName: 	'kv_dummy.jpg',
				fontsetId: 		'289',
				graphicsetId: 	'355',
				contentColor: 	'FFFFFF',
				contentBGColor: '333F65',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'333F65',
				b_color: 		'040507',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6001',
internalId:  '',
customField: '20090402-225448'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7522',
internalId:  '',
customField: '20090401-010802'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7501',
internalId:  '',
customField: '20090401-011112'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27522',
internalId:  '',
customField: '20090401-022834'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8701',
internalId:  '',
customField: '20090401-014354'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7564',
internalId:  '',
customField: '20081101-140806'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7585',
internalId:  '',
customField: '20081031-184842'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '6001',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '7522',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '7501',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27501',
internalId:  '',
customField: '20081229-231731'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '8701',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '7564',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '44623',
internalId:  '',
customField: '20090405-235233'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '7585',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '6001',
internalId:  '1006',
customField: '1006'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '7585',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:true;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27543',
internalId:  '',
customField: '20081031-075911'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27564',
internalId:  '',
customField: '20081031-075847'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27585',
internalId:  '',
customField: '20090401-022338'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27606',
internalId:  '',
customField: '20090401-022442'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27627',
internalId:  '',
customField: '20081228-234935'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27648',
internalId:  '',
customField: '20081228-234002'
};
webappMappings['7008']=webappMappings['7008-10116']={
webappId:    '7008',
documentId:  '30501',
internalId:  '10116',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30501',
internalId:  '',
customField: '20081031-030954'
};
webappMappings['7008']=webappMappings['7008-10118']={
webappId:    '7008',
documentId:  '31101',
internalId:  '10118',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31101',
internalId:  '',
customField: '20081102-151012'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0IN241C';
var companyName   = 'Your+Beacon+Of+HOPE.';
var htmlTitle	  = 'The+Lighthouse+Church+-+Your+Beacon+Of+Hope+-+Breckenridge%2C+TX';
var metaKeywords  = 'Apostolic%3B+Pentecostal%3B+Spirit+Filled%3B+Breckenridge%3B+Breckenridge+TX%3B+Church%3B+Pentecostal+Church%3B+Apostolic+Church%3B+Church+in+Breckenridge%3B+';
var metaContents  = 'A+Spirit+Filled+Pentecostal+Church+In+Breckenridge%2C+TX.+An+Apostolic+Church.';
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();
};

