/* [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','4701',jdecode('Home'),jdecode(''),'/4701.html','true',[],'',''],
	['PAGE','25201',jdecode('About+us'),jdecode(''),'/25201.html','true',[],'',''],
	['PAGE','25127',jdecode('Properties+for+sale'),jdecode(''),'/25127.html','true',[],'',''],
	['PAGE','25101',jdecode('Properties+to+rent'),jdecode(''),'/25101.html','true',[],'',''],
	['PAGE','25227',jdecode('Landlords'),jdecode(''),'/25227/index.html','true',[ 
		['PAGE','44001',jdecode('Utilitites'),jdecode(''),'/25227/44001.html','true',[],'',''],
		['PAGE','44201',jdecode('Property+maintenance'),jdecode(''),'/25227/44201.html','true',[],'',''],
		['PAGE','44401',jdecode('Safety+regulations'),jdecode(''),'/25227/44401.html','true',[],'',''],
		['PAGE','45501',jdecode('Legislation'),jdecode(''),'/25227/45501.html','true',[],'',''],
		['PAGE','25279',jdecode('Rent+protection'),jdecode(''),'/25227/25279.html','true',[],'',''],
		['PAGE','50801',jdecode('Maximising+return'),jdecode(''),'/25227/50801.html','true',[],'','']
	],'',''],
	['PAGE','37901',jdecode('Landlord+insurance'),jdecode(''),'/37901.html','true',[],'',''],
	['PAGE','48301',jdecode('Rent+a+room'),jdecode(''),'/48301.html','true',[],'',''],
	['PAGE','49001',jdecode('Property+marketing'),jdecode(''),'/49001.html','true',[],'',''],
	['PAGE','30501',jdecode('Tenants'),jdecode(''),'/30501/index.html','true',[ 
		['PAGE','45801',jdecode('Finding+a+property'),jdecode(''),'/30501/45801.html','true',[],'',''],
		['PAGE','38301',jdecode('Tenancy+deposit'),jdecode(''),'/30501/38301.html','true',[],'','']
	],'',''],
	['PAGE','38101',jdecode('Tenant+insurance'),jdecode(''),'/38101.html','true',[],'',''],
	['PAGE','25627',jdecode('Contact+us'),jdecode(''),'/25627.html','true',[],'','']];
var siteelementCount=19;
theSitetree.topTemplateName='Plains';
theSitetree.paletteFamily='4690CA';
theSitetree.keyvisualId='7886';
theSitetree.keyvisualName='blanko.swf';
theSitetree.fontsetId='16856';
theSitetree.graphicsetId='12303';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'true',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'true',
				hasCompanyname: 'false',
				name: 			'Plains',
				paletteFamily: 	'4690CA',
				keyvisualId: 	'7886',
				keyvisualName: 	'blanko.swf',
				fontsetId: 		'16856',
				graphicsetId: 	'12303',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4701',
internalId:  '',
customField: '20110801-180516'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25101',
internalId:  '',
customField: '20110805-184725'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25127',
internalId:  '',
customField: '20110712-141629'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25201',
internalId:  '',
customField: '20110805-184624'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25227',
internalId:  '',
customField: '20110801-181737'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45501',
internalId:  '',
customField: '20110721-140646'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25279',
internalId:  '',
customField: '20110805-175042'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '48301',
internalId:  '',
customField: '20110805-121301'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '49001',
internalId:  '',
customField: '20110805-163251'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30501',
internalId:  '',
customField: '20110805-183536'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45801',
internalId:  '',
customField: '20110805-183601'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '44001',
internalId:  '',
customField: '20110716-145737'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '44201',
internalId:  '',
customField: '20110721-104807'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25627',
internalId:  '',
customField: '20110801-181440'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '44401',
internalId:  '',
customField: '20110721-105312'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37901',
internalId:  '',
customField: '20110721-131819'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38101',
internalId:  '',
customField: '20110805-183458'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38301',
internalId:  '',
customField: '20110721-133853'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50801',
internalId:  '',
customField: '20110820-125328'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10IN3AOM';
var companyName   = 'Premier+Property+Management';
var htmlTitle	  = '';
var metaKeywords  = '';
var metaContents  = '';
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();
};

