/* [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(''), jdecode('%2F13.html'), 'true',[],'',''],
	['PAGE','34',jdecode('About+us'),jdecode(''), jdecode('%2F34%2Findex.html'), 'true',[ 
		['PAGE','1380',jdecode('History'),jdecode(''), jdecode('%2F34%2F1380.html'), 'true',[],'',''],
		['PAGE','1389',jdecode('Pastor%26%23x27%3Bs+Page'),jdecode(''), jdecode('%2F34%2F1389.html'), 'true',[],'',''],
		['PAGE','1398',jdecode('What+is+a+Lutheran%3F'),jdecode(''), jdecode('%2F34%2F1398.html'), 'true',[],'',''],
		['PAGE','43',jdecode('Location'),jdecode(''), jdecode('%2F34%2F43.html'), 'true',[],'','']
	],'',''],
	['PAGE','1407',jdecode('Worship'),jdecode(''), jdecode('%2F1407.html'), 'true',[],'',''],
	['PAGE','79',jdecode('Activities'),jdecode(''), jdecode('%2F79.html'), 'true',[],'',''],
	['PAGE','1416',jdecode('Youth'),jdecode(''), jdecode('%2F1416.html'), 'true',[],'',''],
	['PAGE','1425',jdecode('Special+Topics'),jdecode(''), jdecode('%2F1425%2Findex.html'), 'true',[ 
		['PAGE','1434',jdecode('Magic+%26+Faith'),jdecode(''), jdecode('%2F1425%2F1434.html'), 'true',[],'',''],
		['PAGE','1443',jdecode('Angels'),jdecode(''), jdecode('%2F1425%2F1443.html'), 'true',[],'','']
	],'',''],
	['PAGE','88',jdecode('Links'),jdecode(''), jdecode('%2F88.html'), 'true',[],'',''],
	['PAGE','9701',jdecode('Newsletters+%26+Sermons'),jdecode(''), jdecode('%2F9701.html'), 'true',[],'',''],
	['PAGE','9722',jdecode('Pastor+Bob%26%23x27%3Bs+Latvia+Trips'),jdecode(''), jdecode('%2F9722.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 prodDef={
  wl_name: 'grp35-attweb',
  product: 'WSCSYSSSSLY0X9RC'
};
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: '20120125-140117'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9701',
internalId:  '',
customField: '20120202-204528'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34',
internalId:  '',
customField: '20110405-122958'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1380',
internalId:  '',
customField: '20061201-120222'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1389',
internalId:  '',
customField: '20120112-134425'
};
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: '20111111-152956'
};
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: '20110208-200833'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9722',
internalId:  '',
customField: '20110112-124951'
};
var webAppHostname = 'diycgi.cluster.stngva01.us.diy-servers.net:80';
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();
};

