/* [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','1377',jdecode('Home'),jdecode(''),'/1377.html','true',[],'',''],
	['PAGE','24101',jdecode('Contact'),jdecode(''),'/24101.html','true',[],'',''],
	['PAGE','93723',jdecode('Ministries+and+Missions'),jdecode(''),'/93723.html','true',[],'',''],
	['PAGE','110534',jdecode('News'),jdecode(''),'/110534.html','true',[],'',''],
	['PAGE','3501',jdecode('Pastor%26%23x27%3Bs+Message'),jdecode(''),'/3501.html','true',[],'',''],
	['PAGE','5901',jdecode('Purpose'),jdecode(''),'/5901.html','true',[],'',''],
	['PAGE','53923',jdecode('Sermons'),jdecode(''),'/53923.html','true',[],'',''],
	['PAGE','9901',jdecode('Staff'),jdecode(''),'/9901.html','true',[],'',''],
	['PAGE','107023',jdecode('Carpenters+for+Christ'),jdecode(''),'/107023.html','false',[],'',''],
	['PAGE','2301',jdecode('Children'),jdecode(''),'/2301.html','false',[],'',''],
	['PAGE','10301',jdecode('Men%26%23x27%3Bs+Ministry'),jdecode(''),'/10301.html','false',[],'',''],
	['PAGE','13801',jdecode('News+Link+Page'),jdecode(''),'/13801.html','false',[],'',''],
	['PAGE','90723',jdecode('Search'),jdecode(''),'/90723.html','false',[],'',''],
	['PAGE','83123',jdecode('Senior+Adults'),jdecode(''),'/83123.html','false',[],'',''],
	['PAGE','5501',jdecode('Students'),jdecode(''),'/5501.html','false',[],'',''],
	['PAGE','86323',jdecode('Schedule'),jdecode(''),'/86323.html','false',[],'',''],
	['PAGE','65923',jdecode('Women%26%23x27%3Bs+Ministry'),jdecode(''),'/65923.html','false',[],'',''],
	['PAGE','85123',jdecode('Worship'),jdecode(''),'/85123.html','false',[],'',''],
	['PAGE','142934',jdecode('Michael%26%23x27%3Bs+Blog'),jdecode(''),'/142934.html','false',[],'',''],
	['PAGE','180248',jdecode('VBS+2010'),jdecode(''),'/180248.html','true',[],'','']];
var siteelementCount=20;
theSitetree.topTemplateName='Stylus';
theSitetree.paletteFamily='B0CBD6';
theSitetree.keyvisualId='2054';
theSitetree.keyvisualName='blanko.jpg';
theSitetree.fontsetId='328';
theSitetree.graphicsetId='383';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Stylus',
				paletteFamily: 	'B0CBD6',
				keyvisualId: 	'2054',
				keyvisualName: 	'blanko.jpg',
				fontsetId: 		'328',
				graphicsetId: 	'383',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'B0CBD6',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1377',
internalId:  '',
customField: '20100810-232605'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2301',
internalId:  '',
customField: '20090530-215503'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3501',
internalId:  '',
customField: '20090610-234802'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5501',
internalId:  '',
customField: '20090530-211601'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5901',
internalId:  '',
customField: '20100810-211431'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9901',
internalId:  '',
customField: '20091209-221617'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10301',
internalId:  '',
customField: '20100817-213728'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '110534',
internalId:  '',
customField: '20100707-223911'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '83123',
internalId:  '',
customField: '20100127-230052'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13801',
internalId:  '',
customField: '20090131-233347'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '24101',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:true;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24101',
internalId:  '',
customField: '20100127-225014'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '53923',
internalId:  '',
customField: '20100810-214308'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '65923',
internalId:  '',
customField: '20090608-101908'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '85123',
internalId:  '',
customField: '20090608-203305'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '86323',
internalId:  '',
customField: '20090608-094749'
};
webappMappings['8002']=webappMappings['8002-search']={
webappId:    '8002',
documentId:  '90723',
internalId:  'search',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '90723',
internalId:  '',
customField: '20090603-210821'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '93723',
internalId:  '',
customField: '20090628-220114'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '107023',
internalId:  '',
customField: '20090627-121223'
};
webappMappings['7050']=webappMappings['7050-8220']={
webappId:    '7050',
documentId:  '142934',
internalId:  '8220',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '142934',
internalId:  '',
customField: '20090910-235036'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '180248',
internalId:  '',
customField: '20100810-231753'
};
var canonHostname = 'cmworker03.yourhostingaccount.com';
var accountId     = 'AENDU0INEFDH';
var companyName   = 'First+Baptist+Church%2C+Piedmont+AL';
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();
};
