/* [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','5301',jdecode('Home'),jdecode(''),'/5301.html','true',[],'',''],
	['PAGE','15701',jdecode('What+we+do'),jdecode(''),'/15701.html','true',[],'',''],
	['PAGE','5378',jdecode('Training+courses'),jdecode(''),'/5378.html','true',[],'',''],
	['PAGE','5430',jdecode('Special+projects'),jdecode(''),'/5430.html','true',[],'',''],
	['PAGE','5352',jdecode('latest+news'),jdecode(''),'/5352.html','true',[],'',''],
	['PAGE','5482',jdecode('contact+us'),jdecode(''),'/5482.html','true',[],'',''],
	['PAGE','5456',jdecode('Information'),jdecode(''),'/5456.html','true',[],'',''],
	['PAGE','5404',jdecode('Partners'),jdecode(''),'/5404.html','true',[],'',''],
	['PAGE','9801',jdecode('Summer+Raffle'),jdecode(''),'/9801.html','true',[],'',''],
	['PAGE','9827',jdecode('Photos+at+Events'),jdecode(''),'/9827.html','true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Aeskulap';
theSitetree.paletteFamily='C00405';
theSitetree.keyvisualId='2494';
theSitetree.keyvisualName='arzt.jpg';
theSitetree.fontsetId='433';
theSitetree.graphicsetId='487';
theSitetree.contentColor='000066';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Aeskulap',
				paletteFamily: 	'C00405',
				keyvisualId: 	'2494',
				keyvisualName: 	'arzt.jpg',
				fontsetId: 		'433',
				graphicsetId: 	'487',
				contentColor: 	'000066',
				contentBGColor: 'FFFFFF',
				a_color: 		'FFFFFF',
				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:     'true'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-2359']={
webappId:    '7008',
documentId:  '5482',
internalId:  '2359',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5301',
internalId:  '',
customField: '20100606-115539'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5352',
internalId:  '',
customField: '20100606-114624'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5482',
internalId:  '',
customField: '20080902-154329'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5378',
internalId:  '',
customField: '20100606-113001'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9801',
internalId:  '',
customField: '20081017-224448'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5430',
internalId:  '',
customField: '20100606-113723'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5456',
internalId:  '',
customField: '20080908-172129'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5404',
internalId:  '',
customField: '20100302-123550'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9827',
internalId:  '',
customField: '20100606-120100'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5301',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15701',
internalId:  '',
customField: '20091024-134436'
};
webappMappings['1501']=webappMappings['1501-7389984']={
webappId:    '1501',
documentId:  '5301',
internalId:  '7389984',
customField: '1501'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20INE5VR';
var companyName   = 'Belvoir+First+Aid+-+Reg+Charity+1122209';
var htmlTitle	  = 'Belvoir+First+Aid+-+event+medical+services+in+the+Vale+of+Belvoir+-+Charity+number+1122209';
var metaKeywords  = 'Event+medical%2C+First+aid%2C+Vale+of+belvoir%2C+leicestershire%2C+CPR%2C+medical%2C+charity%2C+Stathern%2C+Harby%2C+melton+Mowbray%2C+Eastwell%2C+Bottesford%2C+Long+Clawson%2C+Ambulance%2C+training%2C+Belvoir%2C+Belvoirfirstaid%2C+Eastwell%2C+Eaton%2C+LAngar%2C+bottesford%2C+long+clawson%2C+10k%2C+Nottingham%2C+leicester%2C+grantham%2C';
var metaContents  = 'Belvoir+First+Aid+is+a+registered+charity+undertaking+event+medical+services%2C+and+first+aid+training%2C+in+the+Vale+of+Belvoir+and+surrounding+areas.';
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();
};
