jQuery(document).ready(function($){var minArrival=new Date();var minDepart=new Date();minDepart.setDate(minDepart.getDate()+1);var maxDate=new Date();maxDate.setDate(maxDate.getDate()+365);$('#hotel_avail_arrival_date').datepicker({showOn:'both',buttonImage:'/images/dateIcon.gif',buttonImageOnly:true,numberOfMonths:2,minDate:minArrival,maxDate:maxDate,onSelect:function(datetext,inst){var selectedDate=$('#hotel_avail_arrival_date').datepicker("getDate");var minDate=new Date(selectedDate);minDate.setDate(minDate.getDate()+1);var maxDate=new Date(selectedDate);maxDate.setDate(selectedDate.getDate()+46);$('#hotel_avail_departure_date').datepicker("option","minDate",minDate);$('#hotel_avail_departure_date').datepicker("option","maxDate",maxDate);$('#hotel_avail_departure_date').datepicker("setDate",minDate);}});$('#hotel_avail_departure_date').datepicker({showOn:'both',buttonImage:'/images/dateIcon.gif',buttonImageOnly:true,numberOfMonths:2,minDate:minDepart,maxDate:maxDate});var contentDivs=new Array('hotelDescription','hotelAmenities','hotelPhotos','hotelMap','hotelPoi','hotelReviews','hotelRates');function hideOthers(index){for(var i=0;i<contentDivs.length;i++)
if(i!=index){$('#'+contentDivs[i]+'Body').hide();$("#"+contentDivs[i]).removeClass("tabSelected");}else
$("#"+contentDivs[i]).addClass("tabSelected");}
var currentSelected=$("#hotelDescription");if(window.location.href.indexOf('#')>0){if(window.location.href.substring(window.location.href.indexOf('#')).indexOf('map')>0)
hideOthers(3);else if(window.location.href.substring(window.location.href.indexOf('#')).indexOf('amenities')>0)
hideOthers(1);else if(window.location.href.substring(window.location.href.indexOf('#')).indexOf('photos')>0)
hideOthers(2);else if(window.location.href.substring(window.location.href.indexOf('#')).indexOf('reviews')>0&&$("#hotelReviews").length>0)
hideOthers(5);}else{if($("#hotelRates").length>0)
hideOthers(6);else
hideOthers(0);}
$(".tab").click(function(){var current=$(this).parent().find("div.tabSelected").attr("id");$("#"+current+"Body").hide();$("#"+current).removeClass("tabSelected");$("#"+$(this).attr("id")+"Body").show();$(this).addClass("tabSelected");return false;});$("#availPhotos").click(function(){var current=$("#tabs").find("div.tabSelected").attr("id");$("#"+current+"Body").hide();$("#"+current).removeClass("tabSelected");$("#hotelPhotosBody").show();$("#hotelPhotos").addClass("tabSelected");return false;});$("#topMapLink").click(function(){hideOthers(3);$("#"+contentDivs[3]+'Body').show();return false;});$("#topPhotoLink").click(function(){hideOthers(2);$("#"+contentDivs[2]+'Body').show();return false;});$("#changeDatesLink").click(function(){$("#currentDatesBox").hide();$("#changeDatesBox").show();return false;});$("#currentDatesLink").click(function(){$("#changeDatesBox").hide();$("#currentDatesBox").show();return false;});$(".ihs8_54").click(function(){id=$(this).attr("id");$("#promo_"+id).show();$("#details_"+id).hide();return false;});var maxImageNum=$('#hotelPhotosBody img.hoverable').size();var currentImage=0;$("#prevImage").click(function(){if(currentImage<=0)
currentImage=maxImageNum;else
currentImage--;changeImage();});$("#nextImage").click(function(){if(currentImage>=maxImageNum)
currentImage=0;else
currentImage++;changeImage();});function changeImage(){$("#mainImage").attr("src",$('#hotelImage'+currentImage).attr("src").replace('true/70/70','false/300/300'));}
$("#hotelPhotosBody img.hoverable").each(function(){$(this).click(function(){currentImage=parseInt(this.id.substring(10));changeImage();});});ihsBooker.handleErrors=function(errors){var errorString="The following must be completed before continuing:\n";for(var i=0;i<errors.length;i++)
errorString+=(i+1)+". "+errors[i]+"\n";alert(errorString);};ihsBooker.formatAvailability=function(request,htl){$("#rates").html($("#availTemplate").tmpl({"htl":htl,"request":request},{formatCurrency:function(currency,amount){if(currency=='USD')
return'$'+parseFloat(amount).toFixed(2);else
return'USD$'+parseFloat(amount).toFixed(2);}}));};ihsBooker.setAvailabilityRequest=function(request){request['affiliateId']=$("#hotel_pfs").val();request['hotel']['id']=$("#hotel_hotel_id").val();request['hotel']['numberOfAdults']=$("#hotel_avail_adults").val();request['hotel']['numberOfChildren']=$("#hotel_avail_children").val();if($("#hotel_avail_arrival_date").val()!=''&&$("#hotel_avail_arrival_date").val()!='Check-In'){var inputDate=$("#hotel_avail_arrival_date").val().split("/");request['hotel']['arrivalDate']['year']=inputDate[2];request['hotel']['arrivalDate']['month']=inputDate[0];request['hotel']['arrivalDate']['dayOfMonth']=inputDate[1];}
if($("#hotel_avail_departure_date").val()!=''&&$("#hotel_avail_departure_date").val()!='Check-Out'){var inputDate=$("#hotel_avail_departure_date").val().split("/");request['hotel']['departureDate']['year']=inputDate[2];request['hotel']['departureDate']['month']=inputDate[0];request['hotel']['departureDate']['dayOfMonth']=inputDate[1];}};var getAvailability=function(){$(".arrivalDisplay").html($("#hotel_avail_arrival_date").val());$(".departureDisplay").html($("#hotel_avail_departure_date").val());$("#changeDatesBox").hide();$(".currentDates").show();ihsBooker.getAvailability(function(){$("#ratesProcessing").show();$("#rates").hide();},function(){$("#rates").show();$("#ratesProcessing").hide();});};$("#getRates").submit(function(){if($("#hotel_avail_arrival_date").val()==""){alert("Please fill in your travel dates in order to view rates");$("#hotel_avail_arrival_date").focus();return false;}else if($("#hotel_avail_departure_date").val()==""){alert("Please fill in your travel dates in order to view rates");$("#hotel_avail_departure_date").focus();return false;}else{var availability={};availability['numberOfAdults']=$("#hotel_avail_adults").val();availability['numberOfChildren']=$("#hotel_avail_children").val();var inputDate=$("#hotel_avail_arrival_date").val().split("/");availability['arrivalDate']={};availability['arrivalDate']['year']=inputDate[2];availability['arrivalDate']['month']=inputDate[0];availability['arrivalDate']['dayOfMonth']=inputDate[1];inputDate=$("#hotel_avail_departure_date").val().split("/");availability['departureDate']={};availability['departureDate']['year']=inputDate[2];availability['departureDate']['month']=inputDate[0];availability['departureDate']['dayOfMonth']=inputDate[1];ihsBooker.createCookie("availability",JSON.stringify(availability));getAvailability();}
return false;});if(!$("#hotel_avail_arrival_date").val()==""&&!$("#hotel_avail_departure_date").val()=="")
getAvailability()
else{var cookie=getCookie('availability');if(cookie!=null){var availability=JSON.parse(cookie);$("#hotel_avail_adults").val(availability['numberOfAdults']);$("#hotel_avail_children").val(availability['numberOfChildren']);$("#hotel_avail_arrival_date").val(availability['arrivalDate']['month']+"/"+availability['arrivalDate']['dayOfMonth']+"/"+availability['arrivalDate']['year']);$("#hotel_avail_departure_date").val(availability['departureDate']['month']+"/"+availability['departureDate']['dayOfMonth']+"/"+availability['departureDate']['year']);getAvailability();}}});
