/* [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','501',jdecode('Home'),jdecode(''),'/501.html','true',[],''],
	['PAGE','552',jdecode('About+Me'),jdecode(''),'/552.html','true',[],''],
	['PAGE','573',jdecode('Psychotherapies'),jdecode(''),'/573.html','true',[],''],
	['PAGE','594',jdecode('Life+Coaching'),jdecode(''),'/594.html','true',[],''],
	['PAGE','6801',jdecode('Is+this+for+you%3F'),jdecode(''),'/6801.html','true',[],''],
	['PAGE','8801',jdecode('Services+for+Schools'),jdecode(''),'/8801.html','true',[],''],
	['PAGE','10201',jdecode('Happiness+in+schools'),jdecode(''),'/10201.html','true',[],''],
	['PAGE','615',jdecode('Costs'),jdecode(''),'/615.html','true',[],''],
	['PAGE','636',jdecode('Contact'),jdecode(''),'/636.html','true',[],''],
	['PAGE','4101',jdecode('Links'),jdecode(''),'/4101.html','true',[],'']];
var siteelementCount=10;
theSitetree.topTemplateName='Livinginamerica';
theSitetree.paletteFamily='A7A664';
theSitetree.keyvisualId='6306';
theSitetree.keyvisualName='kv_6306.jpg';
theSitetree.fontsetId='11154';
theSitetree.graphicsetId='11960';
theSitetree.contentColor='474779';
theSitetree.contentBGColor='E1E0C5';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				name: 			'Livinginamerica',
				paletteFamily: 	'A7A664',
				keyvisualId: 	'6306',
				keyvisualName: 	'kv_6306.jpg',
				fontsetId: 		'11154',
				graphicsetId: 	'11960',
				contentColor: 	'474779',
				contentBGColor: 'E1E0C5',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				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:  '501',
internalId:  '',
customField: '20090916-110621'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '552',
internalId:  '',
customField: '20071002-125301'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '573',
internalId:  '',
customField: '20080716-094043'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '615',
internalId:  '',
customField: '20080716-093857'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '594',
internalId:  '',
customField: '20071008-115156'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '636',
internalId:  '',
customField: '20090513-142129'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4101',
internalId:  '',
customField: '20090226-143913'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '501',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6801',
internalId:  '',
customField: '20090916-113601'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8801',
internalId:  '',
customField: '20090226-143413'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10201',
internalId:  '',
customField: '20090226-144352'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10IN24LM';
var companyName   = 'Local+Lifecoach';
var htmlTitle	  = 'Local+LifeCoaching';
var metaKeywords  = 'Nick+Pronger%2C+Yorkshire%2CShipley%2CSaltaire%2CNabWood%2Clife%2Ccoach%2Clifecoach%2Clife-coach%2C+fitness%2Cpsychotherapy%2Cwellbeing%2Cwell%2Cbeing%2Cmental+health%2C+health%2Cpsychotherapy%2Cpsychotherapist%2Cpsychologist%2Cpsychology%2CLeeds%2CBingley%2CKeighley%2Cadvice%2Cinspiration%2Chelp%2Ccareer%2Chappiness';
var metaContents  = 'Nick+Pronger%2C+Yorkshire%2CShipley%2CSaltaire%2CNabWood%2Clife%2Ccoach%2Clifecoach%2Clife-coach%2C+fitness%2Cpsychotherapy%2Cwellbeing%2Cwell%2Cbeing%2Cmental+health%2C+health%2Cpsychotherapy%2Cpsychotherapist%2Cpsychologist%2Cpsychology%2CLeeds%2CBingley%2CKeighley%2Cadvice%2Cinspiration%2Chelp%2Ccareer%2Chappiness';
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();
};
