/* [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','1801',jdecode('About+Us'),jdecode(''),'/1801.html','true',[],'',''],
	['PAGE','1878',jdecode('Maternity+Reflexology'),jdecode(''),'/1878.html','true',[],'',''],
	['PAGE','1904',jdecode('Maternity+Massage+%26+Aromatherapy'),jdecode(''),'/1904.html','true',[],'',''],
	['PAGE','1956',jdecode('Holistic+Facials'),jdecode(''),'/1956.html','true',[],'',''],
	['PAGE','12501',jdecode('Eastern+Facial+massage'),jdecode(''),'/12501.html','true',[],'',''],
	['PAGE','1982',jdecode('Advanced+Reflexology'),jdecode(''),'/1982.html','true',[],'',''],
	['PAGE','2008',jdecode('Public+Workshops'),jdecode(''),'/2008.html','true',[],'',''],
	['PAGE','2060',jdecode('Student+Testimonials'),jdecode(''),'/2060.html','true',[],'',''],
	['PAGE','1930',jdecode('Full+Course+List'),jdecode(''),'/1930.html','true',[],'',''],
	['PAGE','2034',jdecode('Contact+Us'),jdecode(''),'/2034.html','true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Angkor';
theSitetree.paletteFamily='879ED6';
theSitetree.keyvisualId='6853';
theSitetree.keyvisualName='kv_6853.jpg';
theSitetree.fontsetId='11212';
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: 	'6853',
				keyvisualName: 	'kv_6853.jpg',
				fontsetId: 		'11212',
				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: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-724']={
webappId:    '7008',
documentId:  '2034',
internalId:  '724',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1801',
internalId:  '',
customField: '20100518-235723'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12501',
internalId:  '',
customField: '20091203-180144'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1956',
internalId:  '',
customField: '20091013-002801'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1982',
internalId:  '',
customField: '20091203-170509'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2008',
internalId:  '',
customField: '20100519-003521'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2034',
internalId:  '',
customField: '20090706-200014'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2060',
internalId:  '',
customField: '20091203-180014'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1878',
internalId:  '',
customField: '20100614-221341'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1904',
internalId:  '',
customField: '20091203-180218'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1930',
internalId:  '',
customField: '20100519-003714'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1801',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-5422642']={
webappId:    '1501',
documentId:  '1801',
internalId:  '5422642',
customField: '1501'
};
webappMappings['1002']=webappMappings['1002-2060anbt20in2twa']={
webappId:    '1002',
documentId:  '2060',
internalId:  '2060anbt20in2twa',
customField: 'icq=false'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20IN2TWA';
var companyName   = 'Bindi+Therapy+School';
var htmlTitle	  = 'Bindi+Therapy+School+-+Maternity+Reflexology+and+massage+courses%2C+practitioner+workshops%2C+public+workshops+in+London';
var metaKeywords  = 'Complementary+Therapy+school%2C+Reflexology%2C+Massage%2C+Aromatherapy%2C+workshops%2C+courses%2C+corporate+workshops%2C+Maternity+Reflexology%2C+Maternity+Massage%2C+Therapy+courses%2C+Rima+Shah%2C+Calm+and+Clear%2C+Reflexology+courses%2C+Maternity+reflexology+courses%2C+Maternity+massage+courses';
var metaContents  = 'Binidi+Therapy+School+-+Complementary+Therapy+School+and+CPD+courses+for+complementary+therapy+practitioners+and+the+public+held+in+London';
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();
};
