$(document).ready(function () {
    $("body").on('click', '.sksearch', ModaLSearch);
    $("body").on('blur', '.mcheckout', checkinout);

    function checkinout() {

        var checkin = $(".mcheckin").val(),
                checkout = $('.mcheckout').val();

        if (checkout != '') {
            if (checkin > checkout) {
                alert("CheckOut Date Cannot Be Less Than CheckIn Date");
                $(".mcheckout").val("0000-00-00");
                $(".mcheckout").focus();
            }
        }

    }
    $("body").on("change", '.scity', getHnm);


    function ModaLSearch() {
        var city = $(".scity").val(),
                hotelnm = $(".shotelnm").val(),
                roomcatg = $(".roomcatg").val(),
                checkin = $(".mcheckin").val(),
                checkout = $(".mcheckout").val();

        if (city == '') {
            alert("Please Select City");
        }
        if (hotelnm == '') {
            alert("Please Select Hotel Name");
        }

        $.post('gethotelDetails.php', {
            city: city,
            hotelnm: hotelnm,
            roomcatg: roomcatg,
            checkin: checkin,
            checkout: checkout
        }, function (data) {
            $(".hoteldetail").html(data);
        });



    }


    function getHnm() {
        var city = $(".scity").val();
        $.post('getHotel.php', {city: city}, function (data) {
            $(".shotelnm").html(data);
        });
    }


});