/* [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','4801',jdecode('Home'),jdecode(''), jdecode('%2F4801.html'), 'true',[],'',''],
	['PAGE','55101',jdecode('ADVENT'),jdecode(''), jdecode('%2F55101.html'), 'false',[],'',''],
	['PAGE','67301',jdecode('LENT'),jdecode(''), jdecode('%2F67301.html'), 'true',[],'',''],
	['PAGE','29901',jdecode('What%26%23x27%3Bs+New'),jdecode(''), jdecode('%2F29901.html'), 'true',[],'',''],
	['PAGE','33001',jdecode('Schedule'),jdecode(''), jdecode('%2F33001.html'), 'true',[],'',''],
	['PAGE','4852',jdecode('About+us'),jdecode(''), jdecode('%2F4852%2Findex.html'), 'true',[ 
		['PAGE','64201',jdecode('Newsletters'),jdecode(''), jdecode('%2F4852%2F64201.html'), 'true',[],'',''],
		['PAGE','9101',jdecode('Our+Staff'),jdecode(''), jdecode('%2F4852%2F9101.html'), 'true',[],'','']
	],'',''],
	['PAGE','58201',jdecode('Youth+Ministry'),jdecode(''), jdecode('%2F58201.html'), 'true',[],'',''],
	['PAGE','4936',jdecode('Children%26%23x27%3Bs+Ministry'),jdecode(''), jdecode('%2F4936%2Findex.html'), 'true',[ 
		['PAGE','57201',jdecode('Trunk+or+Treat+2011'),jdecode(''), jdecode('%2F4936%2F57201.html'), 'true',[],'',''],
		['PAGE','48001',jdecode('VBS+2011+Pics'),jdecode(''), jdecode('%2F4936%2F48001.html'), 'true',[],'','']
	],'',''],
	['PAGE','4894',jdecode('Adult+Ministry'),jdecode(''), jdecode('%2F4894%2Findex.html'), 'true',[ 
		['PAGE','45601',jdecode('Adult+Bible+Study'),jdecode(''), jdecode('%2F4894%2F45601.html'), 'true',[],'',''],
		['PAGE','62401',jdecode('Women%26%23x27%3Bs+Retreat'),jdecode(''), jdecode('%2F4894%2F62401.html'), 'true',[],'','']
	],'',''],
	['PAGE','4957',jdecode('Music+Ministry'),jdecode(''), jdecode('%2F4957%2Findex.html'), 'true',[ 
		['PAGE','50401',jdecode('Music+Camp+Pics'),jdecode(''), jdecode('%2F4957%2F50401.html'), 'true',[],'','']
	],'',''],
	['PAGE','4978',jdecode('Community+Ministry'),jdecode(''), jdecode('%2F4978%2Findex.html'), 'true',[ 
		['PAGE','31701',jdecode('Job+Seekers'),jdecode(''), jdecode('%2F4978%2F31701.html'), 'true',[],'',''],
		['PAGE','34901',jdecode('Homework+Assistance'),jdecode(''), jdecode('%2F4978%2F34901.html'), 'true',[],'',''],
		['PAGE','34922',jdecode('Community+Night'),jdecode(''), jdecode('%2F4978%2F34922.html'), 'true',[],'','']
	],'',''],
	['PAGE','4873',jdecode('Missions'),jdecode(''), jdecode('%2F4873.html'), 'true',[],'',''],
	['PAGE','40901',jdecode('VBS+and+Music+Camp'),jdecode(''), jdecode('%2F40901.html'), 'true',[],'','']];
var siteelementCount=23;
theSitetree.topTemplateName='Surround';
theSitetree.paletteFamily='914A94';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10514';
theSitetree.graphicsetId='11134';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='8F3D88';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'easycgi',
  product: 'WSCSYSSSSLY0XRN4'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Surround',
				paletteFamily: 	'914A94',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10514',
				graphicsetId: 	'11134',
				contentColor: 	'FFFFFF',
				contentBGColor: '8F3D88',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'DD7CD6',
				e_color: 		'DD7CD6',
				f_color: 		'DD7CD6',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '62401',
internalId:  '',
customField: '20120118-132556'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4801',
internalId:  '',
customField: '20120114-232139'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4852',
internalId:  '',
customField: '20101209-185635'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4873',
internalId:  '',
customField: '20100818-230041'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4894',
internalId:  '',
customField: '20120110-170757'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '58201',
internalId:  '',
customField: '20120207-171210'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4936',
internalId:  '',
customField: '20111106-150530'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4957',
internalId:  '',
customField: '20110811-032852'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4978',
internalId:  '',
customField: '20120110-171607'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9101',
internalId:  '',
customField: '20110105-152318'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29901',
internalId:  '',
customField: '20120215-014118'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31701',
internalId:  '',
customField: '20110818-184435'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33001',
internalId:  '',
customField: '20120221-011743'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '67301',
internalId:  '',
customField: '20120221-010805'
};
webappMappings['1501']=webappMappings['1501-37389746']={
webappId:    '1501',
documentId:  '4801',
internalId:  '37389746',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34901',
internalId:  '',
customField: '20110818-184914'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34922',
internalId:  '',
customField: '20110529-151137'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '57201',
internalId:  '',
customField: '20111204-004544'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40901',
internalId:  '',
customField: '20120215-001651'
};
webappMappings['7008']=webappMappings['7008-35351']={
webappId:    '7008',
documentId:  '40901',
internalId:  '35351',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45601',
internalId:  '',
customField: '20120221-011941'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4801',
internalId:  '1006',
customField: '1006'
};
webappMappings['7060']=webappMappings['7060-45d0dff4f46b7aa804c885ec56cb86bf']={
webappId:    '7060',
documentId:  '48001',
internalId:  '45d0dff4f46b7aa804c885ec56cb86bf',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '48001',
internalId:  '',
customField: '20110811-014120'
};
webappMappings['7060']=webappMappings['7060-f20d8f05fb507f944135ed4df0232a86']={
webappId:    '7060',
documentId:  '50401',
internalId:  'f20d8f05fb507f944135ed4df0232a86',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50401',
internalId:  '',
customField: '20110811-014337'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '64201',
internalId:  '',
customField: '20120115-000024'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '55101',
internalId:  '',
customField: '20111213-152129'
};
webappMappings['7060']=webappMappings['7060-8fe9149bd742dd01cda8170c6da77e30']={
webappId:    '7060',
documentId:  '57201',
internalId:  '8fe9149bd742dd01cda8170c6da77e30',
customField: 'language:en;country:US;'
};
var webAppHostname = 'cgiwsc.enhancedsitebuilder.com:80';
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0INLTUG';
var companyName   = 'First+United+Methodist+Church+DeSoto';
var htmlTitle	  = 'First+United+Methodist+Church+Desoto+Texas';
var metaKeywords  = 'church+desoto+texas+dallas+methodist+worship+christian';
var metaContents  = 'First+United+Methodist+Church+of+DeSoto%2C+Texas';
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();
};

