/* [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','10701',jdecode('Home'),jdecode(''), jdecode('%2F10701.html'), 'true',[],'',''],
	['PAGE','55901',jdecode('Become+a+Christian%21'),jdecode(''), jdecode('%2F55901.html'), 'true',[],'',''],
	['PAGE','10752',jdecode('About+Us'),jdecode(''), jdecode('%2F10752%2Findex.html'), 'true',[ 
		['PAGE','45301',jdecode('Constitution+and+ByLaws'),jdecode(''), jdecode('%2F10752%2F45301.html'), 'true',[],'',''],
		['PAGE','18201',jdecode('Map+of+McHenry'),jdecode(''), jdecode('%2F10752%2F18201.html'), 'true',[],'','']
	],'',''],
	['PAGE','10773',jdecode('Church+Staff'),jdecode(''), jdecode('%2F10773%2Findex.html'), 'true',[ 
		['PAGE','96401',jdecode('Pastor%26%23x27%3Bs+Blog'),jdecode(''), jdecode('%2F10773%2F96401.html'), 'true',[],'','']
	],'',''],
	['PAGE','10794',jdecode('Ministries'),jdecode(''), jdecode('%2F10794.html'), 'true',[],'',''],
	['PAGE','95601',jdecode('Ask%2C+Seek%2C+and+Knock...'),jdecode(''), jdecode('%2F95601.html'), 'true',[],'',''],
	['PAGE','98301',jdecode('MEDIA+MINISTRY'),jdecode(''), jdecode('%2F98301%2Findex.html'), 'true',[ 
		['PAGE','95001',jdecode('Sermon+Archive'),jdecode(''), jdecode('%2F98301%2F95001.html'), 'false',[],'','']
	],'',''],
	['PAGE','87601',jdecode('CSFP+Program'),jdecode(''), jdecode('%2F87601%2Findex.html'), 'true',[ 
		['PAGE','62301',jdecode('Youth+Events'),jdecode(''), jdecode('%2F87601%2F62301.html'), 'true',[],'','']
	],'',''],
	['PAGE','17701',jdecode('VBS'),jdecode(''), jdecode('%2F17701%2Findex.html'), 'true',[ 
		['PAGE','37601',jdecode('Pre-Register+for+VBS%21'),jdecode(''), jdecode('%2F17701%2F37601.html'), 'false',[],'',''],
		['PAGE','46201',jdecode('VBS+Photos'),jdecode(''), jdecode('%2F17701%2F46201.html'), 'true',[],'','']
	],'',''],
	['PAGE','10815',jdecode('News+and+Calendars'),jdecode(''), jdecode('%2F10815.html'), 'true',[],'',''],
	['PAGE','65201',jdecode('Church+Directory+2011'),jdecode(''), jdecode('%2F65201.html'), 'false',[],'',''],
	['PAGE','10836',jdecode('Contact+Us'),jdecode(''), jdecode('%2F10836.html'), 'true',[],'',''],
	['PAGE','13601',jdecode('Prayer+Requests'),jdecode(''), jdecode('%2F13601.html'), 'true',[],'',''],
	['PAGE','10857',jdecode('Guest+Book'),jdecode(''), jdecode('%2F10857.html'), 'true',[],'','']];
var siteelementCount=21;
theSitetree.topTemplateName='Undulate';
theSitetree.paletteFamily='413D42';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='33116';
theSitetree.graphicsetId='14071';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='413D42';
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: 			'Undulate',
				paletteFamily: 	'413D42',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'33116',
				graphicsetId: 	'14071',
				contentColor: 	'FFFFFF',
				contentBGColor: '413D42',
				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:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10701',
internalId:  '',
customField: '20110729-133320'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10752',
internalId:  '',
customField: '20091026-085303'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10773',
internalId:  '',
customField: '20111111-110302'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10794',
internalId:  '',
customField: '20110128-152133'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10815',
internalId:  '',
customField: '20120209-123307'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10836',
internalId:  '',
customField: '20091026-094843'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10857',
internalId:  '',
customField: '20091020-185444'
};
webappMappings['7008']=webappMappings['7008-22084']={
webappId:    '7008',
documentId:  '13601',
internalId:  '22084',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13601',
internalId:  '',
customField: '20100822-161128'
};
webappMappings['1002']=webappMappings['1002-10857aendu0invdz2']={
webappId:    '1002',
documentId:  '10857',
internalId:  '10857aendu0invdz2',
customField: 'icq=false'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '10701',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-23674250']={
webappId:    '1501',
documentId:  '10701',
internalId:  '23674250',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37601',
internalId:  '',
customField: '20110603-164254'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17701',
internalId:  '',
customField: '20110722-135533'
};
webappMappings['7008']=webappMappings['7008-28259']={
webappId:    '7008',
documentId:  '37601',
internalId:  '28259',
customField: 'language:en;country:US;'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '18201',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:true;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18201',
internalId:  '',
customField: '20091026-085438'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45301',
internalId:  '',
customField: '20100816-180114'
};
webappMappings['1003']=webappMappings['1003-aendu0invdz212984593cf6']={
webappId:    '1003',
documentId:  '95601',
internalId:  'aendu0invdz212984593cf6',
customField: 'en:US'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '95001',
internalId:  '',
customField: '20110925-204444'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46201',
internalId:  '',
customField: '20110730-112610'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '55901',
internalId:  '',
customField: '20100829-184121'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '62301',
internalId:  '',
customField: '20101011-215703'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '65201',
internalId:  '',
customField: '20110403-154818'
};
webappMappings['7008']=webappMappings['7008-4299']={
webappId:    '7008',
documentId:  '87601',
internalId:  '4299',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '87601',
internalId:  '',
customField: '20110804-160526'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '95601',
internalId:  '',
customField: '20110927-223310'
};
webappMappings['7050']=webappMappings['7050-16974']={
webappId:    '7050',
documentId:  '96401',
internalId:  '16974',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '96401',
internalId:  '',
customField: '20110930-125346'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '98301',
internalId:  '',
customField: '20111216-114410'
};
var webAppHostname = 'cgiwsc.enhancedsitebuilder.com:80';
var canonHostname = 'cmworker01.yourhostingaccount.com';
var accountId     = 'AENDU0INVDZ2';
var companyName   = 'McHENRY+FIRST+BAPTIST+CHURCH+++++++++++++++++++Helping+you+know+Jesus%21';
var htmlTitle	  = 'McHenry+First+Baptist+Church';
var metaKeywords  = 'McHenry+FBC%2C+McHenry+First+Baptist+Church%2C+Wayne+Flurry%2C+Myra+Hood%2C+Brent+Hickman%2C+Amanda+Hickman%2C+Helen+Donohoe%2C+First+Baptist+McHenry%2C+One+Student+Ministries%2C+McHenry%2C+MS+39561';
var metaContents  = 'McHenry+First+Baptist+Church+McHenry%2C+MS+39561++Southern+Baptist+congregation%2C+established+in+1898.+Located+at+1476+West+McHenry+Road%2C+right+in+the+heart+of+McHenry%2C+in+South+Mississipis+Stone+County.+We+are+less+than+a+mile+from+US+HWY+49.+Our+church+is+an+open+and+loving+church%2C+which+is+growing+in+the+Lord%2C+and+YOU+and+YOUR+ENTIRE+FAMILY+are+welcome+to+come+visit+and+worship+with+us.+If+you+are+seeking+a+church+home%2C+please+spend+time+with+God%2C+seeking+where+He+needs+you+to+serve%2C+and+follow+His+lead.+If+we+can+be+of+any+assistance%2C+please+do+note+hesitate+to+call+on+us%21+God+Bless+You%21';
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();
};

