/* [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','501',jdecode('Home'),jdecode(''),'/501.html','true',[],'',''],
	['PAGE','573',jdecode('Personal+Training'),jdecode(''),'/573.html','true',[],'',''],
	['PAGE','552',jdecode('Sports+Massage'),jdecode(''),'/552.html','true',[],'',''],
	['PAGE','137268',jdecode('Special+Offers+%2F+Packages'),jdecode(''),'/137268.html','true',[],'',''],
	['PAGE','636',jdecode('Rates+%2F+Contact'),jdecode(''),'/636.html','true',[],'',''],
	['PAGE','46601',jdecode('About+Me'),jdecode(''),'/46601.html','true',[],'',''],
	['PAGE','48906',jdecode('Testimonials'),jdecode(''),'/48906.html','true',[],'',''],
	['PAGE','98635',jdecode('Spinning+Classes'),jdecode(''),'/98635/index.html','true',[ 
		['PAGE','119035',jdecode('Info+For+Participants'),jdecode(''),'/98635/119035.html','true',[],'',''],
		['PAGE','128868',jdecode('List+of+Ride+Profiles'),jdecode(''),'/98635/128868.html','true',[],'','']
	],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Valiant';
theSitetree.paletteFamily='D43F3F';
theSitetree.keyvisualId='9814';
theSitetree.keyvisualName='kv_9814.jpg';
theSitetree.fontsetId='17626';
theSitetree.graphicsetId='13031';
theSitetree.contentColor='646464';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Valiant',
				paletteFamily: 	'D43F3F',
				keyvisualId: 	'9814',
				keyvisualName: 	'kv_9814.jpg',
				fontsetId: 		'17626',
				graphicsetId: 	'13031',
				contentColor: 	'646464',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '501',
internalId:  '',
customField: '20091229-190218'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '552',
internalId:  '',
customField: '20100219-150501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '573',
internalId:  '',
customField: '20100813-182620'
};
webappMappings['7008']=webappMappings['7008-700']={
webappId:    '7008',
documentId:  '636',
internalId:  '700',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46601',
internalId:  '',
customField: '20100409-161703'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '636',
internalId:  '',
customField: '20100813-191036'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '501',
internalId:  '1006',
customField: '1006'
};
webappMappings['1002']=webappMappings['1002-48906anbt10in2qch']={
webappId:    '1002',
documentId:  '48906',
internalId:  '48906anbt10in2qch',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '98635',
internalId:  '',
customField: '20100715-162207'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '48906',
internalId:  '',
customField: '20091229-190038'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '119035',
internalId:  '',
customField: '20100108-131115'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '128868',
internalId:  '',
customField: '20100715-163430'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '137268',
internalId:  '',
customField: '20100814-073720'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10IN2QCH';
var companyName   = '';
var htmlTitle	  = 'Edinburgh+Personal+Trainer';
var metaKeywords  = 'Personal+Training+in+Edinburgh%2C+Edinburgh+Personal+Trainer%2C+Sports+massage+edinburgh%2C+weightloss+edinburgh%2C+personal+trainer%2C+training%2C+fitness%2C+fit%2C+get+fitter%2C+health%2C+scotland%2C+exercise%2C+weight+loss%2C+masseur%2C+massage%2C+home+visit%2C+bring+the+gym+to+you%2C+mobile%2C+in+your+own+home%2C+at+home%2C+own+home%2C+Edinburgh+personal+trainer%2Cpersonal+fitness+trainers%2Cpersonal+trainers+UK%2C+personal+trainers%2C+weight+loss+information%2C+slimming+and+weight+loss%2C+fitness+weight+loss%2C+weight+loss+Edinburgh%2C+UK+weight+loss%2Chome+workout%2Cworkout+exercises%2Cweight+training+workout%2Cworkout+schedule%2Cfitness+training+instructors%2Caerobic+fitness+exercise%2Chome+fitness+exercise%2Cuk+fitness+sports%2Cbody+builder+diet%2Cbody+building+workouts%2Ctherapy+sports+massage%2Cuk+bodybuilding%2Cfemale+bodybuilding%2Cspin+class%2C+female+body+builder%2Cbodybuilding+nutrition%2C+www.keppiefit.com%2C+Stephen+Keppie';
var metaContents  = 'Edinburgh+Personal+Training+and+Sports+Massage+';
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();
};
