/* [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','2501',jdecode('Home'),jdecode(''), jdecode('%2F2501.html'), 'true',[],'',''],
	['PAGE','9501',jdecode('Availability+2012'),jdecode(''), jdecode('%2F9501.html'), 'true',[],'',''],
	['PAGE','2901',jdecode('On+arrival'),jdecode(''), jdecode('%2F2901.html'), 'true',[],'',''],
	['PAGE','2578',jdecode('What+do+you+get%3F'),jdecode(''), jdecode('%2F2578.html'), 'true',[],'',''],
	['PAGE','2604',jdecode('Rooms+%26+layout'),jdecode(''), jdecode('%2F2604.html'), 'true',[],'',''],
	['PAGE','6101',jdecode('More+rooms'),jdecode(''), jdecode('%2F6101.html'), 'true',[],'',''],
	['PAGE','2630',jdecode('Yet+more+rooms%21'),jdecode(''), jdecode('%2F2630.html'), 'true',[],'',''],
	['PAGE','2927',jdecode('What%26%23x27%3Bs+On'),jdecode(''), jdecode('%2F2927.html'), 'true',[],'',''],
	['PAGE','2656',jdecode('Price+and+service'),jdecode(''), jdecode('%2F2656.html'), 'true',[],'',''],
	['PAGE','2682',jdecode('Contact+us'),jdecode(''), jdecode('%2F2682.html'), 'true',[],'',''],
	['PAGE','2708',jdecode('About+the+farm'),jdecode(''), jdecode('%2F2708.html'), 'true',[],'',''],
	['PAGE','2953',jdecode('How+To+Find+Us'),jdecode(''), jdecode('%2F2953.html'), 'true',[],'',''],
	['PAGE','7901',jdecode('Image+Gallery'),jdecode(''), jdecode('%2F7901.html'), 'true',[],'','']];
var siteelementCount=13;
theSitetree.topTemplateName='Angkor';
theSitetree.paletteFamily='A5B351';
theSitetree.keyvisualId='6859';
theSitetree.keyvisualName='kv_6859.jpg';
theSitetree.fontsetId='11212';
theSitetree.graphicsetId='12031';
theSitetree.contentColor='657025';
theSitetree.contentBGColor='C1CF70';
var localeDef={
  language: 'en',
  country: 'GB'
};
var prodDef={
  wl_name: 'easily_co_uk',
  product: 'WSCSYSSSSLY0XVDH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Angkor',
				paletteFamily: 	'A5B351',
				keyvisualId: 	'6859',
				keyvisualName: 	'kv_6859.jpg',
				fontsetId: 		'11212',
				graphicsetId: 	'12031',
				contentColor: 	'657025',
				contentBGColor: 'C1CF70',
				a_color: 		'C1CF70',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2501',
internalId:  '',
customField: '20110216-180843'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2953',
internalId:  '',
customField: '20100119-221147'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2656',
internalId:  '',
customField: '20120118-101331'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2578',
internalId:  '',
customField: '20100224-135523'
};
webappMappings['7008']=webappMappings['7008-6543']={
webappId:    '7008',
documentId:  '2682',
internalId:  '6543',
customField: 'language:en;country:GB;'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '2953',
internalId:  'location',
customField: 'language:en;country:GB;isIncluded:true;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2708',
internalId:  '',
customField: '20110216-180316'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2682',
internalId:  '',
customField: '20100310-112631'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2927',
internalId:  '',
customField: '20100211-173843'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2901',
internalId:  '',
customField: '20110201-160232'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2501',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2604',
internalId:  '',
customField: '20100211-163100'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2630',
internalId:  '',
customField: '20110216-180107'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6101',
internalId:  '',
customField: '20100211-173340'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7901',
internalId:  '',
customField: '20100224-131925'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9501',
internalId:  '',
customField: '20120118-101122'
};
webappMappings['7060']=webappMappings['7060-97b2c7c16b6dab07654ab19fd78d6065']={
webappId:    '7060',
documentId:  '7901',
internalId:  '97b2c7c16b6dab07654ab19fd78d6065',
customField: 'language:en;country:GB;'
};
var webAppHostname = 'cgi.easily.co.uk:80';
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10IN3Q3C';
var companyName   = 'Poulton+Lodge%2C+Marlborough+01672+516888';
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();
};

