/* [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','401',jdecode('Home'),jdecode(''),'/401.html','true',[],'',''],
	['PAGE','1622',jdecode('Dining'),jdecode(''),'/1622/index.html','true',[ 
		['PAGE','6001',jdecode('This+Week%26%23x27%3Bs+Menu'),jdecode(''),'/1622/6001.html','true',[],'',''],
		['PAGE','6022',jdecode('Wine+List'),jdecode(''),'/1622/6022.html','true',[],'',''],
		['PAGE','20001',jdecode('Beer+List'),jdecode(''),'/1622/20001.html','true',[],'','']
	],'',''],
	['PAGE','1643',jdecode('Accomodations'),jdecode(''),'/1643.html','true',[],'',''],
	['PAGE','1664',jdecode('About+us'),jdecode(''),'/1664.html','true',[],'',''],
	['PAGE','1685',jdecode('Our+neighbourhood'),jdecode(''),'/1685.html','true',[],'',''],
	['PAGE','1706',jdecode('Links'),jdecode(''),'/1706.html','true',[],'',''],
	['PAGE','1727',jdecode('Contact'),jdecode(''),'/1727.html','true',[],'',''],
	['PAGE','24201',jdecode('How+to+find+us'),jdecode(''),'/24201/index.html','true',[ 
		['PAGE','24501',jdecode('Map'),jdecode(''),'/24201/24501.html','true',[],'','']
	],'',''],
	['PAGE','21806',jdecode('Guestbook'),jdecode(''),'/21806/index.html','true',[ 
		['PAGE','21801',jdecode('Read+Guestbook'),jdecode(''),'/21806/21801.html','false',[],'','']
	],'',''],
	['PAGE','23801',jdecode('Photo+Book'),jdecode(''),'/23801.html','true',[],'','']];
var siteelementCount=15;
theSitetree.topTemplateName='Enjoy';
theSitetree.paletteFamily='FF9F21';
theSitetree.keyvisualId='2224';
theSitetree.keyvisualName='blanko.jpg';
theSitetree.fontsetId='364';
theSitetree.graphicsetId='418';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FF9F21';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Enjoy',
				paletteFamily: 	'FF9F21',
				keyvisualId: 	'2224',
				keyvisualName: 	'blanko.jpg',
				fontsetId: 		'364',
				graphicsetId: 	'418',
				contentColor: 	'000000',
				contentBGColor: 'FF9F21',
				a_color: 		'FF9F21',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20080515-151334'
};
webappMappings['1002']=webappMappings['1002-21806AHW050INXS3R']={
webappId:    '1002',
documentId:  '21806',
internalId:  '21806AHW050INXS3R',
customField: 'icq=false'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '24501',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:false;'
};
webappMappings['7060']=webappMappings['7060-8a4fee5df5bf4751482ba2aa0dafdc59']={
webappId:    '7060',
documentId:  '23801',
internalId:  '8a4fee5df5bf4751482ba2aa0dafdc59',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1622',
internalId:  '',
customField: '20080515-151527'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6001',
internalId:  '',
customField: '20100720-180234'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6022',
internalId:  '',
customField: '20080515-231431'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20001',
internalId:  '',
customField: '20080111-170701'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1643',
internalId:  '',
customField: '20100711-143421'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1664',
internalId:  '',
customField: '20080109-223723'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1685',
internalId:  '',
customField: '20080111-144727'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1706',
internalId:  '',
customField: '20080515-151350'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1727',
internalId:  '',
customField: '20090406-110739'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24201',
internalId:  '',
customField: '20080112-021848'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24501',
internalId:  '',
customField: '20080112-020915'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21806',
internalId:  '',
customField: '20080111-163819'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21801',
internalId:  '',
customField: '20080111-152201'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23801',
internalId:  '',
customField: '20080111-170927'
};
webappMappings['1501']=webappMappings['1501-28030']={
webappId:    '1501',
documentId:  '401',
internalId:  '28030',
customField: '1501'
};
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050INXS3R';
var companyName   = 'The+Old+Hotel';
var htmlTitle	  = 'The+Old+Hotel++Restaurant+and+Bed++Breakfast';
var metaKeywords  = 'restaurant%2C+restaurants%2C+fine+dining%2C+Twin+Bridges%2C+BB%2C+Bed++Breakfast%2C+bed+and+breakfast%2C+bed+and+breakfasts%2C+bbs%2C+Bed++Breakfasts%2C+Montana%2C+motel%2C+motels%2C+hotel%2C+hotels%2C+accomodation%2C+accomodations%2C+rooms%2C+cabin%2C+cabins%2C+beaverhead+river%2C+big+hole+river%2C+jefferson+river%2C+ruby+valley%2C+ruby+river%2C+big+sky%2C+flyfishing%2C+fly+fishing%2C+guides%2C+guide+service%2C+guide+services%2C+guided+trips%2C+float+trip%2C+float+trips%2C+vacation+rental%2C+vacation+rentals%2C+yellowstone+national+park%2C+ynp%2C+trout%2C+trout+fishing%2C+madison+river%2C+sheridan%2C+silver+star%2C+ennis%2C+alder';
var metaContents  = 'We+offer+fine+dining+and+a+Bed++Breakfast.+We+are+open+to+the+public%2C+serving+breakfast+and+dining%2C+catering+to+visitors+and+locals+alike.+We+are+located+in+Twin+Bridges%2C+Montana+near+the+Beaverhead%2C+Big+Hole%2C+Ruby%2C+and+Jefferson+Rivers...A+Great+Fly+Fishing+Retreat%21';
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();
};
