/* [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','6401',jdecode('Home'),jdecode(''),'/6401.html','true',[],''],
	['PAGE','6578',jdecode('Online+reservation'),jdecode(''),'/6578.html','true',[],''],
	['PAGE','6452',jdecode('Our+Hotel'),jdecode(''),'/6452/index.html','true',[ 
		['PAGE','6473',jdecode('The+Rooms'),jdecode(''),'/6452/6473.html','true',[],''],
		['PAGE','6494',jdecode('The+Breakfast'),jdecode(''),'/6452/6494.html','true',[],''],
		['PAGE','6515',jdecode('The+Pool%2FSpa'),jdecode(''),'/6452/6515.html','true',[],''],
		['PAGE','6536',jdecode('Location'),jdecode(''),'/6452/6536.html','true',[],'']
	],''],
	['PAGE','6557',jdecode('Price+and+Service'),jdecode(''),'/6557.html','true',[],''],
	['PAGE','40901',jdecode('Events'),jdecode(''),'/40901.html','true',[],''],
	['PAGE','6599',jdecode('Contact'),jdecode(''),'/6599.html','true',[],''],
	['PAGE','6683',jdecode('Links'),jdecode(''),'/6683.html','true',[],'']];
var siteelementCount=11;
theSitetree.topTemplateName='Borders';
theSitetree.paletteFamily='A6CBB5';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10432';
theSitetree.graphicsetId='10774';
theSitetree.contentColor='692643';
theSitetree.contentBGColor='FEFEF8';
var theTemplate={
				name: 			'Borders',
				paletteFamily: 	'A6CBB5',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10432',
				graphicsetId: 	'10774',
				contentColor: 	'692643',
				contentBGColor: 'FEFEF8',
				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: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6401',
internalId:  '',
customField: '20090717-135007'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6452',
internalId:  '',
customField: '20090717-133245'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6473',
internalId:  '',
customField: '20090723-134036'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6494',
internalId:  '',
customField: '20090717-133707'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6536',
internalId:  '',
customField: '20090423-141149'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6578',
internalId:  '',
customField: '20090723-133949'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6599',
internalId:  '',
customField: '20090507-175309'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6515',
internalId:  '',
customField: '20090417-172131'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6683',
internalId:  '',
customField: '20090717-133943'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6557',
internalId:  '',
customField: '20090723-134240'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40901',
internalId:  '',
customField: '20090524-135226'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '6401',
internalId:  '1006',
customField: '1006'
};
var canonHostname = 'wsc-worker03.chi.us.siteprotect.com';
var accountId     = 'AHW050INLWBX';
var companyName   = 'Chateau+Westport';
var htmlTitle	  = 'ChateauWestport.com%2FRates';
var metaKeywords  = 'westport%2C+washington%2C+coast%2C+Whale+watching%2C+Fishing%2C+Family+Vacation%2C+Kite+Flying%2C+washington+coast%2C+surfing%2C+pirates%2C+wine%2C+family+vacation%2C+coastal+events%2C+event+hosts%2C+weddings%2C+fun%2C+outdoor%2C+hotel%2C+resort';
var metaContents  = 'The+Chateau+Westport.++Located+on+27+Private+Acres+adjacent+to+18+miles+of+uninterrupted+beach.++104+Units%2C+many+with+Kitchens%2C+Fireplaces%2C+Patios.Free+Wifi+and+Breakfast+Buffet.Indoor+Heated+Pool+and+Hot+Tub';
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();
};
