/* [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','1401',jdecode('Home'),jdecode(''),'/1401.html','true',[],'',''],
	['PAGE','1452',jdecode('About+Us'),jdecode(''),'/1452/index.html','true',[ 
		['PAGE','1473',jdecode('Our+Fellowship'),jdecode(''),'/1452/1473.html','true',[],'',''],
		['PAGE','1494',jdecode('Our+Ministry+Team'),jdecode(''),'/1452/1494.html','true',[],'',''],
		['PAGE','1515',jdecode('Our+Mission+Statement'),jdecode(''),'/1452/1515.html','true',[],'',''],
		['PAGE','1536',jdecode('Our+Halls'),jdecode(''),'/1452/1536.html','true',[],'','']
	],'',''],
	['PAGE','61201',jdecode('Church+Services'),jdecode(''),'/61201.html','true',[],'',''],
	['PAGE','1662',jdecode('Ministry+Message'),jdecode(''),'/1662.html','true',[],'',''],
	['PAGE','63501',jdecode('Weekly+Events'),jdecode(''),'/63501.html','true',[],'',''],
	['PAGE','1578',jdecode('Church++Events'),jdecode(''),'/1578.html','true',[],'',''],
	['PAGE','63001',jdecode('Community+Events'),jdecode(''),'/63001.html','true',[],'',''],
	['PAGE','64601',jdecode('Blood+Doning'),jdecode(''),'/64601.html','true',[],'',''],
	['PAGE','1683',jdecode('Youth+Activities'),jdecode(''),'/1683.html','true',[],'',''],
	['PAGE','1725',jdecode('Personal+Favourites'),jdecode(''),'/1725.html','true',[],'',''],
	['PAGE','12201',jdecode('+Photo+Gallery'),jdecode(''),'/12201.html','true',[],'',''],
	['PAGE','1767',jdecode('Links'),jdecode(''),'/1767.html','true',[],'',''],
	['PAGE','1788',jdecode('Contacting+Us'),jdecode(''),'/1788.html','true',[],'',''],
	['PAGE','18606',jdecode('Guestbook'),jdecode(''),'/18606/index.html','true',[ 
		['PAGE','18601',jdecode('Read+Guestbook'),jdecode(''),'/18606/18601.html','false',[],'','']
	],'','']];
var siteelementCount=19;
theSitetree.topTemplateName='Care';
theSitetree.paletteFamily='993333';
theSitetree.keyvisualId='16';
theSitetree.keyvisualName='verlegener_junge.jpg';
theSitetree.fontsetId='22';
theSitetree.graphicsetId='14';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Care',
				paletteFamily: 	'993333',
				keyvisualId: 	'16',
				keyvisualName: 	'verlegener_junge.jpg',
				fontsetId: 		'22',
				graphicsetId: 	'14',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				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['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1401',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-975776']={
webappId:    '1501',
documentId:  '1401',
internalId:  '975776',
customField: '1501'
};
webappMappings['7008']=webappMappings['7008-691']={
webappId:    '7008',
documentId:  '1788',
internalId:  '691',
customField: 'language:en;country:GB;'
};
webappMappings['7060']=webappMappings['7060-7709ea33ebaff1be962014fe87f96046']={
webappId:    '7060',
documentId:  '12201',
internalId:  '7709ea33ebaff1be962014fe87f96046',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1401',
internalId:  '',
customField: '20100214-180628'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1683',
internalId:  '',
customField: '20090517-170348'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1662',
internalId:  '',
customField: '20100120-193232'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1578',
internalId:  '',
customField: '20100214-181000'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '61201',
internalId:  '',
customField: '20100301-111425'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1788',
internalId:  '',
customField: '20090112-125643'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1767',
internalId:  '',
customField: '20070304-185046'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1452',
internalId:  '',
customField: '20091213-160009'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1473',
internalId:  '',
customField: '20091213-160105'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1494',
internalId:  '',
customField: '20091206-121506'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1515',
internalId:  '',
customField: '20070921-204307'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1536',
internalId:  '',
customField: '20091213-160339'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12201',
internalId:  '',
customField: '20070304-193556'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '64601',
internalId:  '',
customField: '20091213-162439'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1725',
internalId:  '',
customField: '20091022-162751'
};
webappMappings['1002']=webappMappings['1002-18606anbt10inxvwt']={
webappId:    '1002',
documentId:  '18606',
internalId:  '18606anbt10inxvwt',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18606',
internalId:  '',
customField: '20070920-165343'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '63001',
internalId:  '',
customField: '20100222-161942'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '63501',
internalId:  '',
customField: '20100105-212018'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18601',
internalId:  '',
customField: '20070920-165343'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10INXVWT';
var companyName   = 'WARLINGHAM+METHODIST+CHURCH';
var htmlTitle	  = 'Warlingham+Methodist+Church+%7E+community+relevant+information+pages';
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();
};
