/* [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','6501',jdecode('Home'),jdecode(''),'/6501.html','true',[],''],
	['PAGE','6552',jdecode('About+Us'),jdecode(''),'/6552.html','true',[],''],
	['PAGE','6573',jdecode('Contact'),jdecode(''),'/6573.html','true',[],''],
	['PAGE','25240',jdecode('Location'),jdecode(''),'/25240.html','true',[],''],
	['PAGE','10593',jdecode('Calendar+Of+Events'),jdecode(''),'/10593.html','true',[],''],
	['PAGE','27019',jdecode('Snow+Closing+Info'),jdecode(''),'/27019.html','true',[],''],
	['PAGE','24219',jdecode('Past+Months+Calander'),jdecode(''),'/24219.html','true',[],''],
	['PAGE','24919',jdecode('Fall+Fling+Information'),jdecode(''),'/24919.html','true',[],''],
	['PAGE','15014',jdecode('Annual+Church+Picnic'),jdecode(''),'/15014.html','false',[],''],
	['PAGE','9893',jdecode('Steak+Dinner+Fundraiser'),jdecode(''),'/9893.html','true',[],''],
	['PAGE','15793',jdecode('Pictures'),jdecode(''),'/15793.html','true',[],''],
	['PAGE','20719',jdecode('VBS%2F+Picnic+Pictures'),jdecode(''),'/20719.html','true',[],''],
	['PAGE','31819',jdecode('Presbytery+of+the+James+Site'),jdecode(''),'/31819.html','true',[],''],
	['PAGE','32819',jdecode('Presbyterian+Church+USA+Site'),jdecode(''),'/32819.html','true',[],'']];
var siteelementCount=14;
theSitetree.topTemplateName='Care';
theSitetree.paletteFamily='993333';
theSitetree.keyvisualId='207';
theSitetree.keyvisualName='apotheker.jpg';
theSitetree.fontsetId='22';
theSitetree.graphicsetId='14';
theSitetree.contentColor='000066';
theSitetree.contentBGColor='FFFFFF';
var theTemplate={
				name: 			'Care',
				paletteFamily: 	'993333',
				keyvisualId: 	'207',
				keyvisualName: 	'apotheker.jpg',
				fontsetId: 		'22',
				graphicsetId: 	'14',
				contentColor: 	'000066',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'993333',
				b_color: 		'FFFFCC',
				c_color: 		'000000',
				d_color: 		'6A8493',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7060']=webappMappings['7060-d28259523830576aac551d8192813956']={
webappId:    '7060',
documentId:  '6552',
internalId:  'd28259523830576aac551d8192813956',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6501',
internalId:  '',
customField: '20090723-121438'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6552',
internalId:  '',
customField: '20100113-191944'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6573',
internalId:  '',
customField: '20090822-175009'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '6501',
internalId:  '1006',
customField: '1006'
};
webappMappings['5003']=webappMappings['5003-tid:1;pid:WSCSYSSSSLYTC24M']={
webappId:    '5003',
documentId:  '6501',
internalId:  'tid:1;pid:WSCSYSSSSLYTC24M',
customField: 'en:US::;language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9893',
internalId:  '',
customField: '20090628-210610'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10593',
internalId:  '',
customField: '20100206-152431'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24919',
internalId:  '',
customField: '20091008-161423'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20719',
internalId:  '',
customField: '20090822-174622'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24219',
internalId:  '',
customField: '20100204-121013'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15014',
internalId:  '',
customField: '20090806-130451'
};
webappMappings['7060']=webappMappings['7060-9ddbad303257a54c4e2e37f5aa58d79b']={
webappId:    '7060',
documentId:  '15793',
internalId:  '9ddbad303257a54c4e2e37f5aa58d79b',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15793',
internalId:  '',
customField: '20090723-110807'
};
webappMappings['7060']=webappMappings['7060-d7b5d525d784608ea3accecc3197c3d2']={
webappId:    '7060',
documentId:  '20719',
internalId:  'd7b5d525d784608ea3accecc3197c3d2',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27019',
internalId:  '',
customField: '20100206-154236'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '25240',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:true;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25240',
internalId:  '',
customField: '20091008-152742'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31819',
internalId:  '',
customField: '20100206-162316'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32819',
internalId:  '',
customField: '20100206-164205'
};
var canonHostname = 'wsc-worker02.chi.us.siteprotect.com';
var accountId     = 'AHW050INL5NQ';
var companyName   = 'Salem+Presbyterian+Church+-+Studley%2C+VA+23162';
var htmlTitle	  = '';
var metaKeywords  = 'SalemPc%2C+Salem+Presbyterian+Church%2C+Studley%2C+Studley+Virginia%2C+Mechanicsville%2C+Presbytery+of+the+James%2C+Presbyterian%2C+Home%2C+About+Us%2C+Contact+information';
var metaContents  = 'Salem+Presbyterian+church+is+a+smaller+historic+church+located+in+Studley+Va+in+the+heart+of+Hanover+County.+Founded+in+1829+we+are+a+church+where+you+ad+your+family+are+not+just+a+number.+Join+is+each+Sunday+at+11%3A00+am+for+worship+with+Biblical+based+preaching+and+teaching.';
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();
};
