/* [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','401',jdecode('About+our+clinic'),jdecode(''),'/401/index.html','true',[ 
		['PAGE','17701',jdecode('About+Alan+Sealy'),jdecode(''),'/401/17701.html','true',[],'',''],
		['PAGE','10901',jdecode('Find+us+%2F+Contact+us'),jdecode(''),'/401/10901.html','true',[],'','']
	],'',''],
	['PAGE','2664',jdecode('%22I%26%23x27%3Bm+dizzy%22+-+What+to+expect'),jdecode(''),'/2664.html','true',[],'',''],
	['PAGE','8301',jdecode('The+Balance+System'),jdecode(''),'/8301.html','true',[],'',''],
	['PAGE','20101',jdecode('Common+Causes+of+Dizziness'),jdecode(''),'/20101/index.html','true',[ 
		['PAGE','20127',jdecode('Positional+Vertigo+-+BPPV'),jdecode(''),'/20101/20127.html','true',[],'',''],
		['PAGE','18901',jdecode('Non-Vestibular+causes+of+dizziness'),jdecode(''),'/20101/18901.html','true',[],'','']
	],'',''],
	['PAGE','2685',jdecode('How+can+we+can+help%3F+-+VRT'),jdecode(''),'/2685.html','true',[],'',''],
	['PAGE','20001',jdecode('Useful+links'),jdecode(''),'/20001.html','true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Capri';
theSitetree.paletteFamily='943434';
theSitetree.keyvisualId='7160';
theSitetree.keyvisualName='kv_7160.jpg';
theSitetree.fontsetId='16409';
theSitetree.graphicsetId='12137';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Capri',
				paletteFamily: 	'943434',
				keyvisualId: 	'7160',
				keyvisualName: 	'kv_7160.jpg',
				fontsetId: 		'16409',
				graphicsetId: 	'12137',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				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:  '401',
internalId:  '',
customField: '20091210-110012'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20001',
internalId:  '',
customField: '20081110-220413'
};
webappMappings['1501']=webappMappings['1501-5858615']={
webappId:    '1501',
documentId:  '401',
internalId:  '5858615',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10901',
internalId:  '',
customField: '20090312-154752'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2664',
internalId:  '',
customField: '20080611-153910'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8301',
internalId:  '',
customField: '20080806-173300'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2685',
internalId:  '',
customField: '20080611-154834'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20127',
internalId:  '',
customField: '20080916-123831'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20101',
internalId:  '',
customField: '20080916-124929'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17701',
internalId:  '',
customField: '20091210-110932'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18901',
internalId:  '',
customField: '20091210-110827'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10IN288J';
var companyName   = 'Aberdeen+Balance+Clinic';
var htmlTitle	  = 'Aberdeen+Balance+Clinic.+Treatment+for+vertigo%2C+dizziness+and+balance+disorders';
var metaKeywords  = 'vertigo+causes+%2Cbenign+vertigo+%2Cvertigo+symptoms+%2Cvertigo+treatment+%2Cbenign+positional+vertigo+%2Ctreatment+for+vertigo+%2Cdizziness+cure+%2Cdizziness+symptoms+%2Ccures+for+dizziness+%2Cdizziness+causes+%2Ccauses+of+dizziness+%2Cchronic+dizziness+uk+%2Cdizziness+and+vertigo+%2Cdizziness+and+balance+%2Cuk+physiotherapy+clinics+%2C%2Cvestibular+syndrome+%2Cvestibular+rehabilitation+exercises+%2Cphysiotherapy+uk+%2Cvestibular+rehabilitation+therapy+%2Cbalance+clinic+%2Cphysiotherapy+clinics+uk+%2Cvestibular+disorders+%2C+www.balanceclinic.co.uk%2C+Dizziness%2C+vertigo%2C+balance+disorders%2C+dizziness+treatment%2C+vestibular+rehabilitation%2C+specialist+physiotherapy%2C+exercise+therapy%2C+balance+problems%2C+BPPV%2C+neuritis%2C+menieres+disease%2C+mal+de+debarquement%2C+cervical+vertigo%2C+visual+vertigo%2C+cervicogenic+headaches%2C+headache+treatment%2C+neck+pain%2C+tinitus+help%2C+In+Balance+Physiotherapy%2C+sports+injuries%2C+ADHD%2C+ADD%2C+dyslexia';
var metaContents  = 'The+balance+clinic+provides+specialist+assessment%2C+treatment+and+vestibular+rehabilitation+for+patients+suffering+from+vertigo%2C+dizziness+and+balance+disorders.+Our+website+contains+information+for+patients+and+health+professionals.';
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();
};
