/* [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','3201',jdecode('Home'),jdecode(''),'/3201.html','true',[],'',''],
	['PAGE','3273',jdecode('Room+Themes'),jdecode(''),'/3273.html','true',[],'',''],
	['PAGE','3336',jdecode('Room+Rates'),jdecode(''),'/3336.html','true',[],'',''],
	['PAGE','3357',jdecode('Online+Reservation+Request+Form'),jdecode(''),'/3357.html','true',[],'',''],
	['PAGE','3294',jdecode('Restaurant+%26+Cantinas'),jdecode(''),'/3294.html','true',[],'',''],
	['PAGE','42834',jdecode('Testimonials'),jdecode(''),'/42834.html','true',[],'',''],
	['PAGE','3315',jdecode('Local+Attractions+%26+Activities'),jdecode(''),'/3315.html','true',[],'',''],
	['PAGE','3378',jdecode('Weddings+%26+Events'),jdecode(''),'/3378.html','true',[],'',''],
	['PAGE','3252',jdecode('Driving+Directions+%26+Insurance'),jdecode(''),'/3252.html','true',[],'',''],
	['PAGE','3399',jdecode('Contacting+Us'),jdecode(''),'/3399.html','true',[],'',''],
	['PAGE','10301',jdecode('Special+Offers'),jdecode(''),'/10301.html','true',[],'',''],
	['PAGE','29315',jdecode('Press'),jdecode(''),'/29315.html','true',[],'','']];
var siteelementCount=12;
theSitetree.topTemplateName='Odd';
theSitetree.paletteFamily='DCE5FA';
theSitetree.keyvisualId='12135';
theSitetree.keyvisualName='kv_12135.jpg';
theSitetree.fontsetId='33321';
theSitetree.graphicsetId='14195';
theSitetree.contentColor='5C657A';
theSitetree.contentBGColor='DCE5FA';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Odd',
				paletteFamily: 	'DCE5FA',
				keyvisualId: 	'12135',
				keyvisualName: 	'kv_12135.jpg',
				fontsetId: 		'33321',
				graphicsetId: 	'14195',
				contentColor: 	'5C657A',
				contentBGColor: 'DCE5FA',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Palatino Linotype, Book Antiqua, Palatino, serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3201',
internalId:  '',
customField: '20090806-050617'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3273',
internalId:  '',
customField: '20090919-152729'
};
webappMappings['7008']=webappMappings['7008-1637']={
webappId:    '7008',
documentId:  '3357',
internalId:  '1637',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3357',
internalId:  '',
customField: '20100324-110155'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3336',
internalId:  '',
customField: '20100324-110126'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3294',
internalId:  '',
customField: '20100324-110234'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3378',
internalId:  '',
customField: '20090623-104512'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3252',
internalId:  '',
customField: '20090722-190156'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3399',
internalId:  '',
customField: '20100211-073332'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3315',
internalId:  '',
customField: '20090627-070058'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10301',
internalId:  '',
customField: '20100324-110713'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '3201',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-20409911']={
webappId:    '1501',
documentId:  '3201',
internalId:  '20409911',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29315',
internalId:  '',
customField: '20090920-120932'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42834',
internalId:  '',
customField: '20090804-133557'
};
var canonHostname = 'wscwrk01.ehost-services.com';
var accountId     = 'AEN330INFCPC';
var companyName   = 'Poco+Cielo';
var htmlTitle	  = 'Poco+Cielo%2C+Baja%27s+favorite+small+hotel%21';
var metaKeywords  = 'Poco+CIelo%2C+Hotels+in+Baja%2C+Rosarito%2C+Ensenada%2C+Puerto+Nuevo%2C+Restaurant%2C+Bar%2C+Theme+Rooms%2C+Ocean+Front%2C+Beach+Hotel';
var metaContents  = 'HEAD+Poco+Cielo%2C+Bajas+Favorite+Small+Hotel%21+%2FHEAD';
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();
};
