/* [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 theSitetree=[ 
	['PAGE','2001',jdecode('Home'),jdecode(''),'/2001.html','true',[],''],
	['PAGE','2052',jdecode('The+Cottages'),jdecode(''),'/2052/index.html','true',[ 
		['PAGE','3901',jdecode('Magpie+%282%29'),jdecode(''),'/2052/3901.html','true',[],''],
		['PAGE','2073',jdecode('Siskin+%282%29'),jdecode(''),'/2052/2073.html','true',[],''],
		['PAGE','3922',jdecode('Red+Kite+%284%29'),jdecode(''),'/2052/3922.html','true',[],''],
		['PAGE','3943',jdecode('Kestrel+%284%29'),jdecode(''),'/2052/3943.html','true',[],''],
		['PAGE','3964',jdecode('Tawny+Owl+%284%29'),jdecode(''),'/2052/3964.html','true',[],''],
		['PAGE','3985',jdecode('Nant+Garreg+%284%29'),jdecode(''),'/2052/3985.html','true',[],''],
		['PAGE','4006',jdecode('Trallwm+Farmhouse+%287%29'),jdecode(''),'/2052/4006.html','true',[],''],
		['PAGE','4027',jdecode('Trawsgyrch+%289%29'),jdecode(''),'/2052/4027.html','true',[],'']
	],''],
	['PAGE','2094',jdecode('Our+Area'),jdecode(''),'/2094/index.html','true',[ 
		['PAGE','4069',jdecode('Places+to+eat+and+drink'),jdecode(''),'/2094/4069.html','true',[],'']
	],''],
	['PAGE','29801',jdecode('Christmas%2FNew+Year+2010'),jdecode(''),'/29801.html','true',[],''],
	['PAGE','2115',jdecode('Tariffs'),jdecode(''),'/2115.html','true',[],''],
	['PAGE','2136',jdecode('Location'),jdecode(''),'/2136.html','true',[],''],
	['PAGE','4090',jdecode('Treatments'),jdecode(''),'/4090/index.html','true',[ 
		['PAGE','4111',jdecode('Beauty+Therapy'),jdecode(''),'/4090/4111.html','true',[],''],
		['PAGE','4132',jdecode('Reflexology'),jdecode(''),'/4090/4132.html','true',[],'']
	],''],
	['PAGE','2178',jdecode('Terms'),jdecode(''),'/2178.html','true',[],''],
	['PAGE','2199',jdecode('Links'),jdecode(''),'/2199.html','true',[],''],
	['PAGE','13101',jdecode('Gallery'),jdecode(''),'/13101.html','true',[],''],
	['PAGE','17801',jdecode('Contact+Us'),jdecode(''),'/17801.html','true',[],'']];
var siteelementCount=22;
theSitetree.topTemplateName='Dots';
theSitetree.paletteFamily='E7E9D5';
theSitetree.keyvisualId='421';
theSitetree.keyvisualName='alte_moebel.jpg';
theSitetree.fontsetId='43';
theSitetree.graphicsetId='49';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='E7E9D5';
var theTemplate={
				name: 			'Dots',
				paletteFamily: 	'E7E9D5',
				keyvisualId: 	'421',
				keyvisualName: 	'alte_moebel.jpg',
				fontsetId: 		'43',
				graphicsetId: 	'49',
				contentColor: 	'000000',
				contentBGColor: 'E7E9D5',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'E7E9D5',
				b_color: 		'CCCCCC',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2001',
internalId:  '',
customField: '20100112-061745'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2052',
internalId:  '',
customField: '20100113-084211'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2073',
internalId:  '',
customField: '20100216-110352'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2094',
internalId:  '',
customField: '20090723-140828'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2115',
internalId:  '',
customField: '20100110-093521'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2136',
internalId:  '',
customField: '20091009-042706'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4090',
internalId:  '',
customField: '20090712-161239'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3901',
internalId:  '',
customField: '20100111-085526'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4027',
internalId:  '',
customField: '20100205-115721'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2001',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-5386755']={
webappId:    '1501',
documentId:  '2001',
internalId:  '5386755',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3922',
internalId:  '',
customField: '20100112-051548'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3943',
internalId:  '',
customField: '20100112-052707'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3964',
internalId:  '',
customField: '20100112-053941'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3985',
internalId:  '',
customField: '20100216-110448'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4006',
internalId:  '',
customField: '20100112-060113'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17801',
internalId:  '',
customField: '20090715-061137'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4069',
internalId:  '',
customField: '20090714-115258'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2178',
internalId:  '',
customField: '20090804-093047'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2199',
internalId:  '',
customField: '20090715-061304'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4111',
internalId:  '',
customField: '20090801-103855'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4132',
internalId:  '',
customField: '20090720-144649'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29801',
internalId:  '',
customField: '20100110-101329'
};
webappMappings['7060']=webappMappings['7060-63253c49388d482385fd2a457d6864d9']={
webappId:    '7060',
documentId:  '13101',
internalId:  '63253c49388d482385fd2a457d6864d9',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13101',
internalId:  '',
customField: '20090715-060338'
};
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050INLTR7';
var companyName   = '';
var htmlTitle	  = 'Holiday+cottages+in+the+forests+of+Mid+Wales+%7C+Trallwm+Forest+Cottages';
var metaKeywords  = 'Holiday+Cottage+Welsh+Mid-Wales+Trallwm+Forest+Cottages+Llanwrtyd+Wells';
var metaContents  = 'Trallwm+Forest+Cottages+are+self-catering+holiday+properties+deep+in+the+heart+of+Mid+Wales.+They+are+situated+in+the+most+picturesque+setting+in+a+beautiful+wooded+valley+between+the+villages+of+Beulah+%28A483%29+and+Abergwesyn.+For+over+25+years+these+traditional+Welsh+slate+and+stone+buildings+have+been+providing+a+warm+and+comfortable+base+for+visitors+to+explore+Mid+Wales.+';
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();
};
