/* [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','2001',jdecode('Home'),jdecode(''), jdecode('%2F2001.html'), 'true',[],'',''],
	['PAGE','100812',jdecode('Valentine%26%23x27%3Bs+Day+2012'),jdecode(''), jdecode('%2F100812.html'), 'true',[],'',''],
	['PAGE','2052',jdecode('The+Cottages'),jdecode(''), jdecode('%2F2052%2Findex.html'), 'true',[ 
		['PAGE','3901',jdecode('Magpie+%282%29'),jdecode(''), jdecode('%2F2052%2F3901.html'), 'true',[],'',''],
		['PAGE','2073',jdecode('Siskin+%282%29'),jdecode(''), jdecode('%2F2052%2F2073.html'), 'true',[],'',''],
		['PAGE','3922',jdecode('Red+Kite+%284%29'),jdecode(''), jdecode('%2F2052%2F3922.html'), 'true',[],'',''],
		['PAGE','3943',jdecode('Kestrel+%284%29'),jdecode(''), jdecode('%2F2052%2F3943.html'), 'true',[],'',''],
		['PAGE','3964',jdecode('Tawny+Owl+%284%29'),jdecode(''), jdecode('%2F2052%2F3964.html'), 'true',[],'',''],
		['PAGE','3985',jdecode('Nant+Garreg+%284%29'),jdecode(''), jdecode('%2F2052%2F3985.html'), 'true',[],'',''],
		['PAGE','4006',jdecode('Trallwm+Farmhouse+%287%29'),jdecode(''), jdecode('%2F2052%2F4006.html'), 'true',[],'',''],
		['PAGE','4027',jdecode('Trawsgyrch+%289%29'),jdecode(''), jdecode('%2F2052%2F4027.html'), 'true',[],'','']
	],'',''],
	['PAGE','89901',jdecode('Activities+at+Trallwm'),jdecode(''), jdecode('%2F89901.html'), 'true',[],'',''],
	['PAGE','2094',jdecode('Our+Area'),jdecode(''), jdecode('%2F2094%2Findex.html'), 'true',[ 
		['PAGE','4069',jdecode('Places+to+eat+and+drink'),jdecode(''), jdecode('%2F2094%2F4069.html'), 'true',[],'',''],
		['PAGE','75301',jdecode('Attractions'),jdecode(''), jdecode('%2F2094%2F75301.html'), 'true',[],'','']
	],'',''],
	['PAGE','60401',jdecode('What+is+provided%3F'),jdecode(''), jdecode('%2F60401.html'), 'true',[],'',''],
	['PAGE','2178',jdecode('Terms+and+Conditions'),jdecode(''), jdecode('%2F2178.html'), 'true',[],'',''],
	['PAGE','61301',jdecode('Hampers'),jdecode(''), jdecode('%2F61301.html'), 'true',[],'',''],
	['PAGE','2115',jdecode('Tariffs'),jdecode(''), jdecode('%2F2115.html'), 'true',[],'',''],
	['PAGE','2136',jdecode('Location'),jdecode(''), jdecode('%2F2136.html'), 'true',[],'',''],
	['PAGE','59701',jdecode('Events'),jdecode(''), jdecode('%2F59701.html'), 'true',[],'',''],
	['PAGE','29801',jdecode('Christmas+%26+New+Year'),jdecode(''), jdecode('%2F29801.html'), 'true',[],'',''],
	['PAGE','4132',jdecode('Reflexology'),jdecode(''), jdecode('%2F4132.html'), 'true',[],'',''],
	['PAGE','59301',jdecode('Green+Business+Tourism'),jdecode(''), jdecode('%2F59301.html'), 'true',[],'',''],
	['PAGE','13101',jdecode('Gallery'),jdecode(''), jdecode('%2F13101.html'), 'true',[],'',''],
	['PAGE','17801',jdecode('Contact+Us'),jdecode(''), jdecode('%2F17801.html'), 'true',[],'','']];
var siteelementCount=26;
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 localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'hostway',
  product: 'WSCSYSSSSLYTC245'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Dots',
				paletteFamily: 	'E7E9D5',
				keyvisualId: 	'421',
				keyvisualName: 	'alte_moebel.jpg',
				fontsetId: 		'43',
				graphicsetId: 	'49',
				contentColor: 	'000000',
				contentBGColor: 'E7E9D5',
				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: '20111211-053643'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2052',
internalId:  '',
customField: '20110804-095819'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2073',
internalId:  '',
customField: '20110804-100837'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2094',
internalId:  '',
customField: '20110328-075106'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2115',
internalId:  '',
customField: '20120106-055336'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2136',
internalId:  '',
customField: '20100910-142716'
};
webappMappings['1501']=webappMappings['1501-5386755']={
webappId:    '1501',
documentId:  '2001',
internalId:  '5386755',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3901',
internalId:  '',
customField: '20111208-112836'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4027',
internalId:  '',
customField: '20111208-115243'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2001',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '100812',
internalId:  '',
customField: '20120106-065720'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3922',
internalId:  '',
customField: '20111211-045729'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3943',
internalId:  '',
customField: '20111208-113228'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3964',
internalId:  '',
customField: '20111211-052317'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3985',
internalId:  '',
customField: '20111208-115721'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4006',
internalId:  '',
customField: '20111208-120501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17801',
internalId:  '',
customField: '20110615-154242'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4069',
internalId:  '',
customField: '20100910-135406'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '61301',
internalId:  '',
customField: '20110719-163349'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2178',
internalId:  '',
customField: '20110922-064555'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '89901',
internalId:  '',
customField: '20110922-064140'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4132',
internalId:  '',
customField: '20100910-143213'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '59301',
internalId:  '',
customField: '20110804-095336'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29801',
internalId:  '',
customField: '20120106-053529'
};
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: '20100324-070159'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '59701',
internalId:  '',
customField: '20111112-110820'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '60401',
internalId:  '',
customField: '20100914-124704'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '75301',
internalId:  '',
customField: '20110328-075610'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker04.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();
};

