/* [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','401',jdecode('Home'),jdecode(''),'/401.html','true',[],''],
	['PAGE','92201',jdecode('You+Tube+Video'),jdecode(''),'/92201.html','true',[],''],
	['PAGE','10622',jdecode('Office+Hours'),jdecode(''),'/10622.html','true',[],''],
	['PAGE','29401',jdecode('Pastor'),jdecode(''),'/29401.html','true',[],''],
	['PAGE','473',jdecode('Faith+Statement+'),jdecode(''),'/473.html','true',[],''],
	['PAGE','30301',jdecode('Thoughts'),jdecode(''),'/30301.html','true',[],''],
	['PAGE','32601',jdecode('Sermon+7-26'),jdecode(''),'/32601.html','true',[],''],
	['PAGE','30701',jdecode('Sermon+7-19'),jdecode(''),'/30701.html','true',[],''],
	['PAGE','494',jdecode('Sermon+7-12'),jdecode(''),'/494.html','true',[],''],
	['PAGE','34601',jdecode('Sermon+7-5'),jdecode(''),'/34601.html','true',[],''],
	['PAGE','536',jdecode('Meal+Program'),jdecode(''),'/536.html','true',[],''],
	['PAGE','9922',jdecode('Missionaries+'),jdecode(''),'/9922.html','true',[],''],
	['PAGE','9943',jdecode('Bible+Study'),jdecode(''),'/9943.html','true',[],''],
	['PAGE','10601',jdecode('Sunday+School'),jdecode(''),'/10601.html','true',[],''],
	['PAGE','9964',jdecode('Ladies%26%23x27%3B+Circle'),jdecode(''),'/9964.html','true',[],''],
	['PAGE','10301',jdecode('Calendar'),jdecode(''),'/10301.html','true',[],''],
	['PAGE','82701',jdecode('Prayer+Requests'),jdecode(''),'/82701/index.html','true',[ 
		['PAGE','86901',jdecode('Comments+%28follow+up+page%29'),jdecode(''),'/82701/86901.html','false',[],'']
	],''],
	['PAGE','87201',jdecode('Comments'),jdecode(''),'/87201/index.html','true',[ 
		['PAGE','87601',jdecode('Comments+%28follow+up+page%29'),jdecode(''),'/87201/87601.html','false',[],'']
	],'']];
var siteelementCount=20;
theSitetree.topTemplateName='Akropolis';
theSitetree.paletteFamily='5E5E5E';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10553';
theSitetree.graphicsetId='10448';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='5e5e5e';
var theTemplate={
				name: 			'Akropolis',
				paletteFamily: 	'5E5E5E',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10553',
				graphicsetId: 	'10448',
				contentColor: 	'FFFFFF',
				contentBGColor: '5e5e5e',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'5E5E5E',
				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['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['1001']=webappMappings['1001-ahw050inx2675b8227bb1cfb942d']={
webappId:    '1001',
documentId:  '86901',
internalId:  'ahw050inx2675b8227bb1cfb942d',
customField: 'followUp'
};
webappMappings['1001']=webappMappings['1001-ahw050inx2675b8227bb1cfb942d']={
webappId:    '1001',
documentId:  '82701',
internalId:  'ahw050inx2675b8227bb1cfb942d',
customField: ''
};
webappMappings['1001']=webappMappings['1001-ahw050inx2674745524e5bd8a69c']={
webappId:    '1001',
documentId:  '87201',
internalId:  'ahw050inx2674745524e5bd8a69c',
customField: ''
};
webappMappings['1001']=webappMappings['1001-ahw050inx2674745524e5bd8a69c']={
webappId:    '1001',
documentId:  '87601',
internalId:  'ahw050inx2674745524e5bd8a69c',
customField: 'followUp'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20090721-193002'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30701',
internalId:  '',
customField: '20090721-190336'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '494',
internalId:  '',
customField: '20090721-190803'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34601',
internalId:  '',
customField: '20090721-191645'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32601',
internalId:  '',
customField: '20090721-191947'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '92201',
internalId:  '',
customField: '20080403-102152'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10622',
internalId:  '',
customField: '20080223-165049'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29401',
internalId:  '',
customField: '20081030-230323'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '473',
internalId:  '',
customField: '20070321-092636'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30301',
internalId:  '',
customField: '20090721-192806'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '536',
internalId:  '',
customField: '20070403-171904'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9922',
internalId:  '',
customField: '20080417-211433'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9943',
internalId:  '',
customField: '20080525-110114'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10601',
internalId:  '',
customField: '20080525-110230'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9964',
internalId:  '',
customField: '20080325-193305'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10301',
internalId:  '',
customField: '20090721-193824'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '82701',
internalId:  '',
customField: '20080223-165248'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '86901',
internalId:  '',
customField: '20080220-213641'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '87201',
internalId:  '',
customField: '20080223-165336'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '87601',
internalId:  '',
customField: '20080223-165203'
};
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050INX267';
var companyName   = 'First+United+Presbyterian+Church+of+Elyria%2C+Oh';
var htmlTitle	  = 'First+United+Presbyterian+Church+of+Elyria%2C+Ohio+-+visitors+welcome';
var metaKeywords  = 'presbyterian%2C++reformed%2C++protestant%2C++mission%2C++Elyria%2C++ohio%2C++lorain+county%2C+++reformed+church%2C++Jesus%2C++Bible%2C+Study%2C+children';
var metaContents  = 'First+United+Presbyterian+Church+of+Elyria%2C++Presbyterian+Church%2C++Presbyterian+USA%2C++Bible+Study%2C++Lorain+County%2C++Rick+Stein%2C++Childrens+Time%2C+Churches+Elyria+Ohio%2C+Protestant+churches+Elyria+Ohio%2C+Jesus+Christ%2C+reformed+church%2C++Elyria+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();
};
