/* [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','13',jdecode('Home'),jdecode(''),'/13.html','true',[],'',''],
	['PAGE','34',jdecode('About+us'),jdecode(''),'/34/index.html','true',[ 
		['PAGE','1380',jdecode('History'),jdecode(''),'/34/1380.html','true',[],'',''],
		['PAGE','1389',jdecode('Pastor%26%23x27%3Bs+Page'),jdecode(''),'/34/1389.html','true',[],'',''],
		['PAGE','1398',jdecode('What+is+a+Lutheran%3F'),jdecode(''),'/34/1398.html','true',[],'',''],
		['PAGE','43',jdecode('Location'),jdecode(''),'/34/43.html','true',[],'','']
	],'',''],
	['PAGE','1407',jdecode('Worship+Schedule'),jdecode(''),'/1407.html','true',[],'',''],
	['PAGE','79',jdecode('Activities'),jdecode(''),'/79.html','true',[],'',''],
	['PAGE','1416',jdecode('Youth'),jdecode(''),'/1416.html','true',[],'',''],
	['PAGE','1425',jdecode('Special+Topics'),jdecode(''),'/1425/index.html','true',[ 
		['PAGE','1434',jdecode('Magic+%26+Faith'),jdecode(''),'/1425/1434.html','true',[],'',''],
		['PAGE','1443',jdecode('Angels'),jdecode(''),'/1425/1443.html','true',[],'','']
	],'',''],
	['PAGE','88',jdecode('Links'),jdecode(''),'/88.html','true',[],'',''],
	['PAGE','9701',jdecode('Newsletters+%26+Sermons'),jdecode(''),'/9701.html','true',[],'',''],
	['PAGE','9722',jdecode('Pastor+Bob%26%23x27%3Bs+Latvia+Trips'),jdecode(''),'/9722.html','true',[],'','']];
var siteelementCount=15;
theSitetree.topTemplateName='Surround';
theSitetree.paletteFamily='538345';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10514';
theSitetree.graphicsetId='11136';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='39823E';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Surround',
				paletteFamily: 	'538345',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10514',
				graphicsetId: 	'11136',
				contentColor: 	'FFFFFF',
				contentBGColor: '39823E',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'81D79D',
				e_color: 		'81D79D',
				f_color: 		'81D79D',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '13',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13',
internalId:  '',
customField: '20080604-103729'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9701',
internalId:  '',
customField: '20100227-110949'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34',
internalId:  '',
customField: '20071107-135528'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1380',
internalId:  '',
customField: '20061201-120222'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1389',
internalId:  '',
customField: '20061212-153526'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1398',
internalId:  '',
customField: '20061211-171601'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43',
internalId:  '',
customField: '20070911-085455'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1407',
internalId:  '',
customField: '20061126-153441'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '79',
internalId:  '',
customField: '20070907-111630'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1416',
internalId:  '',
customField: '20061126-163432'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1425',
internalId:  '',
customField: '20080604-103249'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1434',
internalId:  '',
customField: '20080604-105243'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1443',
internalId:  '',
customField: '20061126-171447'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '88',
internalId:  '',
customField: '20091229-183107'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9722',
internalId:  '',
customField: '20100119-125123'
};
var canonHostname = 'diywk02.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10IN2JI0';
var companyName   = 'St.+John%27s+Lutheran+Church';
var htmlTitle	  = 'St.+Johns+Lutheran+Church+Beaver+Dam%2C+Wisconsin';
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();
};
