/* [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','9401',jdecode('Home'),jdecode(''),'/9401.html','true',[],'',''],
	['PAGE','9452',jdecode('Sectors'),jdecode(''),'/9452.html','true',[],'',''],
	['PAGE','9478',jdecode('Services'),jdecode(''),'/9478.html','true',[],'',''],
	['PAGE','9504',jdecode('land+%26+Engineering'),jdecode(''),'/9504.html','true',[],'',''],
	['PAGE','9530',jdecode('3D+Mapping%2FVolumes'),jdecode(''),'/9530.html','true',[],'',''],
	['PAGE','9556',jdecode('Setting+Out%2FData+Prep'),jdecode(''),'/9556.html','true',[],'',''],
	['PAGE','9582',jdecode('Contact+Us'),jdecode(''),'/9582.html','true',[],'',''],
	['PAGE','25301',jdecode('News'),jdecode(''),'/25301.html','true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Medium';
theSitetree.paletteFamily='F5F5F5';
theSitetree.keyvisualId='2152';
theSitetree.keyvisualName='architektur.jpg';
theSitetree.fontsetId='355';
theSitetree.graphicsetId='407';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='F5F5F5';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Medium',
				paletteFamily: 	'F5F5F5',
				keyvisualId: 	'2152',
				keyvisualName: 	'architektur.jpg',
				fontsetId: 		'355',
				graphicsetId: 	'407',
				contentColor: 	'000000',
				contentBGColor: 'F5F5F5',
				a_color: 		'F5F5F5',
				b_color: 		'8EBFC6',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-1754']={
webappId:    '7008',
documentId:  '9582',
internalId:  '1754',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9401',
internalId:  '',
customField: '20091207-144508'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9504',
internalId:  '',
customField: '20090303-121227'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9530',
internalId:  '',
customField: '20080625-100931'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9452',
internalId:  '',
customField: '20091207-144542'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9582',
internalId:  '',
customField: '20080625-095937'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9556',
internalId:  '',
customField: '20080625-095807'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9478',
internalId:  '',
customField: '20090303-121021'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25301',
internalId:  '',
customField: '20081204-154525'
};
webappMappings['1501']=webappMappings['1501-6356308']={
webappId:    '1501',
documentId:  '9401',
internalId:  '6356308',
customField: '1501'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20IN2LFX';
var companyName   = 'McKenzie+Geospatial+Surveys+Limited';
var htmlTitle	  = 'Land+and+Engineering+Survey+company.+Topographic%2C+GPS+%26+specialist+applications';
var metaKeywords  = 'Topographic%2C+Topography%2C+gps%2C+topo%2C+land%2C+engineering%2C+building%2C+survey%2C+surveyor%2C+site%2C+gps%2C+surveying%2C+setting%2C+out%2C+stakeout%2C+volumes%2C+volumetric%2C+analysis%2C+machine%2C+automation%2C+control%2C+data%2C+preparation%2C+mapping%2C+flood%2C+risk%2C+m3%2C+measure%2C+golf%2C+dtm%2C+digital%2C+terrain%2C+model%2C+cartographer%2C+cartographic%2C+geospatial%2C+surrey%2C+west%2C+sussex%2C+hertfordshire%2C+essex%2C+london%2C+berkshire%2C+hampshire%2C+south%2C+east%2C+southeast%2C+uk%2C+ices%2C+guildford%2C+woking%2C+farnham%2C+weybridge%2C+west+byfleet%2C+byfleet%2C+cobham%2C+chobham%2C+horsell%2C+kingston%2C+m25%2C+knaphill%2C+addlestone%2C+topographic+survey+guildford%2C+topographic+survey+woking%2C+topographic+survey+kingston%2C+topographic+survey+surrey%2C+land+surveyor+surrey%2C+land+surveyor%2C+land+survey%2C+gps+survey%2C+gps+survey+surrey%2C+heathrow%2C+gatwick%2C+runway%2Ctopographic+land+surveys%2Cgps+land+surveys%2Ctopographical+land+surveys%2Ctopographic+surveys%2Cengineering+surveys%2Cland+surveyors+uk%2Cchartered+land+surveyor+uk%2Cgps+land+surveyors+uk%2Cland+and+architectural+surveyors%2Cgps+land+surveyors%2Cengineering+surveyor%2Cvolumetric+construction+solutions%2Cdigital+mapping+for+gps%2Csatellite+mapping%2Cvolumetric+measurements%2Cvolumetric+analysis%2Cvolumetric+measurement%2Csurveying+and+setting+out%2Cdata+preparation+and+processing%2Cearthworks+machine+control+systems%2Cmachine+control+systems%2Cgeospatial+survey%2Cgeospatial+surrey%2Cengineering+measuring+tools%2C+www.mackasurveys.co.uk';
var metaContents  = 'Land+and+Engineering+Surveys+in+the+South+East+of+England.+Providing+Topographic%2C+GPS%2C+Engineering%2C+setting+out%2C+and+site+measured+surveys+in+the+UK.+No.1+for+Volumetric+Analysis+and+machine+control+data+preparation.';
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();
};
