/* [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','701',jdecode('Home'),jdecode(''),'/701.html','true',[],''],
	['PAGE','13001',jdecode('Worship+Services'),jdecode(''),'/13001.html','true',[],''],
	['PAGE','14601',jdecode('Our+Mission'),jdecode(''),'/14601.html','true',[],''],
	['PAGE','10101',jdecode('About+the+Brighton+UMC'),jdecode(''),'/10101/index.html','true',[ 
		['PAGE','10122',jdecode('The+BUMC+team'),jdecode(''),'/10101/10122.html','true',[],'']
	],''],
	['PAGE','2001',jdecode('Contact+Us'),jdecode(''),'/2001.html','true',[],''],
	['PAGE','752',jdecode('Church+Ministries'),jdecode(''),'/752/index.html','true',[ 
		['PAGE','12501',jdecode('Adult'),jdecode(''),'/752/12501.html','true',[],''],
		['PAGE','22801',jdecode('Youth'),jdecode(''),'/752/22801.html','true',[],''],
		['PAGE','12522',jdecode('UMYF+%28GORF+-+Youth+Group%29'),jdecode(''),'/752/12522.html','true',[],''],
		['PAGE','12543',jdecode('Children'),jdecode(''),'/752/12543.html','true',[],'']
	],''],
	['PAGE','12564',jdecode('Music+Ministry'),jdecode(''),'/12564.html','true',[],''],
	['PAGE','14622',jdecode('UMW+and+Circles'),jdecode(''),'/14622.html','true',[],''],
	['PAGE','21501',jdecode('Homily'),jdecode(''),'/21501.html','true',[],''],
	['PAGE','21201',jdecode('Labryinth'),jdecode(''),'/21201.html','true',[],''],
	['PAGE','10143',jdecode('News'),jdecode(''),'/10143/index.html','true',[ 
		['PAGE','10164',jdecode('Calendar+of+Events'),jdecode(''),'/10143/10164.html','true',[],''],
		['PAGE','12585',jdecode('Broadcaster'),jdecode(''),'/10143/12585.html','true',[],'']
	],''],
	['PAGE','12606',jdecode('Visitors'),jdecode(''),'/12606.html','true',[],''],
	['PAGE','10185',jdecode('Links'),jdecode(''),'/10185.html','true',[],''],
	['PAGE','18406',jdecode('Guestbook'),jdecode(''),'/18406/index.html','true',[ 
		['PAGE','18401',jdecode('Read+Guestbook'),jdecode(''),'/18406/18401.html','false',[],'']
	],'']];
var siteelementCount=22;
theSitetree.topTemplateName='Angkor';
theSitetree.paletteFamily='879ED6';
theSitetree.keyvisualId='6865';
theSitetree.keyvisualName='kv_6865.jpg';
theSitetree.fontsetId='11212';
theSitetree.graphicsetId='12030';
theSitetree.contentColor='354B86';
theSitetree.contentBGColor='94AAE1';
var theTemplate={
				name: 			'Angkor',
				paletteFamily: 	'879ED6',
				keyvisualId: 	'6865',
				keyvisualName: 	'kv_6865.jpg',
				fontsetId: 		'11212',
				graphicsetId: 	'12030',
				contentColor: 	'354B86',
				contentBGColor: '94AAE1',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'94AAE1',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '701',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13001',
internalId:  '',
customField: '20090714-200916'
};
webappMappings['1002']=webappMappings['1002-18406AHW050INXXV8']={
webappId:    '1002',
documentId:  '18406',
internalId:  '18406AHW050INXXV8',
customField: 'icq=false'
};
webappMappings['1501']=webappMappings['1501-78704']={
webappId:    '1501',
documentId:  '701',
internalId:  '78704',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '701',
internalId:  '',
customField: '20090715-184145'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14601',
internalId:  '',
customField: '20090317-195313'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10101',
internalId:  '',
customField: '20090317-195631'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10122',
internalId:  '',
customField: '20090714-201048'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2001',
internalId:  '',
customField: '20090130-200134'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '752',
internalId:  '',
customField: '20070531-231838'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12501',
internalId:  '',
customField: '20090317-200057'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22801',
internalId:  '',
customField: '20080909-145801'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12522',
internalId:  '',
customField: '20090904-152444'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12543',
internalId:  '',
customField: '20090904-152551'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12564',
internalId:  '',
customField: '20090317-200932'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14622',
internalId:  '',
customField: '20090904-152608'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21501',
internalId:  '',
customField: '20090904-155425'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21201',
internalId:  '',
customField: '20090407-193240'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10143',
internalId:  '',
customField: '20090714-202949'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10164',
internalId:  '',
customField: '20090714-203059'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12585',
internalId:  '',
customField: '20090904-155307'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12606',
internalId:  '',
customField: '20090130-213430'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10185',
internalId:  '',
customField: '20090320-202808'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18406',
internalId:  '',
customField: '20090417-173448'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18401',
internalId:  '',
customField: '20070601-213607'
};
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050INXXV8';
var companyName   = 'Brighton+United+Methodist+Church';
var htmlTitle	  = 'Brighton+United+Methodist+Church';
var metaKeywords  = 'Methodist+Church++Brihgton+UMC';
var metaContents  = 'Methodist+Church+of+Brighton++The+Rev+Dr.+Sue.+Pierce++++Brighton+United+Methodist+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();
};
