var menuTimeOut=0;var activeMenu="";google.load("jquery","1.3.2");if(document.getElementById("wrapper").className.indexOf("reservations")!=-1){google.load("jqueryui","1.7.2")}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(d,e,c,a){var b="ajax.html";if(typeof(c)=="string"){a=c;c=undefined}if(c!=undefined){c=ajax.handleError}if(a!=undefined){b=a}$.ajax({data:d,dataType:"json",error:c,success:e,type:"POST",url:b})},handleError:function(c,a,b){if(console){console.log(b)}}};var banner={holder:null,currentBanner:0,init:function(){banner.currentBanner=cookie("cbid");banner.changeBanner()},changeBanner:function(){cookie("cbid",banner.currentBanner);ajax.send({a:"nb",bid:banner.currentBanner},banner.changeBanner_handle,banner.onError)},changeBanner_handle:function(a){if(!a.error){var b=a.data;banner.currentBanner=b.id;$("#offers-banner .message").html(b.title).css({left:"500px",width:b.width+"px"}).animate({left:-1*b.width},b.duration*1000,"linear",banner.changeBanner);$("#offers-banner").attr("href",b.url);return}banner.onError()},onError:function(){$("#offers-banner").css("display","none")}};var message={closeInterval:0,isVisible:false,showSuccess:function(b,a){message.show(b,"success",a);return true},showError:function(b,a){message.show(b,"error",a);return true},show:function(c,b,a){$("#info-message").html(c).attr("class",b);if(message.closeInterval!=0){clearInterval(message.closeInterval);message.closeInterval=0}if(!message.isVisible){message.isVisible=true;$("#info-message").fadeIn("slow")}if(a==undefined||a===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(a){if(menuTimeOut!=0){menu.hideMenu()}$(this).addClass("mouse-over");$(".navigation ."+a+" ul").fadeIn("fast");activeMenu=a},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(b){var a=gallery._getById(b);if(a){$(".gallery .loading").show();$(".gallery .display img").fadeOut("slow",function(){$(this).bind("load",function(c){$(".gallery .loading").hide();$(this).fadeIn("slow");$(".gallery .display span").html(a.caption).fadeIn("slow")}).attr("src",a.medium)});$(".gallery .display span").fadeOut("slow")}},_getById:function(c){for(var a=0,b=galleryDatabase.length;a<b;a++){if(c==galleryDatabase[a].id){return galleryDatabase[a]}}return false}};var rooms={init:function(){$(".room .season").hover(function(a){$(".header",this).css("background-color","#f5f5f5");$(".price",this).css("background","#fff url(../image/room/highlight-fade-bg.gif) repeat-x top left")},function(a){$(".header",this).css("background-color","#fefefe");$(".price",this).css("background","#fff")})}};var offers={init:function(){$(".offers .offer-content").css("display","none");var a=window.location.hash;if(a){offers.click(a.substring(1))}},click:function(e){var c="#offer-"+e;var b=$(c).data("status");if(b==undefined){b="closed";$(c).data("status",b)}var a=b=="open"?offerShow:offerHide;var d=b=="open"?offerShowIcon:offerHideIcon;b=b=="open"?"closed":"open";$(c).data("status",b);$(c+" .icon").html(d);$(c+" .message").html(a);$(c+" .offer-content").slideToggle(2000,function(){if(b=="open"){window.location.hash=e}})}};var reservations={init:function(){var d=$("body").attr("class");var a="MM/dd/yy";var c=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var l=["Su","Mo","Tu","We","Th","Fr","Sa"];var g=["January","February","March","April","May","June","July","August","September","October","November","December"];if(d.indexOf("espanol")!=-1){a="dd/MM/yy";c=["Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sabado"];l=["Do","Lu","Ma","Mi","Ju","Vi","Sa"];g=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"]}else{if(d.indexOf("francais")!=-1){a="dd/MM/yy";c=["Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"];l=["Di","Lu","Ma","Me","Je","Ve","Sa"];g=["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:a,dayNames:c,dayNamesMin:l,monthNames:g,minDate:"+1",maxDate:"+10Y",onSelect:function(h,f){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(i,h){var f=$("#server-from-date").attr("value");if(f!=""){f=f.split("-");$("#to-date").datepicker("option","minDate",new Date(f[0],parseInt(f[1])-1,parseInt(f[2])+1))}});$(".room-details").css("display","block");$("#room-type").change(function(){var f=document.getElementById("room-type");roomId=f.options[f.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 j=window.location.hash;j=j.slice(2).split("/");if(j[0]=="room-type"){var e=0;var b=$("#room-type").attr("options");for(var e=0,k=b.length;e<k;e++){if(j[1]==b[e].value){$("#room-type").attr("selectedIndex",e).change();break}}}},updateRoomInfo:function(a){if(a.status!="error"){if($(".room-details").css("display")=="none"){$(".room-details").fadeIn("fast")}$(".room-details img:last").fadeOut("fast");$(".room-details img:first").attr("src",a.data.image);$(".room-details span").html(a.data.description);return}reservations.updateRoomInfoError()},updateRoomInfoError:function(c,a,b){$(".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 a={};a["full-name"]=document.getElementById("full-name").value;a.email=document.getElementById("email").value;a["newsletter-subscribe"]=document.getElementById("newsletter-subscribe").checked;a["tel-fax"]=document.getElementById("tel-fax").value;a["from-date"]=document.getElementById("from-date").value;a["to-date"]=document.getElementById("to-date").value;a["server-from-date"]=document.getElementById("server-from-date").value;a["server-to-date"]=document.getElementById("server-to-date").value;a["special-offer"]=document.getElementById("special-offer").value;a["room-type"]=document.getElementById("room-type").value;a["number-rooms"]=document.getElementById("number-rooms").value;a["number-persons"]=document.getElementById("number-persons").value;a.comments=document.getElementById("comments").value;a.ajax="true";var b="We are sending your request. Please wait...";switch(language){case"espanol":b="Estamos enviando su solicitud. Por favor espere...";break;case"francais":b="Nous envoyons votre demande. S&apos;il vous pla&icirc;t attendre...";break}$("#send").attr("disabled","disabled");message.showSuccess(b,false);ajax.send(a,reservations.submitSuccess,reservations.submitError,"process-reservations.html");return false},clear:function(){$(".reservations input:text").attr("value","");$(".reservations select").each(function(a){$(this).attr("selectedIndex","0")});$(".reservations input:checkbox").attr("checked","");$(".reservations textarea").attr("value","")},submitSuccess:function(b,a){message.hide();if(!b.error){$(".reservations .content .content-compact").fadeOut("slow");$(".form-holder").fadeOut("slow",function(){$(".success-confirmation-message").fadeIn("slow")});return}reservations.submitError()},submitError:function(b,a){$("#send").attr("disabled","");var c='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":c='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":c='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(c,false)},validateName:function(){var c=document.getElementById("full-name").value;var d=/\w{2,}/;var a=d.test(c);if(!a){var e="";switch(language){case"espanol":e="Su nombre es muy corto, por favor ingrese su nombre completo.";break;case"francais":e="Votre nom est trop court, s&apos;il vous pla&icirc;t entrer votre nom et pr&eacute;nom.";break;case"english":default:e="Your name is too short, please enter your full name.";break}$("#full-name").addClass("warning").focus();message.showError(e);return false}$("#full-name").removeClass("warning");return true},validateEmail:function(){var c=document.getElementById("email").value;var a="Please verify you email, it doesn&apos;t appear to be valid.";switch(language){case"espanol":a="Por favor verif&iacute;que el email ingresado, no parece ser v&aacute;lido.";break;case"francais":a="Votre adresse email ne semble pas valable. Veuillez la v&eacute;rifier.";break}var d=/\w[\!-\~]*\@[\!-\~]+\w/;var b=/^[a-z0-9][^\(\)\<\>\@\,\;\:\\\"\[\]]*\@[a-z0-9\-\.]*\.[a-z]{2,4}$/i;if(!d.test(c)){$("#email").addClass("warning").focus();message.showError(a);return false}$("#email").removeClass("warning");return true},validatePhone:function(){var d=document.getElementById("tel-fax").value;var b="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":b="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":b="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(d!=""){var c=d.replace(/[\+\(\)\-\s]+/g,"");var a=/[\d]{8,}\/?/;if(!a.test(c)){$("#tel-fax").addClass("warning").focus();message.showError(b);return false}}$("#tel-fax").removeClass("warning");return true},validateDates:function(){var d=$("#from-date").attr("value");var c=$("#to-date").attr("value");var a="Please select a check-in date.";var b="Please select a check-out date.";switch(language){case"espanol":a="Por favor seleccione una fecha de llegada.";b="Por favor seleccione una fecha de salida.";break;case"francais":a="S&apos;il vous pla&icirc;t s&eacute;lectionnez une date d&apos;arriv&eacute;e.";b="S&apos;il vous pla&icirc;t s&eacute;lectionnez une date de d&eacute;part.";break}if(d==""){$("#tel-fax").focus();$("#from-date").addClass("warning").focus();message.showError(a);return false}else{$("#from-date").removeClass("warning")}if(c==""){$("#tel-fax").focus();$("#to-date").addClass("warning").focus();message.showError(b);return false}else{$("#to-date").removeClass("warning")}return true},validatePolicy:function(){var d=document.getElementById("policy-agree").checked;var a=false;if(d){$("#policy").removeClass("warning");$(".policy-agree-text").removeClass("warning");return true}var c="We are sorry, but we can only take reservations if you accept our Reservation, Payment and Cancellation policy.";switch(language){case"espanol":c="Lo sentimos, pero solo podemos aceptar reservaciones si acepta la Pol&iacute;tica de Reservaciones, Pagos y Cancelaciones.";break;case"francais":c="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(c);return false}};var cookie=function(b,j,m){if(typeof j!="undefined"){m=m||{};if(j===null){j="";m.expires=-1}var e="";if(m.expires&&(typeof m.expires=="number"||m.expires.toUTCString)){var f;if(typeof m.expires=="number"){f=new Date();f.setTime(f.getTime()+(m.expires*24*60*60*1000))}else{f=m.expires}e="; expires="+f.toUTCString()}var l=m.path?"; path="+(m.path):"";var g=m.domain?"; domain="+(m.domain):"";var a=m.secure?"; secure":"";document.cookie=[b,"=",encodeURIComponent(j),e,l,g,a].join("")}else{var d=null;if(document.cookie&&document.cookie!=""){var k=document.cookie.split(";");for(var h=0;h<k.length;h++){var c=jQuery.trim(k[h]);if(c.substring(0,b.length+1)==(b+"=")){d=decodeURIComponent(c.substring(b.length+1));break}}}return d}};