/* [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','9501',jdecode('Main+page'),jdecode(''),'/9501/index.html','true',[ 
		['PAGE','26883',jdecode('Kitchens+%26+Bathrooms'),jdecode(''),'/9501/26883.html','true',[],'',''],
		['PAGE','27009',jdecode('Loft+conversions'),jdecode(''),'/9501/27009.html','true',[],'',''],
		['PAGE','27183',jdecode('Refurbishments'),jdecode(''),'/9501/27183.html','true',[],'',''],
		['PAGE','41983',jdecode('Plumbing+%26+Electric'),jdecode(''),'/9501/41983.html','true',[],'',''],
		['PAGE','27209',jdecode('Other'),jdecode(''),'/9501/27209.html','true',[],'','']
	],'',''],
	['PAGE','11901',jdecode('Our+services'),jdecode(''),'/11901.html','true',[],'',''],
	['PAGE','9927',jdecode('Galery'),jdecode(''),'/9927.html','true',[],'',''],
	['PAGE','9979',jdecode('About+us'),jdecode(''),'/9979.html','true',[],'',''],
	['PAGE','27483',jdecode('Links'),jdecode(''),'/27483.html','true',[],'',''],
	['PAGE','43183',jdecode('Contact+us'),jdecode(''),'/43183.html','true',[],'','']];
var siteelementCount=11;
theSitetree.topTemplateName='Struktur';
theSitetree.paletteFamily='DCD0E0';
theSitetree.keyvisualId='1874';
theSitetree.keyvisualName='architekt.jpg';
theSitetree.fontsetId='296';
theSitetree.graphicsetId='359';
theSitetree.contentColor='2F0000';
theSitetree.contentBGColor='A48AAD';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Struktur',
				paletteFamily: 	'DCD0E0',
				keyvisualId: 	'1874',
				keyvisualName: 	'architekt.jpg',
				fontsetId: 		'296',
				graphicsetId: 	'359',
				contentColor: 	'2F0000',
				contentBGColor: 'A48AAD',
				a_color: 		'DCD0E0',
				b_color: 		'A48AAD',
				c_color: 		'D0BED5',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9501',
internalId:  '',
customField: '20091014-164240'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11901',
internalId:  '',
customField: '20091102-161726'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '9501',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27483',
internalId:  '',
customField: '20091016-181344'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9979',
internalId:  '',
customField: '20091014-132218'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9927',
internalId:  '',
customField: '20090514-220622'
};
webappMappings['7060']=webappMappings['7060-66334b37987b76d4bf8927fb77acbd43']={
webappId:    '7060',
documentId:  '9927',
internalId:  '66334b37987b76d4bf8927fb77acbd43',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26883',
internalId:  '',
customField: '20091102-162313'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43183',
internalId:  '',
customField: '20100110-221733'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41983',
internalId:  '',
customField: '20091102-162554'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27009',
internalId:  '',
customField: '20091102-162341'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27183',
internalId:  '',
customField: '20091016-181735'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27209',
internalId:  '',
customField: '20091014-130952'
};
webappMappings['1501']=webappMappings['1501-9159613']={
webappId:    '1501',
documentId:  '9501',
internalId:  '9159613',
customField: '1501'
};
webappMappings['7008']=webappMappings['7008-5857']={
webappId:    '7008',
documentId:  '43183',
internalId:  '5857',
customField: 'language:en;country:GB;'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20INEF6V';
var companyName   = '+++Polish+Builders+Union+LTD';
var htmlTitle	  = 'Building+Services';
var metaKeywords  = 'painting%2C+decorating%2C+tiling%2C+flooring%2C+building%2C+trade%2C+builder%2C+paint%2C+wallpaper%2C+';
var metaContents  = 'Best+building+service';
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();
};
