Date.locale={month_names:['January','February','March','April','May','June','July','August','September','October','November','December'],short_names:['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']};
var Explore=Explore||{};
Explore.Options={earliestDeparture:4,defaultReturn:7,minAutocompleteCharacters:4,
dayOptions:function(){var dayopts="";for(var i=1;i<32;i++){dayopts+="";} return dayopts;}(),monthOptions:function(){var monthopts="";for(var i=0;i<12;i++) {monthopts+="";} return monthopts;}(),yearOptions:function(){var today=new Date();var yearopts="";for(var i=today.getFullYear();i<=new Date(today.getFullYear(),today.getMonth(),today.getDay()+362).getFullYear();i++) {yearopts+="";} return yearopts;}()
}
$(function(){
var today=new Date();var earliestDeparture=new Date(today.getFullYear(),today.getMonth(),today.getDate()+Explore.Options.earliestDeparture);var defaultReturn=new Date(earliestDeparture.getFullYear(),earliestDeparture.getMonth(),earliestDeparture.getDate()+Explore.Options.defaultReturn);
$(".explore-tabs").tabs();
$(".airport-autocomplete").each(function(index){var ida=$(this).hasClass('init-dep-apt');$(this).autocomplete({source:function(request,response){$.ajax({url:"https://ext.sabreexplore.com.au:443/citySearchJson.aj?sn=ext&ida="+ida,dataType:"jsonp",data:{term:request.term},success:function(data){response($.map(data.query.results.result,function(item){return{label:item.display,value:item.select}}));}});},minLength:Explore.Options.minAutocompleteCharacters,open:function(){$(this).removeClass("ui-corner-all").addClass("ui-corner-top");},close:function(){$(this).removeClass("ui-corner-top").addClass("ui-corner-all");}});});
$("input").change(function(){var x=$("#searchAir\\.segments1\\.departDate") if($(this).val()=='R'){x.removeClass('disabled');$("input, select",x).prop('disabled',false);}else{x.addClass('disabled');$("input, select",x).prop('disabled',true);}});
$("#explore-amenities").buttonset();$("#searchHotelV2\\.roomCount").change(function(){var count=$(this).val();var base=$("#searchHotelV2\\.segments0\\.guestCount");for(var i=1;i<5;i++){var elem=$("#searchHotelV2\\.segments"+i+"\\.guestCount");var prev=$("#searchHotelV2\\.segments"+(i-1)+"\\.guestCount");if(i
$("#explore-flights form, #explore-hotels form, #explore-cars form").submit(function(event){$(".explore-error").detach();$(".explore-validate-airport",this).each(function(){var val=$(this).val();if(val==null||!(val.length==3||/.*\({3}\)/.test(val))){$(this).after("");}});if($("input:checked").val()=='R'){$("#searchAir\\.segments1\\.departCity").val($("#searchAir\\.segments0\\.arrivalCity").val());$("#searchAir\\.segments1\\.arrivalCity").val($("#searchAir\\.segments0\\.departCity").val());$("#searchAir\\.segments0\\.cabinIndicator").val($("#cabClassSelect").val());$("#searchAir\\.segments1\\.cabinIndicator").val($("#cabClassSelect").val());}else{$("#searchAir\\.segments1\\.departCity").val("");$("#searchAir\\.segments1\\.arrivalCity").val("");$("#searchAir\\.segments0\\.cabinIndicator").val($("#cabClassSelect").val());$("#searchAir\\.segments1\\.cabinIndicator").val("");} $(".explore-data-copy").each(function(){$(this).val($("#"+$(this).attr('idref').replace(/\./g,"\\.")).val());});
return $(".explore-error",this).size()==0;
});
$(".explore-date-picker").each(function(){var wrapper=this;
if($(this).hasClass("explore-date-return")){$(".day",this).html(Explore.Options.dayOptions).val(defaultReturn.getDate());$(".month",this).html(Explore.Options.monthOptions).val(defaultReturn.getMonth()+1);$(".year",this).html(Explore.Options.yearOptions).val(defaultReturn.getFullYear());}else{$(".day",this).html(Explore.Options.dayOptions).val(earliestDeparture.getDate());$(".month",this).html(Explore.Options.monthOptions).val(earliestDeparture.getMonth()+1);$(".year",this).html(Explore.Options.yearOptions).val(earliestDeparture.getFullYear());}
$(".date-selector",this).datepicker({showOn:"button",buttonImage:"calendar.gif",buttonImageOnly:true,onSelect:function(dateText,inst){var date=$(this).datepicker('getDate');$(".day",wrapper).val(date.getDate());$(".month",wrapper).val(date.getMonth()+1);$(".year",wrapper).val(date.getFullYear());}});});});