/* [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','5201',jdecode('Home'),jdecode(''),'/5201.html','true',[],''],
	['PAGE','14653',jdecode('Experience'),jdecode(''),'/14653.html','true',[],''],
	['PAGE','14679',jdecode('Osteopathy+treats'),jdecode(''),'/14679.html','true',[],''],
	['PAGE','14705',jdecode('What+to+expect'),jdecode(''),'/14705.html','true',[],''],
	['PAGE','14627',jdecode('What+patients+say'),jdecode(''),'/14627.html','true',[],''],
	['PAGE','14757',jdecode('Useful+Links'),jdecode(''),'/14757.html','true',[],''],
	['PAGE','20701',jdecode('Clinic+Hours'),jdecode(''),'/20701.html','true',[],''],
	['PAGE','14731',jdecode('Contact+us'),jdecode(''),'/14731.html','true',[],''],
	['PAGE','14783',jdecode('How+to+find+us'),jdecode(''),'/14783.html','true',[],'']];
var siteelementCount=9;
theSitetree.topTemplateName='cutout';
theSitetree.paletteFamily='A1BCDD';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10350';
theSitetree.graphicsetId='10474';
theSitetree.contentColor='43637C';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				name: 			'cutout',
				paletteFamily: 	'A1BCDD',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10350',
				graphicsetId: 	'10474',
				contentColor: 	'43637C',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'FFFFFF',
				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['7008']=webappMappings['7008-1441']={
webappId:    '7008',
documentId:  '14731',
internalId:  '1441',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5201',
internalId:  '',
customField: '20080720-083246'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14731',
internalId:  '',
customField: '20090711-174825'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14653',
internalId:  '',
customField: '20091118-211150'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14679',
internalId:  '',
customField: '20091118-210804'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14705',
internalId:  '',
customField: '20090803-104115'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14627',
internalId:  '',
customField: '20090112-172502'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20701',
internalId:  '',
customField: '20080517-174515'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14757',
internalId:  '',
customField: '20080725-180237'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14783',
internalId:  '',
customField: '20090711-175009'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20IN26CX';
var companyName   = 'Mike+Relf+-+Registered+Osteopath';
var htmlTitle	  = 'Mike+Relf%2C+Registered+Osteopath%2C+Wokingham%2C+Berkshire';
var metaKeywords  = 'Mike%2C+Relf%2C+Osteopath%2C+Registered+Osteopath%2C+British+School+of+Osteopathy%2C+Wokingham%2C+Berkshire%2C+Osteopathy%2C+Whiplash%2C+Back-pain%2C+tennis-elbow%2C+frozen+shoulder%2C+low+back-pain%2C+migraine%2C+headache%2C+infantile+cholic%2C+postural+problems%2C+scoliosis%2C+';
var metaContents  = 'Mr+Mike+Relf+is+a+highly+experienced+and+qualified+registered+Osteopath+working+from+a+purpose-built+clinic+in+Wokingham%2C+Berkshire.+He+specialises+in+delivering+Osteopathic+treatments+with+a+kind%2C+effective+but+gentle+touch.';
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();
};
