/* [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','2701',jdecode('Home'),jdecode(''),'/2701.html','true',[],'',''],
	['PAGE','2752',jdecode('Room+details'),jdecode(''),'/2752.html','true',[],'',''],
	['PAGE','2778',jdecode('Floor+Plans'),jdecode(''),'/2778.html','true',[],'',''],
	['PAGE','2804',jdecode('Photo+Gallery'),jdecode(''),'/2804.html','true',[],'',''],
	['PAGE','2856',jdecode('Contact+us+'),jdecode(''),'/2856.html','true',[],'',''],
	['PAGE','2882',jdecode('Location'),jdecode(''),'/2882.html','true',[],'','']];
var siteelementCount=6;
theSitetree.topTemplateName='Gaudy';
theSitetree.paletteFamily='207247';
theSitetree.keyvisualId='5937';
theSitetree.keyvisualName='kv_5937.jpg';
theSitetree.fontsetId='11113';
theSitetree.graphicsetId='11906';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='5CB184';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Gaudy',
				paletteFamily: 	'207247',
				keyvisualId: 	'5937',
				keyvisualName: 	'kv_5937.jpg',
				fontsetId: 		'11113',
				graphicsetId: 	'11906',
				contentColor: 	'FFFFFF',
				contentBGColor: '5CB184',
				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['7060']=webappMappings['7060-d6f6344f93807af0660c498320e904a7']={
webappId:    '7060',
documentId:  '2804',
internalId:  'd6f6344f93807af0660c498320e904a7',
customField: 'language:en;country:GB;'
};
webappMappings['7008']=webappMappings['7008-827']={
webappId:    '7008',
documentId:  '2856',
internalId:  '827',
customField: 'language:en;country:GB;'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '2882',
internalId:  'location',
customField: 'language:en;country:GB;isIncluded:true;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2701',
internalId:  '',
customField: '20090721-095447'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2701',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2752',
internalId:  '',
customField: '20080416-175702'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2778',
internalId:  '',
customField: '20080416-155903'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2804',
internalId:  '',
customField: '20080416-130946'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2856',
internalId:  '',
customField: '20090125-140754'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2882',
internalId:  '',
customField: '20080416-160314'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20IN2TIU';
var companyName   = 'PERIOD+ENGLISH+COUNTRY+HOUSE+WITH+ANNEXE+FOR+SALE+IN+EAST+SUSSEX';
var htmlTitle	  = 'Period+Character+English+Country+House+with+annexe+for+sale+in+Wadhurst+East+Sussex';
var metaKeywords  = 'Period+English+Country+House+with+annexe+for+sale+in+Wadhurst+East+Sussex%2C+sussex%2Chouses+for+sale+sussex%2Chouse+for+sale+sussex+uk%2Cnew+houses+for+sale+west+sussex%2Chouse+for+sale+uk+new+house+for+sale+uk%2Chouses+in+the+uk+for+sale%2Ccountry+houses+for+sale%2Ccountry+house+for+sale+uk%2Chouses+for+sale+in+the+country%2Clarge+country+house+for+sale%2Ccountry+house+for+sale%2Chomes+for+sale+uk%2Ccountry+homes+for+sale+uk%2Chomes+for+sale+in+the+uk%2Cperiod+houses+for+sale%2Chomes+for+sale+in+east+sussex%2Cuk+luxury+homes+for+sale%2Chomes+for+sale+in+sussex%2Ccharacter+homes+for+sale%2Cwww.sussexbyre.com%2Cperiod+English+country+house+with+annexe+for+sale+in+Wadhurst+East+Sussex%2Cperiod+home+for+sale+in+Sussex%2Cperiod+house+for+sale+in+Sussex%2Ccharacter+home+for+sale+in+Sussex%2Ccharacter+house+for+sale+in+Sussex%2CEnglish+country+home+for+sale+in+Sussex%2CEnglish+country+house+for+sale%2Cperiod+property+for+sale%2Ccharacter+property+for+sale%2Cperiod+house+for+sale%2Cperiod+country+house+for+sale%2Cbarn+conversion+for+sale%2Cformer+milking+byre+for+sale%2Chouse+with+annexe+for+elderly+parents+for+sale%2Chouse+with+annexe+for+au+pair+for+sale%2Chouse+with+home+office+suite+for+sale%2Chouse+in+Sussex+for+sale%2C+house+in+East+Sussex+for+sale%2Clarge+country+property+for+sale+in+Sussex%2Ccountry+property+for+sale+in+Sussex%2Chouse+in+Weald+for+sale%2Clarge+country+property%2Cmagnificent+country+house+for+sale%2Chouse+with+annexe+for+sale%2Cperiod+house+with+Inglenook+Fireplaces+for+sale%2Cperiod+house+with+beams+for+sale%2Clarge+house+for+sale+in+Wadhurst%2Cperiod+house+for+sale+in+Wadhurst%2Ccharacter+house+for+sale+in+Wadhurst%2Chouse+for+sale+in+Wadhurst+with+annexe%2Cperiod+property+for+sale+in+Wadhurst+with+annexe%2Chouse+for+sale+in+East+Sussex';
var metaContents  = 'Period+English+Country+House+with+annexe+for+sale+in+Wadhurst+East+Sussex';
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();
};
