/* [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','1901',jdecode('About+us'),jdecode(''),'/1901.html','true',[],'',''],
	['PAGE','1927',jdecode('Services'),jdecode(''),'/1927.html','true',[],'',''],
	['PAGE','1953',jdecode('Blocked+Drains'),jdecode(''),'/1953.html','true',[],'',''],
	['PAGE','1979',jdecode('Root+Infiltration'),jdecode(''),'/1979.html','true',[],'',''],
	['PAGE','4501',jdecode('Relining'),jdecode(''),'/4501.html','true',[],'',''],
	['PAGE','4527',jdecode('Leak+Detection'),jdecode(''),'/4527.html','true',[],'',''],
	['PAGE','2005',jdecode('Contact+Us'),jdecode(''),'/2005.html','true',[],'',''],
	['PAGE','2031',jdecode('Guestbook'),jdecode(''),'/2031.html','true',[],'',''],
	['PAGE','2501',jdecode('Gallery'),jdecode(''),'/2501.html','true',[],'',''],
	['PAGE','7301',jdecode('Links'),jdecode(''),'/7301.html','true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Neon';
theSitetree.paletteFamily='6699CC';
theSitetree.keyvisualId='816';
theSitetree.keyvisualName='adresskartei.jpg';
theSitetree.fontsetId='161';
theSitetree.graphicsetId='186';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='000000';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Neon',
				paletteFamily: 	'6699CC',
				keyvisualId: 	'816',
				keyvisualName: 	'adresskartei.jpg',
				fontsetId: 		'161',
				graphicsetId: 	'186',
				contentColor: 	'FFFFFF',
				contentBGColor: '000000',
				a_color: 		'000000',
				b_color: 		'666666',
				c_color: 		'000000',
				d_color: 		'6699CC',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['1002']=webappMappings['1002-2031anbt20inercm']={
webappId:    '1002',
documentId:  '2031',
internalId:  '2031anbt20inercm',
customField: 'icq=false'
};
webappMappings['7008']=webappMappings['7008-3409']={
webappId:    '7008',
documentId:  '2005',
internalId:  '3409',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1901',
internalId:  '',
customField: '20091208-120137'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1927',
internalId:  '',
customField: '20100227-184436'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1953',
internalId:  '',
customField: '20091208-144914'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2031',
internalId:  '',
customField: '20081223-113227'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2501',
internalId:  '',
customField: '20100209-214626'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1979',
internalId:  '',
customField: '20081223-143521'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2005',
internalId:  '',
customField: '20100227-184749'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1901',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4501',
internalId:  '',
customField: '20091124-141806'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4527',
internalId:  '',
customField: '20100227-184640'
};
webappMappings['1501']=webappMappings['1501-8419418']={
webappId:    '1501',
documentId:  '1901',
internalId:  '8419418',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7301',
internalId:  '',
customField: '20100405-210308'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20INERCM';
var companyName   = 'FOREVER+BUBBLES+DRAINAGE+ENGINEERS';
var htmlTitle	  = 'FOREVER+BUBBLES+DRAINAGE+ENGINEERS+WELCOME+YOU+';
var metaKeywords  = 'high+pressure+water+jetting%2Chigh+pressure+jetting+services%2Chigh+pressure+jetting+specialists%2Ccctv+drainage+surveys%2Ccctv+drain+inspection+surveys%2Ccctv+drain+inspection%2Ccctv+drain+surveys%2Cdomestic+water+leak+detection+services%2Cleak+detection+devices%2Cleak+detection+spain%2Cwater+leak+detection+specialists%2Cwater+pipe+leak+detection%2Cpipe+leak+detection%2Cwater+leak+detection%2Cdomestic+water+leak+detection%2Cclear+blocked+drains%2Cdrain+blockage%2Cblocked+drain+services%2Cclearing+blocked+drains%2Ctree+root+removal%2Cremoving+tree+roots%2Croot+cutting%2Cforeverbubbles%2Cpipe+relining+systems%2Cpipe+relining%2C+www.foreverbubbles.com';
var metaContents  = 'FOREVER+BUBBLES+solving+drain+problems%2Cblocked+drain+unblocking%2C+drain+clearing%2C+high+pressure+water+jetting%2C+pipe+relining%2Ctree+root+removal%2C+CCTV+surveying+inspection%2C+drain+tracing%2C+drain+replacing+on+Spains+Costa+del+Sol%2Cinland+and+the+uk%2Cleak+detection%2Cblocked+drains+in+spain%2Cdrainage+problem+solving+uk+a+spain.';
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();
};
