/* [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','501',jdecode('Home'),jdecode(''),'/501.html','true',[],''],
	['PAGE','552',jdecode('Our+Guest+House'),jdecode(''),'/552.html','true',[],''],
	['PAGE','573',jdecode('Rooms'),jdecode(''),'/573.html','true',[],''],
	['PAGE','594',jdecode('Things+to+do'),jdecode(''),'/594.html','true',[],''],
	['PAGE','16001',jdecode('Places+to+Visit'),jdecode(''),'/16001.html','true',[],''],
	['PAGE','6201',jdecode('Photo+Gallery'),jdecode(''),'/6201.html','true',[],''],
	['PAGE','18601',jdecode('Tariff'),jdecode(''),'/18601.html','true',[],''],
	['PAGE','18622',jdecode('Menus'),jdecode(''),'/18622.html','true',[],''],
	['PAGE','34401',jdecode('Dining+Out'),jdecode(''),'/34401.html','true',[],''],
	['PAGE','636',jdecode('Contact+us'),jdecode(''),'/636.html','true',[],''],
	['PAGE','13701',jdecode('Directions'),jdecode(''),'/13701.html','true',[],''],
	['PAGE','5706',jdecode('Guestbook'),jdecode(''),'/5706/index.html','true',[ 
		['PAGE','5701',jdecode('Read+Guestbook'),jdecode(''),'/5706/5701.html','false',[],'']
	],''],
	['PAGE','34601',jdecode('Recommendations'),jdecode(''),'/34601.html','true',[],'']];
var siteelementCount=14;
theSitetree.topTemplateName='Livinginamerica';
theSitetree.paletteFamily='83A270';
theSitetree.keyvisualId='6338';
theSitetree.keyvisualName='kv_6338.jpg';
theSitetree.fontsetId='11152';
theSitetree.graphicsetId='11957';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='D1E0C7';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				name: 			'Livinginamerica',
				paletteFamily: 	'83A270',
				keyvisualId: 	'6338',
				keyvisualName: 	'kv_6338.jpg',
				fontsetId: 		'11152',
				graphicsetId: 	'11957',
				contentColor: 	'000000',
				contentBGColor: 'D1E0C7',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1002']=webappMappings['1002-5706anbt10inxp4h']={
webappId:    '1002',
documentId:  '5706',
internalId:  '5706anbt10inxp4h',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5701',
internalId:  '',
customField: '20070419-114157'
};
webappMappings['7060']=webappMappings['7060-96a6be6547bdd88b6aaea667bb259146']={
webappId:    '7060',
documentId:  '6201',
internalId:  '96a6be6547bdd88b6aaea667bb259146',
customField: 'language:en;country:GB;'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '13701',
internalId:  'location',
customField: 'language:en;country:GB;isIncluded:false;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '501',
internalId:  '',
customField: '20090711-091121'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '573',
internalId:  '',
customField: '20080926-132914'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '552',
internalId:  '',
customField: '20090221-130557'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '594',
internalId:  '',
customField: '20071205-182449'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16001',
internalId:  '',
customField: '20090317-095731'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6201',
internalId:  '',
customField: '20070729-091801'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13701',
internalId:  '',
customField: '20070806-180212'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '636',
internalId:  '',
customField: '20071027-091030'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5706',
internalId:  '',
customField: '20070729-091944'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18601',
internalId:  '',
customField: '20090806-195432'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18622',
internalId:  '',
customField: '20090806-195808'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '501',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34401',
internalId:  '',
customField: '20090711-091225'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34601',
internalId:  '',
customField: '20090926-084652'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10INXP4H';
var companyName   = 'Tal-y-bont+Country+House+B+%26+B';
var htmlTitle	  = 'Bed+and+breakfast+accommodation+in+Snowdonia+North+Wales';
var metaKeywords  = 'META+name%3Dkeywords+content%3Dsnowdonia+bed+and+breakfast%2Caccommodation+in+snowdonia%2Csnowdonia+accommodation%2Choliday+cottages+snowdonia%2Cb+b+snowdonia%2Ccottages+in+snowdonia%2Cbed+and+breakfast+in+snowdonia%2Csnowdonia+cottage%2Csnowdonia+log+cabins%2Csnowdonia+guest+house%2Csnowdonia+walking%2C.div+id%3DTA_rated985+class%3DTA_ratedul+class%3DTA_links++++++++++++lia+href%3Dhttp%3A%2F%2Fwww.tripadvisor.co.uk%2FHotel_Review-g674812-d787911-Reviews-Tal_Y_Bont_Country_House_B_B-Blaenau_Ffestiniog_Snowdonia_National_Park_North_Wales_Wales.htmlTal-Y-Bont+Country+House+BB%2Fa%2Fli++++++%2Ful++%2Fdivscript+src%3Dhttp%3A%2F%2Fwww.tripadvisor.co.uk%2FWidgetEmbed-rated%3Funiq%3D985amp%3BlocationId%3D787911amp%3Blang%3DUK%2Fscriptsnowdonia+national+park%2Choliday+in+park+snowdonia%2Csnowdonia+tourist+information%2Csnowdonia+holidays%2Csnowdonia+walks%2Cholidays+in+north+wales%2Choliday+cottage+north+wales%2Cbed+and+breakfast+in+north+wales%2Cnorth+wales+accommodation%2Cnorth+wales+bed+and+breakfast+%2Cholidays+north+wales+%2Cshort+breaks+north+wales%2Cclimbing+snowdon%2C+www.tal-y-bontcountryhouse.co.uk';
var metaContents  = 'Bed+and+breakfast+in+Tal-y-bont+Country+House+in+the+heast+of+Snowdonia+where+a+warm+welcome+awaits.++Comfortable+rooms+with+bath+and%2For+shower.++Plenty+of+things+to+do+and+places+to+visit%2C++Ideally+situated+for+all+outdoor+sports+including+hiking%2C+climbing%2C+mountain+biking%2C+fishing%2C+golf%2C+kayaking+and+white+water+rafting.';
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();
};
