/* [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','17301',jdecode('Home'),jdecode(''),'/17301.html','true',[],'',''],
	['PAGE','17352',jdecode('Buying'),jdecode(''),'/17352/index.html','true',[ 
		['PAGE','17378',jdecode('Apartments'),jdecode(''),'/17352/17378.html','true',[],'',''],
		['PAGE','17404',jdecode('Real+estate'),jdecode(''),'/17352/17404.html','true',[],'',''],
		['PAGE','17430',jdecode('Properties'),jdecode(''),'/17352/17430.html','true',[],'',''],
		['PAGE','17456',jdecode('Industrial+property'),jdecode(''),'/17352/17456.html','true',[],'','']
	],'',''],
	['PAGE','17482',jdecode('Renting'),jdecode(''),'/17482/index.html','true',[ 
		['PAGE','17508',jdecode('Real+estate'),jdecode(''),'/17482/17508.html','true',[],'',''],
		['PAGE','17534',jdecode('Apartments'),jdecode(''),'/17482/17534.html','true',[],'','']
	],'',''],
	['PAGE','17560',jdecode('contact'),jdecode(''),'/17560.html','true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Straight';
theSitetree.paletteFamily='330066';
theSitetree.keyvisualId='1535';
theSitetree.keyvisualName='bauen.jpg';
theSitetree.fontsetId='238';
theSitetree.graphicsetId='301';
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: 			'Straight',
				paletteFamily: 	'330066',
				keyvisualId: 	'1535',
				keyvisualName: 	'bauen.jpg',
				fontsetId: 		'238',
				graphicsetId: 	'301',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'003366',
				b_color: 		'D7D7D7',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-6113']={
webappId:    '7008',
documentId:  '17560',
internalId:  '6113',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17301',
internalId:  '',
customField: '20100708-081139'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17560',
internalId:  '',
customField: '20100708-084326'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '17301',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-10779072']={
webappId:    '1501',
documentId:  '17301',
internalId:  '10779072',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17352',
internalId:  '',
customField: '20091119-210117'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17378',
internalId:  '',
customField: '20091119-210117'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17404',
internalId:  '',
customField: '20091119-210117'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17430',
internalId:  '',
customField: '20091119-210117'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17456',
internalId:  '',
customField: '20091119-210117'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17482',
internalId:  '',
customField: '20091119-210117'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17508',
internalId:  '',
customField: '20091119-210117'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17534',
internalId:  '',
customField: '20091119-210117'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10IN3ATP';
var companyName   = 'All+Property+Buyer+Ltd';
var htmlTitle	  = '';
var metaKeywords  = 'All+Property+Buyer.+All+property+wanted+-+Any+condition%2C+size%2C+or+potential+considered.+14+day+completion+possible.+No+Agent%2C+H.I.P+or+Solicitors+Fees.+Purchase+and+Rent+Back+available.+We+can+help+if+you+are+facing%3A+A+broken+chain%3F+Divorce+or+Seperation%3F+Repossesion%3F+Debt+problems%3F+Relocation+or+moving+abroad%3F+Resolving+property+following+a+bereavement%3F+We+can+also+help+with+the+purchase+of%3A+Inherited+property%2C+Unwanted+buy-to-let%2C+Unwanted+property+of+any+type%2C+Part+of+large+garden+or+any+development+opportunity.immediate+decision+and+offer+made+with+24hrs.+Sell+sale+buy+quick+quickly+cash+purchase+my+house+home+St+Albans+Hertford+Ware+Welwyn+Garden+City+WGC+Harpenden+Bushey+Borehamwood+Bishops+Stortford+land+garden+buy+Hitchin+Hemel+Hempstead+Luton+Bedford+Sandridge+Wheathampstead+Redbourn+Watford+Hatfield+Potters+Bar+Harlow+Hoddesdon+allpb.co.uk+www.allpb.co.uk+allpb+Cheshunt+Enfield+Barnet+Cheshunt+Standon+Sawbridgeworth+Stanstead+Herts+Hertfordshire+Bedfordshire+Essex+London+Buckinghamshire+Rickmansworth+Stevenage+Buntingford+allpropertybuyer';
var metaContents  = 'All+Property+Buyer.+All+property+wanted+-+Any+condition%2C+size%2C+or+potential+considered.+14+day+completion+possible.+No+Agent%2C+H.I.P+or+Solicitors+Fees.+Purchase+and+Rent+Back+available.+We+can+help+if+you+are+facing%3A+A+broken+chain%3F+Divorce+or+Seperation%3F+Repossesion%3F+Debt+problems%3F+Relocation+or+moving+abroad%3F+Resolving+property+following+a+bereavement%3F+We+can+also+help+with+the+purchase+of%3A+Inherited+property%2C+Unwanted+buy-to-let%2C+Unwanted+property+of+any+type%2C+Part+of+a+large+garden+or+any+development+opportunity.+Immediate+decision+and+offer+made+within+24hrs.';
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();
};

