/* [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','2101',jdecode('TIME+TO+CHANGE%3F'),jdecode(''),'/2101.html','true',[],'',''],
	['PAGE','2308',jdecode('PERSONAL+TRAINING'),jdecode(''),'/2308.html','true',[],'',''],
	['PAGE','39101',jdecode('TIME+LINE+THERAPY'),jdecode(''),'/39101.html','true',[],'',''],
	['PAGE','39127',jdecode('NLP+%26+HYPNOSIS+THERAPY'),jdecode(''),'/39127.html','true',[],'',''],
	['PAGE','2256',jdecode('PRICE'),jdecode(''),'/2256.html','true',[],'',''],
	['PAGE','44101',jdecode('ABOUT+US'),jdecode(''),'/44101.html','true',[],'',''],
	['PAGE','52901',jdecode('Sponsor+Me+Now+Please'),jdecode(''),'/52901.html','true',[],'',''],
	['PAGE','2360',jdecode('CONTACT+US'),jdecode(''),'/2360.html','true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Activate';
theSitetree.paletteFamily='1E3A6F';
theSitetree.keyvisualId='2025';
theSitetree.keyvisualName='beauty.jpg';
theSitetree.fontsetId='337';
theSitetree.graphicsetId='396';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='1E3A6F';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Activate',
				paletteFamily: 	'1E3A6F',
				keyvisualId: 	'2025',
				keyvisualName: 	'beauty.jpg',
				fontsetId: 		'337',
				graphicsetId: 	'396',
				contentColor: 	'FFFFFF',
				contentBGColor: '1E3A6F',
				a_color: 		'1E3A6F',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-3028']={
webappId:    '7008',
documentId:  '2360',
internalId:  '3028',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2101',
internalId:  '',
customField: '20100604-075728'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39127',
internalId:  '',
customField: '20100520-133720'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '44101',
internalId:  '',
customField: '20100520-172604'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2256',
internalId:  '',
customField: '20100602-073237'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39101',
internalId:  '',
customField: '20100520-172900'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2308',
internalId:  '',
customField: '20100520-133209'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '39101',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2360',
internalId:  '',
customField: '20081113-170040'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '2101',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2101',
internalId:  '1006',
customField: '1006'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '39127',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '2308',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '2256',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '44101',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '2360',
internalId:  '',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '52901',
internalId:  '',
customField: '20100422-115432'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20INEQTN';
var companyName   = 'CALM+THE+CHAOS';
var htmlTitle	  = '';
var metaKeywords  = '%3C%3Cmeta+name%3D%22keywords%22+content%3D%22NLP+Master+Practitioner%2C+Personal+Fitness+London%2C+Personal+Fitness+Trainer+London%2C+Career+changes%2C+Relationship%2C+Fitness+%26+Health%2C+self+development+coaching%2C+stress+relief+London%2C+Health+Counselling++NLP%2C+Neuro+Linguistic+Programming%2C+Time+Line+Therapy%2C+Hypnosis%2C+Nutrition%2C+unique+trainer%2C+Optimum+Health+London%2C+Health+and+Fitness+in+London%2C+negative+emotions%2C+negative+behaviour%2C+limiting+decisions%2C+stress+management++London%2C+personal+training%2C+one+to+one%2C+break+through+sessions+weight+Loss.+weight+management%2C+UK+travel++www.calmthechaos.co.uk%22%3E';
var metaContents  = '%3Ctitle%3E%3Cmeta+name%3D%22description%22+content%3D%22Totally+transform+your+future+and+make+important+changes+emotional+or+physical%2C+take+a+journey+with+Time+Line+Therapy+and+change+negative+behaviour+and+emotions.++Available+to+travel+throughout+the+UK.+Specialist+in+NLP%2C+Make+influential+changes+to+your+life+now+with+you+one+to+one+NLP+and+Personal+Fitness+Training+Company+-+Career%2C+relationship%2C+personal+fitness%2C+health%2C+fears%2C+phobia%2C+stop+smoking.++Take+control+of+your+present+state%2C+make+the+changes+using+NLP+techniques%2C+time+Line+therapy+and+Hypnosis%2C+Personal+fitness+Training+that+will+take+you+forward+to+a+better+future.++Using+NLP%2C+Time+Line+Therapy+Hypnosis.+One+to+One+Personal+Training+encouraging+Physical+fitness%2C+good+nutrition+and+motivation+for+optimum+health.%22%3E';
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();
};
