var menuTimeOut=0;var activeMenu="";google.load("jquery","1.4.2");if(document.getElementById("wrapper").className.indexOf("reservations")!=-1){google.load("jqueryui","1.8.1")}google.setOnLoadCallback(function(){$(document).ready(function(){$(".navigation .services > a").hover(function(){menu.onMenuOver.call(this,"services")},menu.onMenuOut).attr("href","#");$(".navigation .services li a").hover(menu.onMenuChildrenOver,menu.onMenuChildrenOut);$(".navigation .information > a").hover(function(){menu.onMenuOver.call(this,"information")},menu.onMenuOut).attr("href","#");$(".navigation .information li a").hover(menu.onMenuChildrenOver,menu.onMenuChildrenOut);if($("#wrapper").hasClass("rooms")){rooms.init()}else{if($("#wrapper").hasClass("reservations")){reservations.init()}else{if($("#wrapper").hasClass("offers")){offers.init()}}}banner.init();tripAdvisor.init()})});var tripAdvisor={initInterval:0,count:0,init:function(){tripAdvisor.initInterval=setInterval(tripAdvisor.start,500)},start:function(){if($("#CDSWIDSSP").length){$("#trip-advisor").appendTo("#trip-advisor-holder");$("#CDSWIDSSP").css("width","140px");$("#trip-advisor").fadeIn("slow");tripAdvisor.count=10}if(tripAdvisor.count>5){clearInterval(tripAdvisor.initInterval);return}tripAdvisor.count++}};var ajax={send:function(i,h,j,g){var f="ajax.html";if(typeof(j)=="string"){g=j;j=undefined}if(j!=undefined){j=ajax.handleError}if(g!=undefined){f=g}$.ajax({data:i,dataType:"json",error:j,success:h,type:"POST",url:f})},handleError:function(f,e,d){if(console){console.log(d)}}};var banner={container:null,holder:null,top:0,currentBanner:0,speed:35,init:function(){banner.contWidth=parseInt($("#offers-banner").width());banner.holder=$("#offers-banner .message");banner.top=parseInt(banner.holder.css("top"));banner.currentBanner=cookie("cbid");banner.changeBanner()},getWidth:function(b){var a=banner.holder.html(b).css({top:"0",left:"0",width:"auto"}).width();banner.holder.css({top:banner.top+"px",left:"500px",display:"block"});return a},changeBanner:function(){cookie("cbid",banner.currentBanner);ajax.send({a:"nb",bid:banner.currentBanner},banner.changeBanner_handle,banner.onError)},changeBanner_handle:function(d){if(!d.error){var c=d.data,e=banner.getWidth(c.title),f=parseInt(1000*(e+500)/banner.speed);banner.currentBanner=c.id;$("#offers-banner .message").html(c.title).css({left:"500px",width:(e+10)+"px"}).animate({left:-1*e},f,"linear",banner.changeBanner);$("#offers-banner").attr("href",c.url);return}banner.onError()},onError:function(){$("#offers-banner").css("display","none")}};var message={closeInterval:0,isVisible:false,showSuccess:function(c,d){message.show(c,"success",d);return true},showError:function(c,d){message.show(c,"error",d);return true},show:function(f,d,e){$("#info-message").html(f).attr("class",d);if(message.closeInterval!=0){clearInterval(message.closeInterval);message.closeInterval=0}if(!message.isVisible){message.isVisible=true;$("#info-message").fadeIn("slow")}if(e==undefined||e===true){message.closeInterval=setInterval(message.hide,6000)}},hide:function(){if(message.closeInterval!=0){clearInterval(message.closeInterval);message.closeInterval=0}if(message.isVisible){message.isVisible=false;$("#info-message").fadeOut("slow")}}};var menu={onMenuOver:function(b){if(menuTimeOut!=0){menu.hideMenu()}$(this).addClass("mouse-over");$(".navigation ."+b+" ul").fadeIn("fast");activeMenu=b},onMenuOut:function(){if(menuTimeOut!=0){window.clearTimeout(menuTimeOut);menuTimeOut=0}menuTimeOut=window.setTimeout(menu.hideMenu,200)},onMenuChildrenOver:function(){if(menuTimeOut!=0){window.clearTimeout(menuTimeOut);menuTimeOut=0}},onMenuChildrenOut:function(){if(activeMenu!=""){if(menuTimeOut!=0){window.clearTimeout(menuTimeOut);menuTimeOut=0}menuTimeOut=window.setTimeout(menu.hideMenu,200)}},hideMenu:function(){if(activeMenu!=""){window.clearTimeout(menuTimeOut);menuTimeOut=0;$(".navigation ."+activeMenu+" > a").removeClass("mouse-over");$(".navigation ."+activeMenu+" ul").fadeOut("fast");activeMenu=""}return true}};var gallery={showImage:function(c){var d=gallery._getById(c);if(d){$(".gallery .loading").show();$(".gallery .display img").fadeOut("slow",function(){$(this).bind("load",function(a){$(".gallery .loading").hide();$(this).fadeIn("slow");$(".gallery .display span").html(d.caption).fadeIn("slow")}).attr("src",d.medium)});$(".gallery .display span").fadeOut("slow")}},_getById:function(f){for(var e=0,d=galleryDatabase.length;e<d;e++){if(f==galleryDatabase[e].id){return galleryDatabase[e]}}return false}};var rooms={init:function(){$(".room .season").hover(function(b){$(".header",this).css("background-color","#f5f5f5");$(".price",this).css("background","#fff url(../image/room/highlight-fade-bg.gif) repeat-x top left")},function(b){$(".header",this).css("background-color","#fefefe");$(".price",this).css("background","#fff")})}};var offers={init:function(){$(".offers .offer-content").css("display","none");var b=window.location.hash;if(b){offers.click(b.substring(1))}},click:function(h){var j="#offer-"+h;var f=$(j).data("status");if(f==undefined){f="closed";$(j).data("status",f)}var g=f=="open"?offerShow:offerHide;var i=f=="open"?offerShowIcon:offerHideIcon;f=f=="open"?"closed":"open";$(j).data("status",f);$(j+" .icon").html(i);$(j+" .message").html(g);$(j+" .offer-content").slideToggle(2000,function(){if(f=="open"){window.location.hash=h}})}};var reservations={init:function(){var o=$("body").attr("class");var r="MM/dd/yy";var p=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var f=["Su","Mo","Tu","We","Th","Fr","Sa"];var m=["January","February","March","April","May","June","July","August","September","October","November","December"];if(o.indexOf("espanol")!=-1){r="dd/MM/yy";p=["Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sabado"];f=["Do","Lu","Ma","Mi","Ju","Vi","Sa"];m=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"]}else{if(o.indexOf("francais")!=-1){r="dd/MM/yy";p=["Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"];f=["Di","Lu","Ma","Me","Je","Ve","Sa"];m=["Janvier","F&eacute;vrier","Mars","Avril","Mai","Juin","Juillet","Ao&ucirc;t","Septembre","Octobre","Novembre","D&eacute;cembre"]}}$(".reservations .date-field").datepicker({altFormat:"yy-mm-dd",dateFormat:r,dayNames:p,dayNamesMin:f,monthNames:m,minDate:"+1",maxDate:"+10Y",onSelect:function(a,b){if(this.value!=""){$(this).removeClass("warning")}}}).blur($(".reservations .date-field").datepicker("option","onSelect"));$("#from-date").datepicker("option","altField","#server-from-date");$("#to-date").datepicker("option","altField","#server-to-date");$("#from-date").datepicker("option","onSelect",function(a,b){var c=$("#server-from-date").attr("value");if(c!=""){c=c.split("-");$("#to-date").datepicker("option","minDate",new Date(c[0],parseInt(c[1])-1,parseInt(c[2])+1))}});$(".room-details").css("display","block");$("#room-type").change(function(){var a=document.getElementById("room-type");roomId=a.options[a.selectedIndex].value;ajax.send({a:"rd",rid:roomId},reservations.updateRoomInfo,reservations.updateRoomInfoError);$(".room-details img:last").fadeIn("fast")}).attr("selectedIndex","0");$("#reservation-form").submit(reservations.validate);var i=window.location.hash;i=i.slice(2).split("/");if(i[0]=="room-type"){var n=0;var q=$("#room-type").attr("options");for(var n=0,h=q.length;n<h;n++){if(i[1]==q[n].value){$("#room-type").attr("selectedIndex",n).change();break}}}},updateRoomInfo:function(b){if(b.status!="error"){if($(".room-details").css("display")=="none"){$(".room-details").fadeIn("fast")}$(".room-details img:last").fadeOut("fast");$(".room-details img:first").attr("src",b.data.image);$(".room-details span").html(b.data.description);return}reservations.updateRoomInfoError()},updateRoomInfoError:function(f,e,d){$(".room-details").fadeOut("fast")},validate:function(){if(!reservations.validateName()){return false}if(!reservations.validateEmail()){return false}if(!reservations.validatePhone()){return false}if(!reservations.validateDates()){return false}if(!reservations.validatePolicy()){return false}var d={};d["full-name"]=document.getElementById("full-name").value;d.email=document.getElementById("email").value;d["newsletter-subscribe"]=document.getElementById("newsletter-subscribe").checked;d["tel-fax"]=document.getElementById("tel-fax").value;d["from-date"]=document.getElementById("from-date").value;d["to-date"]=document.getElementById("to-date").value;d["server-from-date"]=document.getElementById("server-from-date").value;d["server-to-date"]=document.getElementById("server-to-date").value;d["special-offer"]=document.getElementById("special-offer").value;d["room-type"]=document.getElementById("room-type").value;d["number-rooms"]=document.getElementById("number-rooms").value;d["number-persons"]=document.getElementById("number-persons").value;d.comments=document.getElementById("comments").value;d.ajax="true";var c="We are sending your request. Please wait...";switch(language){case"espanol":c="Estamos enviando su solicitud. Por favor espere...";break;case"francais":c="Nous envoyons votre demande. S&apos;il vous pla&icirc;t attendre...";break}$("#send").attr("disabled","disabled");message.showSuccess(c,false);ajax.send(d,reservations.submitSuccess,reservations.submitError,"process-reservations.html");return false},clear:function(){$(".reservations input:text").attr("value","");$(".reservations select").each(function(b){$(this).attr("selectedIndex","0")});$(".reservations input:checkbox").attr("checked","");$(".reservations textarea").attr("value","")},submitSuccess:function(c,d){message.hide();if(!c.error){$(".reservations .content .content-compact").fadeOut("slow");$(".form-holder").fadeOut("slow",function(){$(".success-confirmation-message").fadeIn("slow")});return}reservations.submitError()},submitError:function(d,e){$("#send").attr("disabled","");var f='We are sorry, but we are experience some technical problems and we didn&apos;t receive your information.  Please send us an email with your information to <a href="mailto:alhambr7@prodigy.net.mx">alhambr7@prodigy.net.mx</a>.<br />Thank you.';switch(language){case"espanol":f='Lo sentimos, pero estamos experimentando problemas t&eacute;cnicos y no recibimos su informaci&oacute;n. Por favor env&iacute;enos un correo a <a href="mailto:alhambr7@prodigy.net.mx">alhambr7@prodigy.net.mx</a> con su informaci&oacute;n y con mucho gusto le atenderemos.<br />Gracias.';break;case"francais":f='Nous sommes d&eacute;sol&eacute;s, mais nous sommes rencontrer certains probl&egrave;mes techniques et nous n&apos;avons pas re&ccedil;u vos informations. S&apos;il vous pla&icirc;t envoyez-nous un courriel avec vos informations &agrave; <a href="mailto:alhambr7@prodigy.net.mx">alhambr7@prodigy.net.mx</a>.<br />Merci beaucoup.';break}message.showError(f,false)},validateName:function(){var h=document.getElementById("full-name").value;var g=/\w{2,}/;var b=g.test(h);if(!b){var f="";switch(language){case"espanol":f="Su nombre es muy corto, por favor ingrese su nombre completo.";break;case"francais":f="Votre nom est trop court, s&apos;il vous pla&icirc;t entrer votre nom et pr&eacute;nom.";break;case"english":default:f="Your name is too short, please enter your full name.";break}$("#full-name").addClass("warning").focus();message.showError(f);return false}$("#full-name").removeClass("warning");return true},validateEmail:function(){var h=document.getElementById("email").value;var f="Please verify you email, it doesn&apos;t appear to be valid.";switch(language){case"espanol":f="Por favor verif&iacute;que el email ingresado, no parece ser v&aacute;lido.";break;case"francais":f="Votre adresse email ne semble pas valable. Veuillez la v&eacute;rifier.";break}var g=/\w[\!-\~]*\@[\!-\~]+\w/;var e=/^[a-z0-9][^\(\)\<\>\@\,\;\:\\\"\[\]]*\@[a-z0-9\-\.]*\.[a-z]{2,4}$/i;if(!g.test(h)){$("#email").addClass("warning").focus();message.showError(f);return false}$("#email").removeClass("warning");return true},validatePhone:function(){var g=document.getElementById("tel-fax").value;var e="Please verify your phone number, it doesn&apos;t appear to be valid. Include the Area and Country code. (Only numbers)";switch(language){case"espanol":e="Por favor verif&iacute;que el tel&eacute;fono ingresado, no parece ser v&aacute;lido.\n Incluya el c&oacute;digo del &Aacute;rea y del Pa&iacute;s. (Solo n&uacute;meros)";break;case"francais":e="Veuillez verifier votre num&eacute;ro de t&eacute;lephone en ecrivant seulment des num&eacute;ros cons&eacute;cutifs\nen incluyant le code du pays. ";break}if(g!=""){var h=g.replace(/[\+\(\)\-\s]+/g,"");var f=/[\d]{8,}\/?/;if(!f.test(h)){$("#tel-fax").addClass("warning").focus();message.showError(e);return false}}$("#tel-fax").removeClass("warning");return true},validateDates:function(){var g=$("#from-date").attr("value");var h=$("#to-date").attr("value");var f="Please select a check-in date.";var e="Please select a check-out date.";switch(language){case"espanol":f="Por favor seleccione una fecha de llegada.";e="Por favor seleccione una fecha de salida.";break;case"francais":f="S&apos;il vous pla&icirc;t s&eacute;lectionnez une date d&apos;arriv&eacute;e.";e="S&apos;il vous pla&icirc;t s&eacute;lectionnez une date de d&eacute;part.";break}if(g==""){$("#tel-fax").focus();$("#from-date").addClass("warning").focus();message.showError(f);return false}else{$("#from-date").removeClass("warning")}if(h==""){$("#tel-fax").focus();$("#to-date").addClass("warning").focus();message.showError(e);return false}else{$("#to-date").removeClass("warning")}return true},validatePolicy:function(){var e=document.getElementById("policy-agree").checked;var b=false;if(e){$("#policy").removeClass("warning");$(".policy-agree-text").removeClass("warning");return true}var f="We are sorry, but we can only take reservations if you accept our Reservation, Payment and Cancellation policy.";switch(language){case"espanol":f="Lo sentimos, pero solo podemos aceptar reservaciones si acepta la Pol&iacute;tica de Reservaciones, Pagos y Cancelaciones.";break;case"francais":f="On est d&eacute;sol&eacute;s mais on ne peut processer votre demande de r&eacute;servation seulement si vous acceptez notre politique de r&eacute;servation, payement et annulation.";break}$("#policy").addClass("warning").focus();$(".policy-agree-text").addClass("warning");message.showError(f);return false}};var cookie=function(w,p,i){if(typeof p!="undefined"){i=i||{};if(p===null){p="";i.expires=-1}var t="";if(i.expires&&(typeof i.expires=="number"||i.expires.toUTCString)){var s;if(typeof i.expires=="number"){s=new Date();s.setTime(s.getTime()+(i.expires*24*60*60*1000))}else{s=i.expires}t="; expires="+s.toUTCString()}var n=i.path?"; path="+(i.path):"";var r=i.domain?"; domain="+(i.domain):"";var x=i.secure?"; secure":"";document.cookie=[w,"=",encodeURIComponent(p),t,n,r,x].join("")}else{var u=null;if(document.cookie&&document.cookie!=""){var o=document.cookie.split(";");for(var q=0;q<o.length;q++){var v=jQuery.trim(o[q]);if(v.substring(0,w.length+1)==(w+"=")){u=decodeURIComponent(v.substring(w.length+1));break}}}return u}};