/* [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','1378',jdecode('Home'),jdecode(''),'/1378.html','true',[],'',''],
	['PAGE','95365',jdecode('Database+Subscription'),jdecode(''),'/95365.html','true',[],'',''],
	['PAGE','89365',jdecode('Burial+Registers'),jdecode(''),'/89365.html','true',[],'',''],
	['PAGE','4101',jdecode('Churchyards'),jdecode(''),'/4101.html','true',[],'',''],
	['PAGE','28427',jdecode('Christ+Church%2C+Quarry+Bank'),jdecode(''),'/28427.html','true',[],'',''],
	['PAGE','79365',jdecode('Holy+Trinity%2C+Amblecote'),jdecode(''),'/79365.html','true',[],'',''],
	['PAGE','3327',jdecode('St+James%2C+Wollaston'),jdecode(''),'/3327.html','true',[],'',''],
	['PAGE','75965',jdecode('St+Mark%2C+Ocker+Hill'),jdecode(''),'/75965.html','true',[],'',''],
	['PAGE','72265',jdecode('St+Mark%2C+Pensnett'),jdecode(''),'/72265.html','true',[],'',''],
	['PAGE','42754',jdecode('St+Mary%2C+Kingswinford'),jdecode(''),'/42754.html','true',[],'',''],
	['PAGE','34001',jdecode('St+Michael%2C+Brierley+Hill'),jdecode(''),'/34001.html','true',[],'',''],
	['PAGE','18201',jdecode('Important+Bits'),jdecode(''),'/18201.html','true',[],'',''],
	['PAGE','74765',jdecode('Links'),jdecode(''),'/74765.html','true',[],'',''],
	['PAGE','7801',jdecode('Email+Form'),jdecode(''),'/7801.html','true',[],'','']];
var siteelementCount=14;
theSitetree.topTemplateName='Practice';
theSitetree.paletteFamily='D7D5D7';
theSitetree.keyvisualId='6798';
theSitetree.keyvisualName='kv_6798.jpg';
theSitetree.fontsetId='11218';
theSitetree.graphicsetId='12028';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='B2B2B2';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Practice',
				paletteFamily: 	'D7D5D7',
				keyvisualId: 	'6798',
				keyvisualName: 	'kv_6798.jpg',
				fontsetId: 		'11218',
				graphicsetId: 	'12028',
				contentColor: 	'000000',
				contentBGColor: 'B2B2B2',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1378',
internalId:  '',
customField: '20100507-215202'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '89365',
internalId:  '',
customField: '20100424-225103'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '95365',
internalId:  '',
customField: '20100507-221301'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3327',
internalId:  '',
customField: '20100220-204540'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '79365',
internalId:  '',
customField: '20100220-204437'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '74765',
internalId:  '',
customField: '20100220-204951'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4101',
internalId:  '',
customField: '20100220-204250'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '72265',
internalId:  '',
customField: '20100220-204647'
};
webappMappings['7008']=webappMappings['7008-3435']={
webappId:    '7008',
documentId:  '7801',
internalId:  '3435',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7801',
internalId:  '',
customField: '20100220-205001'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '75965',
internalId:  '',
customField: '20100220-204609'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18201',
internalId:  '',
customField: '20100220-204941'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28427',
internalId:  '',
customField: '20100220-204310'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1378',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34001',
internalId:  '',
customField: '20100220-204900'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42754',
internalId:  '',
customField: '20100507-221535'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20INER8W';
var companyName   = 'Black+Country+Churchyards';
var htmlTitle	  = 'Black+Country+Churchyards';
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();
};
