/* [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','701',jdecode('Home'),jdecode(''),'/701.html','true',[],''],
	['PAGE','794',jdecode('Contact+Info+%26+Map'),jdecode(''),'/794.html','true',[],''],
	['PAGE','815',jdecode('Opening+hours'),jdecode(''),'/815.html','true',[],''],
	['PAGE','836',jdecode('Our+Menu'),jdecode(''),'/836.html','true',[],''],
	['PAGE','920',jdecode('Entertainment'),jdecode(''),'/920.html','true',[],''],
	['PAGE','857',jdecode('Services'),jdecode(''),'/857.html','true',[],''],
	['PAGE','899',jdecode('Reservations'),jdecode(''),'/899.html','true',[],''],
	['PAGE','12106',jdecode('Guestbook'),jdecode(''),'/12106/index.html','true',[ 
		['PAGE','12101',jdecode('Read+Guestbook'),jdecode(''),'/12106/12101.html','true',[],'']
	],''],
	['PAGE','20501',jdecode('Photos'),jdecode(''),'/20501.html','true',[],'']];
var siteelementCount=10;
theSitetree.topTemplateName='Vignette';
theSitetree.paletteFamily='E79E6E';
theSitetree.keyvisualId='3549';
theSitetree.keyvisualName='kv_3549.jpg';
theSitetree.fontsetId='10784';
theSitetree.graphicsetId='10833';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Vignette',
				paletteFamily: 	'E79E6E',
				keyvisualId: 	'3549',
				keyvisualName: 	'kv_3549.jpg',
				fontsetId: 		'10784',
				graphicsetId: 	'10833',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'E79E6E',
				e_color: 		'886146',
				f_color: 		'C97556',
				hasCustomLogo: 	'false',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '701',
internalId:  '1006',
customField: '1006'
};
webappMappings['1002']=webappMappings['1002-12106awh020in2dzc']={
webappId:    '1002',
documentId:  '12106',
internalId:  '12106awh020in2dzc',
customField: 'icq=false'
};
webappMappings['7008']=webappMappings['7008-44']={
webappId:    '7008',
documentId:  '857',
internalId:  '44',
customField: 'language:en;country:US;'
};
webappMappings['7008']=webappMappings['7008-45']={
webappId:    '7008',
documentId:  '899',
internalId:  '45',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '701',
internalId:  '',
customField: '20100208-215750'
};
webappMappings['7008']=webappMappings['7008-46']={
webappId:    '7008',
documentId:  '701',
internalId:  '46',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '794',
internalId:  '',
customField: '20080825-211031'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '815',
internalId:  '',
customField: '20080703-180704'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '836',
internalId:  '',
customField: '20080708-002843'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '920',
internalId:  '',
customField: '20100208-221125'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '857',
internalId:  '',
customField: '20080825-211143'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '899',
internalId:  '',
customField: '20080703-181332'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12106',
internalId:  '',
customField: '20080703-180153'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12101',
internalId:  '',
customField: '20080608-163358'
};
webappMappings['7060']=webappMappings['7060-fcb3b24de1d6003f73c31b5cebfc2b91']={
webappId:    '7060',
documentId:  '20501',
internalId:  'fcb3b24de1d6003f73c31b5cebfc2b91',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20501',
internalId:  '',
customField: '20080702-233128'
};
webappMappings['1501']=webappMappings['1501-2208365']={
webappId:    '1501',
documentId:  '701',
internalId:  '2208365',
customField: '1501'
};
var canonHostname = 'cm4all01.west-datacenter.net';
var accountId     = 'AWH020IN2DZC';
var companyName   = 'Deer+Cliff+Inn';
var htmlTitle	  = 'Deer+Cliff+Inn';
var metaKeywords  = 'deer%2C+cliff%2C+inn%2C+preston%2C+idaho%2C+restaurant%2C+rustic%2C+scenic%2C+entertainment%2C+live%2C+local%2C+bands%2C+cabin%2C+cub+river%2C+tyra';
var metaContents  = 'DEER+CLIFF+INN%2C+PRESTON%2C+IDAHO+Since+1940%2C+rustic+Deer+Cliff+Inn+near+Preston%2C+Idaho+has+been+considered+the+most+romantic+spot+in+the+West.+Open+May+thru+October.+Reservations%3A+%28208%29+852-0643.+Dining+on+our+outdoor+patio+or+indoors.';
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();
};
