$(function(){ $('.dselector').keydown(function() { return false; }); $( "#dateselect" ).datepicker({ changeMonth: true, changeYear: true, dateFormat:'D, MM d, yy', yearRange:'-0:+1' }); $('#countryselect').click(function(){ $("#regionselectordiv, #locationselectordiv, #guestselectordiv, #petselectordiv, #durselectordiv").hide(); $("#countryselectordiv").slideToggle(); }); $('#regionselect').click(function(){ $("#countryselectordiv, #locationselectordiv, #guestselectordiv, #petselectordiv, #durselectordiv").hide(); $("#regionselectordiv").slideToggle(); }); $('#locationselect').click(function(){ var check=$('#locationselectordiv').html(); if(check=="") { jAlert("Please select a Region."); return false; } $("#countryselectordiv, #regionselectordiv, #guestselectordiv, #petselectordiv, #durselectordiv").hide(); $("#locationselectordiv").slideToggle(); }); $('#guestselect').click(function(){ $("#countryselectordiv, #locationselectordiv, #regionselectordiv, #petselectordiv, #durselectordiv").hide(); $("#guestselectordiv").slideToggle(); }); $('#petselect').click(function(){ $("#countryselectordiv, #regionselectordiv, #locationselectordiv, #guestselectordiv, #durselectordiv").hide(); $("#petselectordiv").slideToggle(); }); $('#durselect').click(function(){ var durcheck=$('#dateselect').val(); if(durcheck=="Start Date") { jAlert("Please select a start date."); return false; } $("#countryselectordiv, #regionselectordiv, #locationselectordiv, #guestselectordiv, #petselectordiv").hide(); $("#durselectordiv").slideToggle(); }); $('#countryselectordiv p').click(function(e) { var txt = $(e.target).text(); var vcdate=$('#dateselect').val(); var dur=$('#durselect').html(); var guests=$('#guestselect').html(); var pets=$('#petselect').html(); $('#countryselect').html(txt); $("#countryselectordiv").slideToggle(); var xmlcall={ country: txt, vcdate: vcdate, vdur: dur, vguests: guests, vpets: pets }; $.ajax({ url:"/calls/get_cottage_location.php", data: xmlcall, type: 'post', success: function(data) { $('.cbbox').html(data); } }); }); $('#regionselectordiv p').click(function(e) { var txt = $(e.target).text(); $('#regionselect').html(txt); var vcdate=$('#dateselect').val(); var dur=$('#durselect').html(); var guests=$('#guestselect').html(); var pets=$('#petselect').html(); $("#regionselectordiv").slideToggle(); var xmlcall={ country:$('#countryselect').html(), region: txt, vcdate: vcdate, vdur: dur, vguests: guests, vpets: pets }; $.ajax({ url:"/calls/get_cottage_location.php", data: xmlcall, type: 'post', success: function(data) { $('.cbbox').html(data); } }); }); $('#locationselectordiv p').click(function(e) { var txt = $(e.target).text(); $('#locationselect').html(txt); var vcdate=$('#dateselect').val(); var dur=$('#durselect').html(); var guests=$('#guestselect').html(); var pets=$('#petselect').html(); $("#locationselectordiv").slideToggle(); var xmlcall={ country:$('#countryselect').html(), region:$('#regionselect').html(), location: txt, vcdate: vcdate, vdur: dur, vguests: guests, vpets: pets }; $.ajax({ url:"/calls/get_cottage_location.php", data: xmlcall, type: 'post', success: function(data) { $('.cbbox').html(data); } }); }); $('#guestselectordiv p').click(function(e) { var txt = $(e.target).text(); $('#guestselect').html(txt); $("#guestselectordiv").slideToggle(); }); $('#petselectordiv p').click(function(e) { var txt = $(e.target).text(); $('#petselect').html(txt); $("#petselectordiv").slideToggle(); }); $('#durselectordiv p').click(function(e) { var txt = $(e.target).text(); $('#durselect').html(txt); $("#durselectordiv").slideToggle(); }); $('.csearchv2').click(function() { var country=$('#countryselect').html(); var coutryrep=country.replace(" ","-"); var region=$('#regionselect').html(); var regionrep=region.replace(" ","-"); var location=$('#locationselect').html(); var locationrep=location.replace(" ","-"); var guests=$('#guestselect').html(); var pets=$('#petselect').html(); var cdate=$('#dateselect').val(); var dur=$('#durselect').html(); if(cdate!="Start Date") { if(dur=='Duration') { jAlert("Please select a duration."); return false; } } if(region=='Select Region') { var loc=coutryrep; } else { var loc=coutryrep+"_"+regionrep; } if(location!='Select Location') { var loc=loc+"_"+locationrep } var url="/cottage_locations.php?loc="+loc+"&pets="+pets+"&guests="+guests+"&cdate="+cdate+"&dur="+dur; window.location.href = url; }); })