/* [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','4901',jdecode('Home'),jdecode(''),'/4901.html','true',[],'',''],
	['PAGE','4978',jdecode('Hypnotherapy'),jdecode(''),'/4978.html','true',[],'',''],
	['PAGE','5004',jdecode('NLP'),jdecode(''),'/5004.html','true',[],'',''],
	['PAGE','5030',jdecode('Life+Coaching'),jdecode(''),'/5030.html','true',[],'',''],
	['PAGE','5082',jdecode('About+Me'),jdecode(''),'/5082.html','true',[],'',''],
	['PAGE','5160',jdecode('Costs'),jdecode(''),'/5160.html','true',[],'',''],
	['PAGE','5108',jdecode('How+to+find+us'),jdecode(''),'/5108.html','true',[],'',''],
	['PAGE','5056',jdecode('Contact'),jdecode(''),'/5056.html','true',[],'',''],
	['PAGE','41659',jdecode('hypnoband'),jdecode(''),'/41659.html','false',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Angkor';
theSitetree.paletteFamily='879ED6';
theSitetree.keyvisualId='6859';
theSitetree.keyvisualName='kv_6859.jpg';
theSitetree.fontsetId='11211';
theSitetree.graphicsetId='12030';
theSitetree.contentColor='354B86';
theSitetree.contentBGColor='94AAE1';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Angkor',
				paletteFamily: 	'879ED6',
				keyvisualId: 	'6859',
				keyvisualName: 	'kv_6859.jpg',
				fontsetId: 		'11211',
				graphicsetId: 	'12030',
				contentColor: 	'354B86',
				contentBGColor: '94AAE1',
				a_color: 		'94AAE1',
				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:  '4901',
internalId:  '',
customField: '20100507-232940'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41659',
internalId:  '',
customField: '20091112-175818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4978',
internalId:  '',
customField: '20090908-124829'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5004',
internalId:  '',
customField: '20080818-103846'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5030',
internalId:  '',
customField: '20090908-125004'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5056',
internalId:  '',
customField: '20080818-110630'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5082',
internalId:  '',
customField: '20100415-125630'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5108',
internalId:  '',
customField: '20090912-191925'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4901',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5160',
internalId:  '',
customField: '20110628-165536'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20IN2UBP';
var companyName   = 'Time+For+Change';
var htmlTitle	  = 'Edinburgh+Hypnotherapy+%26+Life+Coaching+in+Edinburgh+and+the+Scottish+Borders.';
var metaKeywords  = 'Edinburgh%2C+Scotland%2C+Scottish+Borders%2C++Life+Coaching%2C+Hypnotherapy%2C+NLP%2C+Weight+Loss%2C+Confidence+Building%2C+Relationships%2C+Phobias%2C+Self+Esteem%2C+Image%2C+Life+Changes%2C+Health+Fitness%2C+Exam+Nerves%2C++Driving+Tests.+';
var metaContents  = 'Laura+Stevenson+is+a+professional+Hypnotherapist+and+Life+Coach+based+in+Edinburgh+and+St+Boswells+in+the+Scottish+Borders.+Specialising+in++Confidence+Building%2C+Weight+Loss%2C+Phobias%2CRelationship+Coaching%2CYouth+Coaching.....';
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();
};

