403Webshell
Server IP : 103.234.187.230  /  Your IP : 216.73.216.216
Web Server : Apache
System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/uatb2c.hellogtx.com/public/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/uatb2c.hellogtx.com/public/js/custom_mangal_24_7.js
$(document).ready(function () {
    $(".sending1").on('click', function (e) {

        var EmailReg = new RegExp(/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/);
        e.preventDefault();
        var data = $(".package_rate_enquiry").serialize();

        var leadsend = $("#leadsends").val();
        if ($('.package_rate_enquiry input[name="email"]').val() == '') {
            $('.msgs').show().html('Please enter your email address').fadeIn().delay(2000).fadeOut();
            $('.package_rate_enquiry input[name="email"]').focus();
            return false;
        }
        if (!EmailReg.test($('.package_rate_enquiry input[name="email"]').val())) {
            $('.msgs').show().html('Please enter valid email address!!!').fadeIn().delay(2000).fadeOut();
            $('.package_rate_enquiry input[name="email"]').focus();
            return false;
        }
        if ($('.package_rate_enquiry input[name="mobile"]').val() == '') {
            $('.msgs').show().html('Please enter your mobile number').fadeIn().delay(2000).fadeOut();
            $('.package_rate_enquiry input[name="mobile"]').focus();
            return false;
        }
        // if ($('.package_rate_enquiry input[name="mobile"]').val().length != '10') {
        //     $('.msgs').show().html('Mobile should be 10 digit?').fadeIn().delay(2000).fadeOut();
        //     $('.package_rate_enquiry input[name="mobile"]').focus();
        //     return false;
        // }
        if (!$.isNumeric($('.package_rate_enquiry input[name="mobile"]').val())) {
            $('.msgs').show().html('Mobile should be numeric!!').fadeIn().delay(2000).fadeOut();
            $('.package_rate_enquiry input[name="mobile"]').focus();
            return false;
        }
        //    if ($('.package_rate_enquiry input[name="from_destination_id"]').val() == '') {
        //        $('.msgs').show().html('Please enter traveling from');
        //        $('.package_rate_enquiry input[name="from_destination_name"]').focus();
        //        return false;
        //    }
        if ($('.package_rate_enquiry input[name="dates"]').val() == '') {
            $('.msgs').show().html('Please enter travel date');
            $('.package_rate_enquiry input[name="dates"]').focus();
            return false;
        }
        if (leadsend == '0') {
            //                $.ajax({
            //                    url: SITEURL + 'cms/index/sendenquiry', type: 'POST', data: data, dataType: 'json', beforeSend: function () {
            //                        $('.sending1').html('<i class="ace-icon fa fa-spinner fa-spin orange bigger-125"></i> Sending...').attr('disabled', 'disabled');
            //                    }, success: function (result) {
            //                        $("#leadsends").val('1');
            //                        $('.package_rate_enquiry').find('.msgs').html('');
            //                        $('.sending1').html('Calculate Cost &amp; Send Enquiry').attr('disabled', false);
            //                        //                    $('#expandsave').show();
            //
            //                        $('.msgs').hide().html('');

            $.ajax({
                url: SITEURL + 'gtxwebservices/send-enquiry/post',
                type: 'POST',
                data: data,
                dataType: 'json',
                beforeSend: function () {
                    $('.sending1').html('<i class="ace-icon fa fa-spinner fa-spin orange bigger-125"></i> Getting Cost...').attr('disabled', 'disabled');
                },
                success: function (result) {

                    if ((result.status == 'success') && (result.availability == true)) {
                        $('.package_rate_enquiry .smsg1').show().html("Thanks! Your enquiry submitted successfully. Soon our expert will contact you.").css({'color': '#5cb85c'});

                        var priceTax = result.addtional['GSTAmount']; // Tax
                        var sumRoomWise = result.addtional['MyCost']; // TotalPrice
                        var priceGT = result.addtional['AmountWithGST']; // GrandTotal
                        var DiscountValue = result.DiscountValue; // GrandTotal
                        var discountCouponCode = result.discountCouponCode; // GrandTotal
                        if (priceTax == 0) {
                            $('#totalBasicCostTR , #totalTaxCostTR,#totalGrandCostTR').hide();
                            $('#GSTI').show().html('GST (Included)');
                        } else {
                            $('#totalBasicCostTR , #totalTaxCostTR , #totalGrandCostTR').show();
                            $('#GSTI').hide().html('');
                        }
                        if (parseInt(DiscountValue) > 0) {
                            $('#totalDiscountValueTR').show();
                        } else {
                            $('#totalDiscountValueTR').hide();
                        }
                        var priceTaxFormatted, priceBCFormatted, priceGTFormatted = DiscountValueFormatted = '';
                        priceTaxFormatted = ptMoneyFormatINR(priceTax, 2, null);
                        priceBCFormatted = ptMoneyFormatINR(sumRoomWise, 2, null);
                        priceGTFormatted = ptMoneyFormatINR((priceGT), 2, null);
                        DiscountValueFormatted = ptMoneyFormatINR((DiscountValue), 2, null);
                        $('#totalBasicCost').html(priceBCFormatted);
                        $('#totalTaxCost').html(priceTaxFormatted);
                        $('#totalGrandCost').html(priceGTFormatted);
                        $('#totalDiscountValue').html(DiscountValueFormatted);
                        $('#discountCouponCodePop').html(discountCouponCode);
                        $('#tableCost').slideDown();

                        if (result.IsBooking == true && result.url != '') {
                            $('.class-book-now-btn').show().attr('href', result.url);
                        }
                    } else if ((result.status == 'success') && (result.availability == "false")) {
                        $('.smsg1').show().html("Thanks! Your enquiry submitted successfully. Soon our expert will contact you.").css({'color': '#5cb85c'});

                    } else if ((result.status == false) && (result.availability == "false")) {
                        $('.package_rate_enquiry .smsg1').show().html('Sorry, This package is not available on selected date.\n\ But we will revert back with suitable suggestions.').css({'color': '#5cb85c'});

                    } else {
                        $('.smsg1').show().html('Thanks! Your enquiry submitted successfully.\n\ We will revert back with suitable suggestions.').css({'color': '#5cb85c'});

                    }
                    $('.sending1').html('Send Enquiry').hide();
                    $('.class-modify-enquiry-btn').show();
                    $('.perperson-priceBtn').show();


                },
                error: function (result) {
                    $('.smsg1').show().html('Sorry, This package is not available on selected date.\n\ But we will revert back with suitable suggestions.').css({'color': '#ff0000'});
                    $('.sending1').html('Send Enquiry').hide();
                    $('.class-modify-enquiry-btn').show();

                }
            });

            //                    }, error: function (result) {
            //                        $('.smsg1').show().html('Sorry, This package is not available on selected date.\n\ But we will revert back with suitable suggestions.').css({'color': '#ff0000'});
            //                        $('.sending1').html('Send Enquiry').hide();
            //                        $('.class-modify-enquiry-btn').show();
            //
            //                    }
            //                });
        }
    });

    $(".sending2").on('click', function (e) {
        //debugger;

        var EmailReg = new RegExp(/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/);
        e.preventDefault();
        var dataSending2 = $(".package_rate_enquiry_pop").serialize();
        // alert(dataSending2);

        var leadsend = $("#leadsends").val();

        if ($('.package_rate_enquiry_pop #salutation').val() == '') {
            $('.msgs').show().html('Please select Title');
            $('.package_rate_enquiry_pop #salutation').focus();
            return false;
        }

        if ($('.package_rate_enquiry_pop input[name="fname"]').val() == '') {
            $('.msgs').show().html('Please enter your first name');
            $('.package_rate_enquiry_pop input[name="fname"]').focus();
            return false;
        }

        if ($('.package_rate_enquiry_pop input[name="lname"]').val() == '') {
            $('.msgs').show().html('Please enter your last name');
            $('.package_rate_enquiry_pop input[name="lname"]').focus();
            return false;
        }
        if ($('.package_rate_enquiry_pop input[name="stdcode"]').val() == '') {
            $('.msgs').show().html('Please enter country code');
            $('.package_rate_enquiry_pop input[name="stdcode"]').focus();
            return false;
        }

        if ($('.package_rate_enquiry_pop input[name="mobile"]').val() == '') {
            $('.msgs').show().html('Please enter your mobile number');
            $('.package_rate_enquiry_pop input[name="mobile"]').focus();
            return false;
        }
        if ($('.package_rate_enquiry_pop input[name="mobile"]').val().length != '10') {
            $('.msgs').show().html('Mobile should be 10 digit?');
            $('.package_rate_enquiry_pop input[name="mobile"]').focus();
            return false;
        }
        if (!$.isNumeric($('.package_rate_enquiry_pop input[name="mobile"]').val())) {
            $('.msgs').show().html('Mobile should be numeric!!');
            $('.package_rate_enquiry_pop input[name="mobile"]').focus();
            return false;
        }
        if ($('.package_rate_enquiry_pop input[name="email"]').val() == '') {
            $('.msgs').show().html('Please enter your email address');
            $('.package_rate_enquiry_pop input[name="email"]').focus();
            return false;
        }
        if (!EmailReg.test($('.package_rate_enquiry_pop input[name="email"]').val())) {
            $('.msgs').show().html('Please enter valid email address!!!');
            $('.package_rate_enquiry_pop input[name="email"]').focus();
            return false;
        }
        if ($("#travelerDatePickerdetail").val() == '') {
            $('.msgs').show().html('Please enter travel date');
            $('#travelerDatePickerdetail').focus();
            return false;
        }

        // $.ajax({
        // url: SITEURL + 'cms/index/sendenquiry', type: 'POST', data: dataSending2, dataType: 'json', beforeSend: function () {
        // debugger;
        // $('.sending2').html('<i class="ace-icon fa fa-spinner fa-spin orange bigger-125"></i> Sending...');
        // }, success: function (result) {
        // $("#leadsends").val('1');
        // $('.package_rate_enquiry_pop').find('.msgs').html('');
        // $('.sending2').html('Calculate Cost &amp; Send Enquiry').attr('disabled', false);
        // $('#expandsave').show();
        // }, error: function (result) {
        // $('.smsg1').show().html('Sorry, This package is not available on selected date.\n\ We will revert back with suitable suggestions.').css({'color': '#ff0000'});
        // }
        // });

        $.ajax({

            url: SITEURL + 'gtxwebservices/send-enquiry/post',
            type: 'POST',
            data: dataSending2,
            dataType: 'json',
            beforeSend: function () {
                //    debugger;

                $('.sending2').html('<i class="ace-icon fa fa-spinner fa-spin orange bigger-125"></i> Getting Cost...');
            },
            success: function (result) {

                if ((result.status == 'success') && (result.availability == true)) {
                    $('.package_rate_enquiry_pop .smsg1').show().html("Thanks! Your enquiry submitted successfully. Soon our expert will contact you.").css({'color': '#5cb85c'});
                    var priceTax = result.addtional['GSTAmount']; // Tax
                    var sumRoomWise = result.addtional['MyCost']; // TotalPrice
                    var priceGT = result.addtional['AmountWithGST']; // GrandTotal
                    var DiscountValue = result.DiscountValue; // GrandTotal
                    var discountCouponCode = result.discountCouponCode; // GrandTotal
                    if (priceTax == 0) {
                        $('#totalBasicCostTR , #totalTaxCostTR').hide();
                        $('#GSTI').show().html('GST (Included)');
                    } else {
                        $('#totalBasicCostTR , #totalTaxCostTR').show();
                        $('#GSTI').hide().html('');
                    }
                    if (parseInt(DiscountValue) > 0) {
                        $('#totalDiscountValueTR').show();
                    } else {
                        $('#totalDiscountValueTR').hide();
                    }
                    var priceTaxFormatted, priceBCFormatted, priceGTFormatted = DiscountValueFormatted = '';
                    priceTaxFormatted = ptMoneyFormatINR(priceTax, 2, null);
                    priceBCFormatted = ptMoneyFormatINR(sumRoomWise, 2, null);
                    priceGTFormatted = ptMoneyFormatINR((priceGT), 2, null);
                    DiscountValueFormatted = ptMoneyFormatINR((DiscountValue), 2, null);
                    $('#totalBasicCost').html(priceBCFormatted);
                    $('#totalTaxCost').html(priceTaxFormatted);
                    $('#totalGrandCost').html(priceGTFormatted);
                    var enquiry_type = $('#enquiry_type').val();
                    $('#totalDiscountValue').html(DiscountValueFormatted);
                    $('#discountCouponCodePop').html(discountCouponCode);

                    if (enquiry_type == 1) {
                        $('.sending2').html('Send Enquiry').attr('disabled', false);
                    } else {
                        $('.sending2').html('Continue to Book').attr('disabled', false);
                        $('#tableCost').slideDown();
                    }
                    if (result.IsBooking == true && result.url != '') {
                        $('.class-book-now-btn').show().attr('href', result.url);
                        $('.class-modify-enquiry').show();
                        $('.addmorePop').hide();
                    }
                } else if ((result.status == 'success') && (result.availability == "false")) {
                    $('.smsg1').show().html("Thanks! Your enquiry submitted successfully. Soon our expert will contact you.").css({'color': '#5cb85c'});
                    $('.addmorePop').hide();
                } else if ((result.status == false) && (result.availability == "false")) {
                    $('.package_rate_enquiry_pop .smsg1').show().html('Sorry, This package is not available on selected date.\n\ But we will revert back with suitable suggestions.').css({'color': '#5cb85c'});
                    $('.addmorePop').hide();
                } else if ((result.status == false) && (result.redirect == true)) {
                    $('.smsg1').show().html("You are not login.").css({'color': '#5cb85c'});
                    window.location.href = SITEURL;
                } else {
                    $('.smsg1').show().html('Thanks! Your enquiry submitted successfully.\n\ We will revert back with suitable suggestions.').css({'color': '#5cb85c'});
                }
                $('.sending2').html('Continue to Book').attr('disabled', false);
                $('.hidebutton').find('.sending2').hide();
                $('.class-modify').hide();
                $('.addmorePop').hide();

            },
            error: function (result) {
                $('.smsg1').show().html('Sorry, This package is not available on selected date.\n\ We will revert back with suitable suggestions.').css({'color': '#ff0000'});
                $('.sending2').hide();
                $('.hidebutton').find('.sending2').hide();
                $('.hidebutton').find('.class-modify-enquiry').show();
            }
        });


    });
    $('.class-modify-enquiry').hide();
    $('.class-book-now-btn').hide();
    $('.class-modify-enquiry').click(
            function () {
                $('.addmorePop').show();

            }
    );


    $(document).on('click', '.sendRateEnuiryPackagetour', function () {
        //  $('#traveler_adult_1').val('');
        var PkgSysId = $(this).attr('data-rvs');
        var PackageType = $('#packagetype_' + PkgSysId).val();
        var GTXPkgId = $('#gtxpackage_' + PkgSysId).val();
        var hotelcategoryid = $('#hotelcategoryid_' + PkgSysId).val();
        var packagetpid = $('#packagetpid_' + PkgSysId).val();
        var tourtype = $('#tourtype_' + PkgSysId).val();
        var packagenamemodal = $('#packagename_' + PkgSysId).val();
        var mealplantype = $('#mealplantype_' + PkgSysId).val();
        var packagedesname = $('#packagedesname_' + PkgSysId).val();
        var currencyType = $('#currencyType_' + PkgSysId).val();
        var packageurl = $('#packageurl_' + PkgSysId).val();
        var IsQuadPrice = $('#IsQuadPrice_' + PkgSysId).val();
        var TotalHotels = $('#TotalHotels_' + PkgSysId).val();
        var thispackageurl = $('#packageurl_' + PkgSysId).val();
        var package_destination = $('#Destinations_' + PkgSysId).val();
        var package_destinationsId = $('#DestinationsId_' + PkgSysId).val();
        var fixdestinationId = $('.fixdeparture-destinations' + parseInt(PkgSysId)).val();

        var PackagesessionDate = $('#PackagesessionDate_' + PkgSysId).val();
        // if(PackagesessionDate){
        //     $('#travelerDatePickerdetail').val(PackagesessionDate);

        // }
        if (fixdestinationId != undefined) {
            var fixdestinationName = $('.fixdeparture-destinations' + parseInt(PkgSysId) + ' option:selected').attr('destinationname');
        }
        var isFixedDeparturesPackage = $('#isFixedDeparturesPackage_' + GTXPkgId).val();
        var IsSharingPrice = $('#IsSharingPrice_' + PkgSysId).val();
        var IsPkgImages = $('#IsPkgImages_' + PkgSysId).val();
        var date_value = $('#isFixedDeparturesDateDiv_' + GTXPkgId + ' .custom-select').length;

        $('.submitSendEnquiryCheckRateBtn').text('Continue');

        $('#leadsend').val(0);
        $('.StepBackBtn').hide();

        var estinamtebtnid = $(this).text();

        if (estinamtebtnid == "Get offer") {
            $('a#Send_Enquiry').text('Send Enquiry');


        } else if (estinamtebtnid == "Get Offer") {
            $('a#Send_Enquiry').text('Send Enquiry');
        } else if (estinamtebtnid == "Send Enquiry") {
            $('a#Send_Enquiry').text('Send Enquiry');

        } else {
            $('a#Send_Enquiry').text('Continue to Book');
        }

        if (isFixedDeparturesPackage == 1) {
            if (date_value > 0) {
                $('#putFixedDeparturesDateDiv').html($('#isFixedDeparturesDateDiv_' + GTXPkgId).html());
            } else {
                $('#putFixedDeparturesDateDiv').html('<input type="text" name="date" placeholder="Traveller Date1" class="" id="travelerDatePickerdetail" placeholder="Travel Date" aria-label="Travel Date" maxlength="10" value="" />');
            }

        } else {
            if (PackageType == 2) {
                $('#putFixedDeparturesDateDiv').html('<input type="hidden" name="date" placeholder="Traveller Date" class="" id="travelerDatePickerdetail" placeholder="Travel Date" aria-label="Travel Date" maxlength="10" value="' + PackagesessionDate + '" />');
            } else {
                $('#putFixedDeparturesDateDiv').html('<input type="text" name="date" placeholder="Traveller Date" class="" id="travelerDatePickerdetail" placeholder="Travel Date" aria-label="Travel Date" maxlength="10" value=""/>');

            }
        }

        if (IsQuadPrice == 1) {
            $('#Quad_adult_type_1').show();
            $('.adult_type_1').prop('checked', false);
            $('#adult_type_quad_1').prop('checked', true);
            $("#traveler_adult_1 option[value='4']").attr("hidden", false);

            $('#traveler_kids_div_12').show();
            $('#adult_type_quad_1').prop('checked', true);
            $('.traveler_kids_div_12').show();
            $('.CostAgeHtml').html('(5-11 Yrs.)');

            var IsCostHexa = $('#IsCostHexa_' + PkgSysId).val();
            var IsCostQuint = $('#IsCostQuint_' + PkgSysId).val();
            var IsCostQuad = $('#IsCostQuad_' + PkgSysId).val();
            var IsCostWithBed = $('#IsCostWithBed_' + PkgSysId).val();
            var IsCostWithOutBed = $('#IsCostWithOutBed_' + PkgSysId).val();
            var IsCostWithBed2T4 = $('#IsCostWithBed2T4_' + PkgSysId).val();
            var IsCostWithOutBed2T4 = $('#IsCostWithOutBed2T4_' + PkgSysId).val();
//                         alert(IsCostWithBed2T4);
            var IsCostInfent = $('#IsCostInfent_' + PkgSysId).val();

            if (IsCostQuad) {
                $('#Quadshow').show();
            }
            if (IsCostQuint) {
                $('#Quintshow').show();
            }
            if (IsCostHexa) {
                $('#Hexashow').show();
            }
            if (parseInt(IsCostWithBed) > 0) {
                $('#CostWithBed').show();
            }
            if (parseInt(IsCostWithOutBed) > 0) {
                $('#CostWithOutBed').show();
            }
            if (parseInt(IsCostWithBed2T4) > 0) {
                $('#CostWithBed2').show();
            }
            if (parseInt(IsCostWithOutBed2T4) > 0) {
                $('#CostWithOutBed2').show();
            }
            if (IsCostInfent) {
                $('#CostInfent').show();
            }
        } else {
            $('#Quad_adult_type_1').hide();
            $('#traveler_kids_div_12').hide();
            $('#room-row-child-bedtype-1-1').hide();
            $('.adult_type_1').prop('checked', false);
            $('.traveler_kids_div_12').hide();
            $('.CostAgeHtml').html('(2-11 Yrs.)');
            $("#traveler_adult_1 option[value='4']").attr("hidden", true);
            $("#traveler_adult_1 option[value='5']").attr("hidden", true);
            $("#traveler_adult_1 option[value='6']").attr("hidden", true);
            $('#Quadshow').hide();
            $('#Quintshow').hide();
            $('#Hexashow').hide();
            $('#CostWithBed').show();
            $('#CostWithOutBed').show();
            $('#CostInfent').show();
            $('#CostWithBed2').hide();
            $('#CostWithOutBed2').hide();
            $('#QuadSharingnew').val('');
            $('#QuintSharingnew').val('');
            $('#HexaSharingnew').val('');
            $('#childWithSharing,childWithSharing2,childSharingnew,childSharingnew2,InfentSharingnew').val('');
        }


        var bookingvalidityDay = parseInt($('#bookingvalidityDay_' + PkgSysId).val());
        var query = $('#leadsends').val();
        if (isNaN(bookingvalidityDay)) {
            bookingvalidityDay = 0;
        }
        $('#travelerDatePickerdetail').datepicker({
            dateFormat: 'dd/mm/yy',
            numberOfMonths: 1,
            minDate: bookingvalidityDay,
            beforeShow: function (input, inst) {
                var rect = input.getBoundingClientRect();
                setTimeout(function () {
                    inst.dpDiv.css({
                        top: rect.top - 10,
                        left: rect.left + 0
                    });
                }, 0);
            }
        });
        $('.msgs').hide().html('');
        $('.smsg1').hide().html('');
        $("#leadsends").val('0');
        var packageType = $('#packagetype_' + PkgSysId).val();
        if (packageType == 2) {
            $("#leadsends").val('2');
            var singleShare = $('#single_share').val();
            var twinsShare = $('#twin_share').val();
            var tripleShare = $('#triple_share').val();
            var noofchild = $('#noofchild').val();
            if (twinsShare != 0) {
                $('#adultTwinSharingnew').val(twinsShare);
            }
            if (singleShare != 0) {
                $('#adultSingleSharingnew').val(singleShare);
            }
            if (tripleShare != 0) {
                $('#adultTripleSharingnew').val(tripleShare);
            }
            if (noofchild != 0) {
                $('#childSharingnew').val(noofchild);
            }
        }

        //$('#expandsave').hide();
        $('#isFixedDeparturesPackage').val(isFixedDeparturesPackage);
        $('#packagesys_ids').val(PkgSysId);
        $('#packagetype_ids').val(PackageType);
        $('#package_sids').val(GTXPkgId);
        $('#package_hotelcategoryids').val(hotelcategoryid);
        $('#package_mealplantypeids').val(mealplantype);
        $('#package_tpids').val(packagetpid);
        $('#package_tourtype_ids').val(tourtype);
        $('#packagenamemodal').html(packagenamemodal);
        $('#mpackage_name').val(packagenamemodal);
        $('#packagedesname').val(packagedesname);
        $('.WebRupeeHtml').html(currencyType);
        $('#currencyType1').val(currencyType);
        $('#thispackageurl').val(thispackageurl);
        $('#package_destination').val(package_destination);
        $('#package_destinationsId').val(package_destinationsId);
        $('#fixdestinationId').val(fixdestinationId);
        $('#fixdestinationName').val(fixdestinationName);
        $('#IsSharingPrice').val(IsSharingPrice);
        $('#IsPkgImagesChange').attr('src', IsPkgImages);

        $('#displaySendRateEnquiryForm').show();
        // $('.hidebutton').find('.sending1').show().html('Check Rate & Send Enquiry').attr('disabled', false);
        //$('.hidebutton').find('.sending2').show().html('Send Enquiry').attr('disabled', false).css('color', '#fff');
        $('.package_rate_enquiry #tableCost, .class-modify-enquiry').hide();
        $('.package_rate_enquiry .smsg1').html('');
        $('.inserted-room-row').remove();
        $('.addmore').show();
        $('.package_rate_enquiry #traveler_adult_1').val(1);
        $('.package_rate_enquiry #traveler_kids_1 , .package_rate_enquiry #traveler_infant_1').val(0);
        $('#itinerary_inputs').val(1);
        $('#itinerary_rooms').val(2);
        $('#IsQuadPrice').val(IsQuadPrice);
        $('.hidebutton').find('.class-modify-enquiry').hide();
        $('.sending2').show();
        $('#tableCost').hide();
        if (TotalHotels > 0) {
            $('.RoomSelectionDiv1').show();
            $('.RoomSelectionDiv2').hide();
            $('.addmorePop').show();
            $('.heightfix').addClass('heightfixnew');
        } else {
            $('.RoomSelectionDiv2').show();
            $('.RoomSelectionDiv1').hide();
            $('.addmorePop').hide();
            $('.heightfix').removeClass('heightfixnew');
        }
        var destinationId = $('.fixdeparture-destinations' + parseInt(PkgSysId)).val();
        if (destinationId != undefined) {
            var destinationName = $('.fixdeparture-destinations' + parseInt(PkgSysId) + ' option:selected').attr('destinationname');
        }
        // console.log(destinationId);
        $('.from_destination_id').val(destinationId);
        $('.from_destination').val(destinationName);
        if (packageType == 2) {
            $('#BtnType').val('Book Now');

        } else {
            $('#BtnType').val(estinamtebtnid);

        }
        if ($('#check_TravelAgent').val() == 1) {
            $('#Send_Enquiry').click();
        }

    });
    $(document).on('click', '.sendRateEnuiryPackage', function () {
        var PkgSysId = $(this).attr('data-rvs');
        var PackageType = $('#packagetype_' + PkgSysId).val();
        var GTXPkgId = $('#gtxpackage_' + PkgSysId).val();
        var hotelcategoryid = $('#hotelcategoryid_' + PkgSysId).val();
        var packagetpid = $('#packagetpid_' + PkgSysId).val();
        var tourtype = $('#tourtype_' + PkgSysId).val();
        var packagenamemodal = $('#packagename_' + PkgSysId).val();
        var mealplantype = $('#mealplantype_' + PkgSysId).val();
        var packagedesname = $('#packagedesname_' + PkgSysId).val();

        alert(packagedesname);
        $('.msgs').hide().html('');
        $('.smsg1').hide().html('');
        $("#leadsends").val('0');
        //$('#expandsave').hide();
        $('#packagesys_ids').val(PkgSysId);
        $('#packagetype_ids').val(PackageType);
        $('#package_sids').val(GTXPkgId);
        $('#package_hotelcategoryids').val(hotelcategoryid);
        $('#package_mealplantypeids').val(mealplantype);
        $('#package_tpids').val(packagetpid);
        $('#package_tourtype_ids').val(tourtype);
        $('#packagenamemodal').html(packagenamemodal);
        $('#mpackage_name').val(packagenamemodal);
        $('#packagedesname').val(packagedesname);
        $('#displaySendRateEnquiryForm').show();
        //$('.hidebutton').find('.sending1').show().html('Check Rate & Send Enquiry').attr('disabled', false);
        $('.hidebutton').find('.sending1').show().html('Send Enquiry').attr('disabled', false).css('color', '#fff');
        $('.package_rate_enquiry #tableCost, .class-modify-enquiry').hide();
        $('.package_rate_enquiry .smsg1').html('');
        $('.inserted-room-row').remove();
        $('.addmore').show();
        $('.package_rate_enquiry #traveler_adult_1').val(1);
        $('.package_rate_enquiry #traveler_kids_1 , .package_rate_enquiry #traveler_infant_1').val(0);
        $('#itinerary_inputs').val(1);
        $('#itinerary_rooms').val(2);
        $('.hidebutton').find('.class-modify-enquiry').hide();
        if ($('#check_TravelAgent').val() == 1) {
            $('#Send_Enquiry').click();


        }
    });




});

$(".sendingrequest").on('click', function (e) {

    var EmailReg = new RegExp(/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/);
    e.preventDefault();
    var data = $(".sendingrequestCallback").serialize();

    if ($('.sendingrequestCallback input[name="email"]').val() == '') {
        $('.msgrequest').show().html('Please enter your email id').css('color', 'red').fadeIn().delay(5000).fadeOut();
        $('.sendingrequestCallback input[name="email"]').focus();
        return false;
    }
    if (!EmailReg.test($('.sendingrequestCallback input[name="email"]').val())) {
        $('.msgrequest').show().html('Please enter valid email address!!!').css('color', 'red').fadeIn().delay(5000).fadeOut();
        $('.sendingrequestCallback input[name="email"]').focus();
        return false;
    }
    if ($('.sendingrequestCallback input[name="mobile"]').val() == '') {
        $('.msgrequest').show().html('Please enter your Mobile').css('color', 'red').fadeIn().delay(5000).fadeOut();
        $('.sendingrequestCallback input[name="mobile"]').focus();
        return false;
    }
    if (!$.isNumeric($('.sendingrequestCallback input[name="mobile"]').val())) {
        $('.msgrequest').show().html('Mobile should be numeric!!').css('color', 'red').fadeIn().delay(5000).fadeOut();
        $('.sendingrequestCallback input[name="mobile"]').focus();
        return false;
    }
    // if ($('.sendingrequestCallback input[name="mobile"]').val().length != '10') {
    //     $('.msgrequest').show().html('Mobile should be 10 digit?').css('color', 'red').fadeIn().delay(5000).fadeOut();
    //     $('.sendingrequestCallback input[name="mobile"]').focus();
    //     return false;
    // }

    $('.msgrequest').html('');
    $('.sendingrequest').attr('disabled', true);
    $.ajax({
        url: SITEURL + 'cms/index/sendenquiry',
        type: 'POST',
        data: data,
        dataType: 'json',
        beforeSend: function () {
            $('.sendingrequest').html('<i class="ace-icon fa fa-spinner fa-spin orange bigger-125"></i> Sending...');
        },
        success: function (result) {
            if (result.status) {

                $('.sendingrequest').html('Request a callback');
                $('.msgrequest').html(result.message).css({'color': '#5cb85c'});
                window.location.href = '/thankyou';
            } else {
                $('.sendingrequest').html('Request a callback');
                $('.msgrequest').html(result.message);
            }


        },
        error: function (result) {
            $('.sendingrequest').html('Request a callback').attr('disabled', false);
            alert('Some error occured.');
        }
    });
});

$(".sendwhatsapp").on('click', function (e) {
    var mydevice = dvc;
    var getMessageBody = $("#getMessageBody").val();
    var customerContact = $("#customerContact").val();
    // alert(dvc);
    if (dvc == 'm') {
        window.open('whatsapp://send?phone=' + customerContact + '&text=' + getMessageBody, '_blank');
    } else {
        window.open('https://api.whatsapp.com/send?phone=' + customerContact + '&text=' + getMessageBody, '_blank');
    }

});

//$(".sendEnquiry").on('submit', function(e) {
//    $('.enqmsg').html('');
//    e.preventDefault();
//    var data = $(this).serialize();
//    var EmailReg = new RegExp(/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/);
//    if ($('.sendEnquiry input[name="fname"]').val() == '') {
//        $('.enqmsg').html('Please enter First name').css('color', 'red').fadeIn().delay(2000).fadeOut();
//        $('.sendEnquiry input[name="fname"]').focus();
//        return false;
//    }
//    if ($('.sendEnquiry input[name="lname"]').val() == '') {
//        $('.enqmsg').html('Please enter last name').css('color', 'red').fadeIn().delay(2000).fadeOut();
//        $('.sendEnquiry input[name="lname"]').focus();
//        return false;
//    }
//    if ($('.sendEnquiry input[name="mobile"]').val() == '') {
//        $('.enqmsg').html('Please enter your Mobile').css('color', 'red').fadeIn().delay(2000).fadeOut();
//        $('.sendEnquiry input[name="mobile"]').focus();
//        return false;
//    }
//    if (!$.isNumeric($('.sendEnquiry input[name="mobile"]').val())) {
//        $('.enqmsg').html('Mobile should be numeric!!').css('color', 'red').fadeIn().delay(2000).fadeOut();
//        $('.sendEnquiry input[name="mobile"]').focus();
//        return false;
//    }
//    // if ($('.sendEnquiry input[name="mobile"]').val().length != '10') {
//    //     $('.enqmsg').html('Mobile should be 10 digit?').css('color', 'red').fadeIn().delay(2000).fadeOut();
//    //     $('.sendEnquiry input[name="mobile"]').focus();
//    //     return false;
//    // }
//    if ($('.sendEnquiry input[name="email"]').val() == '') {
//        $('.enqmsg').html('Please enter your email id').css('color', 'red').fadeIn().delay(2000).fadeOut();
//        $('.sendEnquiry input[name="email"]').focus();
//        return false;
//    }
//    if (!EmailReg.test($('.sendEnquiry input[name="email"]').val())) {
//        $('.enqmsg').html('Please enter valid email address!!!').css('color', 'red').fadeIn().delay(2000).fadeOut();
//        $('.sendEnquiry input[name="email"]').focus();
//        return false;
//    }
//
//    $('.enqmsg').html('');
//    $('.sendEnquirySubmit').attr('disabled', 'disabled');
//    $.ajax({
//        url: SITEURL + 'cms/index/sendenquiry',
//        type: 'POST',
//        data: data,
//        dataType: 'json',
//        beforeSend: function() {
//            $('.sendEnquirySubmit').val('Sending...');
//        },
//        success: function(result) {
//            if (result.status) {
//                $("#getMessageBody").val(result.whatsappmessage);
//                $("#customerContact").val(result.contactno);
//                 var current_date = new Date().toLocaleDateString("en-US", {
//                     "year": "numeric",
//                     "month": "numeric",
//                     'day': '2-digit',
//                 });
// 
//                 localStorage.setItem("send_enquery_success", current_date);
//                 $('.sendEnquirySubmit').val('Send Enquiry');
//                 $('.enqmsg').html(result.message).css('color', 'green');
//                 $('#wpp_btn').css({ 'display': 'block', });
// 
//
//            } else {
//                $('.sendEnquirySubmit').val('Send Enquiry');
//                $('.enqmsg').html(result.message)
//            }
//
//
//        },
//        error: function(result) {
//            $('.sendEnquirySubmit').val('Send Enquiry');
//            alert('Some error occured.');
//        }
//    });
//
//});

$(".sendForex").on('submit', function (e) {
    $('.enqmsg').html('');
    e.preventDefault();
    var data = $(this).serialize();
    var EmailReg = new RegExp(/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/);
    if ($('.sendForex input[name="fname"]').val() == '') {
        $('.enqmsg').html('Please enter First name').css('color', 'red').fadeIn().delay(2000).fadeOut();
        $('.sendForex input[name="fname"]').focus();
        return false;
    }
    if ($('.sendForex input[name="lname"]').val() == '') {
        $('.enqmsg').html('Please enter last name').css('color', 'red').fadeIn().delay(2000).fadeOut();
        $('.sendForex input[name="lname"]').focus();
        return false;
    }
    if ($('.sendForex input[name="mobile"]').val() == '') {
        $('.enqmsg').html('Please enter your Mobile').css('color', 'red').fadeIn().delay(2000).fadeOut();
        $('.sendForex input[name="mobile"]').focus();
        return false;
    }
    if (!$.isNumeric($('.sendForex input[name="mobile"]').val())) {
        $('.enqmsg').html('Mobile should be numeric!!').css('color', 'red').fadeIn().delay(2000).fadeOut();
        $('.sendForex input[name="mobile"]').focus();
        return false;
    }

    if ($('.sendForex input[name="email"]').val() == '') {
        $('.enqmsg').html('Please enter your email id').css('color', 'red').fadeIn().delay(2000).fadeOut();
        $('.sendForex input[name="email"]').focus();
        return false;
    }
    if (!EmailReg.test($('.sendForex input[name="email"]').val())) {
        $('.enqmsg').html('Please enter valid email address!!!').css('color', 'red').fadeIn().delay(2000).fadeOut();
        $('.sendForex input[name="email"]').focus();
        return false;
    }

    $('.enqmsg').html('');
    $('.sendForexSubmit').attr('disabled', 'disabled');
    $.ajax({
        url: SITEURL + 'cms/index/sendenquiry',
        type: 'POST',
        data: data,
        dataType: 'json',
        beforeSend: function () {
            $('.sendForexSubmit').val('Sending...');
        },
        success: function (result) {
            if (result.status) {
                var current_date = new Date().toLocaleDateString("en-US", {
                    "year": "numeric",
                    "month": "numeric",
                    'day': '2-digit',
                });

                localStorage.setItem("send_enquery_success", current_date);
                $('.sendForexSubmit').val('Send Enquiry');
                $('.enqmsg').html(result.message).css('color', 'green');

            } else {
                $('.sendForexSubmit').val('Send Enquiry');
                $('.enqmsg').html(result.message)
            }


        },
        error: function (result) {
            $('.sendForexSubmit').val('Send Enquiry');
            alert('Some error occured.');
        }
    });

});


$(".sendVisaEnquiry").on('submit', function (e) {
    $('.enqmsg').html('');
    e.preventDefault();
    var data = $(this).serialize();
    var EmailReg = new RegExp(/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/);
    if ($('.sendVisaEnquiry input[name="name"]').val() == '') {
        $('.enqmsg').html('Please enter Full Name').css('color', 'red').fadeIn().delay(2000).fadeOut();
        $('.sendVisaEnquiry input[name="name"]').focus();
        return false;
    }

    if ($('.sendVisaEnquiry input[name="mobile"]').val() == '') {
        $('.enqmsg').html('Please enter your Mobile').css('color', 'red').fadeIn().delay(2000).fadeOut();
        $('.sendVisaEnquiry input[name="mobile"]').focus();
        return false;
    }
    if (!$.isNumeric($('.sendVisaEnquiry input[name="mobile"]').val())) {
        $('.enqmsg').html('Mobile should be numeric!!').css('color', 'red').fadeIn().delay(2000).fadeOut();
        $('.sendVisaEnquiry input[name="mobile"]').focus();
        return false;
    }

    if ($('.sendVisaEnquiry input[name="email"]').val() == '') {
        $('.enqmsg').html('Please enter your email id').css('color', 'red').fadeIn().delay(2000).fadeOut();
        $('.sendVisaEnquiry input[name="email"]').focus();
        return false;
    }
    if (!EmailReg.test($('.sendVisaEnquiry input[name="email"]').val())) {
        $('.enqmsg').html('Please enter valid email address!!!').css('color', 'red').fadeIn().delay(2000).fadeOut();
        $('.sendVisaEnquiry input[name="email"]').focus();
        return false;
    }

    $('.enqmsg').html('');
    $('.sendVisaEnquirySubmit').attr('disabled', 'disabled');
    $.ajax({
        url: SITEURL + 'cms/index/send-visa-enquiry',
        type: 'POST',
        data: data,
        dataType: 'json',
        beforeSend: function () {
            $('.sendVisaEnquirySubmit').val('Sending...');
        },
        success: function (result) {
            if (result.status) {
                var current_date = new Date().toLocaleDateString("en-US", {
                    "year": "numeric",
                    "month": "numeric",
                    'day': '2-digit',
                });

                localStorage.setItem("send_enquery_success", current_date);
                $('.sendVisaEnquirySubmit').val('Send Visa Enquiry');
                $('.enqmsg').html(result.message).css('color', 'green');

            } else {
                $('.sendVisaEnquirySubmit').val('Send Visa Enquiry');
                $('.enqmsg').html(result.message)
            }


        },
        error: function (result) {
            $('.sendVisaEnquirySubmit').val('Send Visa Enquiry');
            alert('Some error occured.');
        }
    });

});



$(".sendEnquiryServices").on('submit', function (e) {
    $('.msgrequest').html('');
    e.preventDefault();
    var data = $(this).serialize();
    var EmailReg = new RegExp(/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/);
    if ($('.sendEnquiryServices input[name="fname"]').val() == '') {
        $('.msgrequest').html('Please enter your name').css('color', 'red').fadeIn().delay(2000).fadeOut();
        $('.sendEnquiryServices input[name="fname"]').focus();
        return false;
    }


    // if ($('.sendEnquiry input[name="mobile"]').val().length != '10') {
    //     $('.enqmsg').html('Mobile should be 10 digit?').css('color', 'red').fadeIn().delay(2000).fadeOut();
    //     $('.sendEnquiry input[name="mobile"]').focus();
    //     return false;
    // }
    if ($('.sendEnquiryServices input[name="email"]').val() == '') {
        $('.msgrequest').html('Please enter your email id').css('color', 'red').fadeIn().delay(2000).fadeOut();
        $('.sendEnquiryServices input[name="email"]').focus();
        return false;
    }
    if (!EmailReg.test($('.sendEnquiryServices input[name="email"]').val())) {
        $('.msgrequest').html('Please enter valid email address!!!').css('color', 'red').fadeIn().delay(2000).fadeOut();
        $('.sendEnquiryServices input[name="email"]').focus();
        return false;
    }

    if ($('.sendEnquiryServices input[name="mobile"]').val() == '') {
        $('.msgrequest').html('Please enter your Mobile').css('color', 'red').fadeIn().delay(2000).fadeOut();
        $('.sendEnquiryServices input[name="mobile"]').focus();
        return false;
    }
    if (!$.isNumeric($('.sendEnquiryServices input[name="mobile"]').val())) {
        $('.msgrequest').html('Mobile should be numeric!!').css('color', 'red').fadeIn().delay(2000).fadeOut();
        $('.sendEnquiryServices input[name="mobile"]').focus();
        return false;
    }
    $('.sendEnquiryServicesBtn').attr('disabled', 'disabled');
    $.ajax({
        url: SITEURL + 'cms/index/sendenquiry',
        type: 'POST',
        data: data,
        dataType: 'json',
        beforeSend: function () {
            $('.sendEnquiryServicesBtn').val('Sending...');
        },
        success: function (result) {
            if (result.status) {
                $('.sendEnquiryServicesBtn').val('Send Enquiry');
                $('.msgrequest').html(result.message).show().css('color', 'green');

            } else {
                $('.sendEnquiryServicesBtn').val('Send Enquiry');
                $('.msgrequest').html(result.message).show();
            }


        },
        error: function (result) {
            $('.sendEnquiryServicesBtn').val('Send Enquiry');
            alert('Some error occured.');
        }
    });


});
//Added by Piyush on 22 Aug 2018 start

$("#travelers").on("click", function () {

    var checkClass = $(".roomBoxMain").hasClass('myCustomClass');
    if (checkClass == false) {
        $(".roomBoxMain").toggle('myCustomClass');
        $(".roomBoxMain").css('display', 'block');
        $('#adultgroup_1 select').val(2);
    } else {
        $(".roomBoxMain").css('display', 'none');
    }
});

function checkTravellers(that, rownumber) {

    var div = $(that).closest('.room-rows-container');
    var totalpax = 0;
    var adults = $('#traveler_adult_' + rownumber).val();
    var kids = $('#traveler_kids_' + rownumber + '1').val();
    var kids2 = $('#traveler_kids_' + rownumber).val();
    var infant = $('#traveler_infant_' + rownumber).val();
    if (typeof kids == 'undefined') {
        kids = 0;
    }
    if (typeof kids2 == 'undefined') {
        kids2 = 0;
    }
    var adult_type = $('.adult_type_' + rownumber + ':checked').val();
    var checkPax = 4;
    if (adult_type == 'quad') {
        checkPax = 6;

    } else if (adult_type == 'quint') {
        checkPax = 7;

    } else if (adult_type == 'hexa') {
        checkPax = 8;

    }
    totalpax = parseInt(adults) + parseInt(kids) + parseInt(kids2) + parseInt(infant);


    if (parseInt(totalpax) > parseInt(checkPax)) {
        alert("Total pax can not be more than " + parseInt(checkPax) + " in a room. Please modify travellers in room " + rownumber);

        if ($(that).hasClass('traveler_adult'))
            $(that).val(1);
        else
            $(that).val(0);

        return false;
    } else {
        if (parseInt(adults) == 3) {
            div.find('#room-row-adult-bedtype-' + rownumber).show();
            div.find('#room-row-adult-bedtype-' + rownumber + ' select').val('extrabed');
        } else {
            div.find('#room-row-adult-bedtype-' + rownumber).hide();
            div.find('#room-row-adult-bedtype-' + rownumber + ' select').val('');
        }

        div.find('.room-row-child-bedtype-' + rownumber).hide(); // hide all select box
        if (parseInt(kids) > 0 && (adult_type != 'quad' && adult_type != 'quint' && adult_type != 'hexa')) {
            for (var i = 1; i <= parseInt(kids); i++) {
                div.find('#room-row-child-bedtype-' + rownumber + "-" + i).show();
                div.find('#room-row-child-bedtype-' + rownumber + "-" + i + ' select').val('extrabed');
            }
        }
        if (parseInt(kids2) > 0) {
            for (var i = 1; i <= parseInt(kids2); i++) {
                div.find('#room-row-child-bedtype-' + rownumber + "-" + i).show();
                div.find('#room-row-child-bedtype-' + rownumber + "-" + i + ' select').val('extrabed');
            }
        }
    }


}

function tottraveller() {
    var totaladult = '0';
    var totalchild = '0';
    var totalinfant = '0';
    var Group = $('.Group').is(":checked");
    var roomlp = $("#roomlp").val();
    if (Group === true) {
        var adult_1 = $("#adult_1").val();
        var child_1 = $("#child_1").val();
        if (adult_1 === '') {
            alert('Please enter total adults');
            $("#adult_1").focus();
            return false;
        }
        if (child_1 === '') {
            alert('Please enter total children');
            $("#child_1").focus();
            return false;
        }

    }

    var childrenbed = [];
    for (j = 1; j <= roomlp; j++) {
        totaladult = parseFloat(totaladult) + parseFloat($("#adult_" + j).val());
        totalchild = parseFloat(totalchild) + parseFloat($("#child_" + j).val());
        totalinfant = parseFloat(totalinfant) + parseFloat($("#infant_" + j).val());
        var extraBed = $('#extrabed_' + j + ':checked').val();
        childrenbed.push(extraBed);
    }
    var totaltraveller = parseInt(totaladult) + parseInt(totalchild) + parseInt(totalinfant);
    var MaxPax = parseInt(roomlp) * 4;
    if (Group === false) {
        if (totaltraveller > MaxPax) {
            alert('Only 4 pax are allowed in each room. Please modify travelers');
            return false;
        }
    }
    $("#totadlt").val(totaladult);
    $("#totchld").val(totalchild);
    $("#totinfnt").val(totalchild);
    $("#numberofroom").html(roomlp);
    $("#roomguest").html(totaltraveller);
    $("#totaltravelers").val(totaltraveller);
    $(".roomBoxMain").hide();
    var roominfojson = '[{"totalRoom" : ' + roomlp + '},{"totalTraveler" : ' + totaltraveller + '},{"totaladult" : ' + totaladult + '},{"totalchild" : ' + totalchild + '},{"totalinfant" : ' + totalinfant + '}]'
    $("#roominfojson").val(roominfojson);
    $(".roomBoxMain").hide();
}

function tottravelerInRoom(roomno) {
    //    alert(roomno);
    var adult = $("#adult_" + roomno).val();
    var child = $("#child_" + roomno).val();
    var infant = $("#infant_" + roomno).val();
    var totalPaxInRoom = parseInt(adult) + parseInt(child) + parseInt(infant);
    var Group = $('.Group').is(":checked");
    if (Group === false) {
        if (totalPaxInRoom >= 5) {
            alert('Only 4 pax are allowed in each room. Please modify travelers in Room no. ' + roomno);
            return false;
        }
    }

}

function addroom() {
    var roomlp = $("#roomlp").val();
    var showroom = parseInt(roomlp) + 1;
    if (showroom === 11) {
        alert('Only 10 rooms are allowed.');
        return false;
        //            $('.addroom').hide();
    }
    $("#roomlp").val(showroom);
    $("#rmres_" + showroom).show();
    $('.disproom').hide();
    $('.disproom_' + showroom).show();
    $("#adult_" + showroom).focus();
}

function delroom(id) {
    var showroom = parseInt(id) - 1;
    $('.addroom').show();
    $("#roomlp").val(showroom);
    $("#rmres_" + id).hide();
    $('.disproom').hide();
    $('.disproom_' + showroom).show();
}

function showchildagebox(id) {
    var childrencount = $("#child_" + id).val();
    //        alert(childrencount+'___'+id);
    var j;
    $(".childcl_" + id).show();
    $(".childage_" + id).hide();
    if (childrencount === '0') {
        $(".childcl_" + id).hide();
        return false;
    }

    for (j = 1; j <= childrencount; j++) {

        $("#child_" + id + "_" + j).show();
    }
    //var showroom = parseInt(roomlp)+parseInt(roomlp);
    //$("#rmres_"+showroom).show();adult_ child_ roomBoxMain
    tottravelerInRoom(id);
}

function showextrabedchildagebox(id) {
    var childrencount = $("#child_" + id).val();
    //        alert(childrencount+'___'+id);
    var j;
    $(".childage_" + id).hide();
    for (j = 1; j <= childrencount; j++) {
        $("#childcl_" + id + "_" + j).show();
        $("#childcl_" + id + "_" + j + ' select').val('extrabed');
    }
    tottravelerInRoom(id);
}

function showextrabedbox(roomno) {
    var adult = $("#adult_" + roomno).val();
    if (adult == 3) {
        $(".adultcl_" + roomno + '_3').show();
    } else {
        $(".adultcl_" + roomno + '_3').hide();
    }
    tottravelerInRoom(roomno);
}

$("#selectDestination").autocomplete({
    source: function (request, response) {
        var query = $("#selectDestination").val();
        var countryId = '';
        $.getJSON("/index/autosuggest", {query: query, countryId: countryId},
                response);
    },
    minLength: 2,
    autoFocus: true,
    select: function (event, ui) {
        var CityId = ui.item.CityId;
        var CityName = ui.item.CityName;
        $("#hidden_selected_hotel_cityid").val(CityId);
        $("#hidden_selected_city_name").val(CityName);
    }
});


$(document).on('click', '.removeit', function () {
    var count = $('#itinerary_inputs').val();
    var rooms = $('#itinerary_rooms').val();
    if (count == 1) {
        return false;
    }
    $('#itinerary_inputs').val(parseInt(count) - 1);
    $('#itinerary_rooms').val(parseInt(rooms) - 1);

    $('.room-rows-container').find('.inserted-room-row:last').remove();
});
$(document).on('click', '.addmorePop', function () {
    var count = 1;
    var room = 2;
    count = parseInt($('#itinerary_inputs').val());
    room = parseInt($('#itinerary_rooms').val());
    var IsQuadPrice = $('#IsQuadPrice').val();
    //alert(count);
    CONST_PACKAGE_TRAVELER_MAX_ROOM = parseInt(CONST_PACKAGE_TRAVELER_MAX_ROOM);
    CONST_PACKAGE_TRAVELER_MAX_ADULT_IN_ROOM = parseInt(CONST_PACKAGE_TRAVELER_MAX_ADULT_IN_ROOM);
    if (room > CONST_PACKAGE_TRAVELER_MAX_ROOM) {
        alert("Can not add more than " + CONST_PACKAGE_TRAVELER_MAX_ROOM + " rooms.");
        return false;
    }



    if (IsQuadPrice == 1) {

        var adult_type_quad = $('input[id="adult_type_quad_1"]:checked').val();
        var quadcheck = '';
        var quintcheck = '';
        var hexacheck = '';
        var mtype = 0;
        if (adult_type_quad == 'quad') {
            quadcheck = 'checked';
            mtype = 1;
        } else if (adult_type_quad == 'quint') {
            quintcheck = 'checked';
            mtype = 2;
        } else if (adult_type_quad == 'hexa') {
            hexacheck = 'checked';
            mtype = 3;
        }

        var htmlAd = '';
        for (var mm = 1; mm <= CONST_PACKAGE_TRAVELER_MAX_ADULT_IN_ROOM; mm++) {
            htmlAd += '<option value="' + mm + '"> ' + mm + '</option>';
        }

        $('.room-rows-container').append('<div class="row">' + '<div class="col-lg-12 room-box room-row inserted-room-row">' + '<div class="row">' + '<div class="col-md-12 colspan-booking">' + '<div class="table-bordered"></div>' + '<label >Room ' + room + ' </label><button style="right:15px;" type="button" class="pull-right rounded text-danger removeit" aria-hidden="true" title="Remove Room">x&nbsp;&nbsp;</button> ' + ' <input type="hidden" name="room[]" value="' + room + '" />' + '<span id="Quad_adult_type_' + room + '" style="display:flex;">' +
                '<input ' + quadcheck + ' type="checkbox" onclick="modify_QuadPrice(' + room + ',1)" name="adult_type[' + room + ']" id="adult_type_quad_' + room + '" value="quad" class="adult_type_' + room + '" />' +
                '<label class="sign-txt" style="padding: 6px;"> Quad </label>&nbsp;' +
                '<input ' + quintcheck + ' type="checkbox" onclick="modify_QuadPrice(' + room + ',2)" name="adult_type[' + room + ']" id="adult_type_quint_' + room + '" value="quint" class="adult_type_' + room + '" />' +
                '<label class="sign-txt" style="padding: 6px;"> Quint </label> &nbsp;' +
                '<input ' + hexacheck + ' type="checkbox" onclick="modify_QuadPrice(' + room + ',3)" name="adult_type[' + room + ']" id="adult_type_hexa_' + room + '" value="hexa" class="adult_type_' + room + '" />' +
                '<label class="sign-txt" style="padding: 6px;"> Hexa </label> ' +
                '<input type="hidden" id="IsQuadPrice" value="0" />' +
                '</span></div>' + '  <div class="cl"></div>' + '<div class="col-md-3 form-group1">' + '' + '<label for="roomtype">Adult(s) <span>(+12Yrs)</span></label>' +
                '<select name="adult[]" id="traveler_adult_' + room + '"  class="traveler_adult form-control" onchange="checkTravellers(this ,' + room + ');">' + '<option value="1">Adults(+12Yrs)</option>' + htmlAd + '</select>' + '  </div>' +
                '<div class="col-md-3 form-group1" style="display: none" id="room-row-adult-bedtype-' + room + '"><select name="adult_bed_type[]" class="traveler_child form-control" onchange="checkAdultBedType(this);"><option value="">Adult Bedtype</option><option value="withoutbed">Without Bed</option><option value="extrabed">With Bed</option></select></div>' +
                '<div class="col-md-3 form-group1 form-group room-type-col traveler_kids_div_' + room + '1" id="Quad_Kids_type_' + room + '"> <label for="roomtype" class="traveler_kids_label_' + room + '">Kids (2 - 4Yrs)</label><select name="child[]" class="traveler_child form-control" id="traveler_kids_' + room + '1" onchange="checkTravellers(this, ' + room + ');" >  <option value="0"> Select Kids</option> <option value="1">1</option><option value="2">2</option> </select>   ' +
                '</div> <div class="col-md-3 form-group1 form-group room-type-col traveler_kids_div_' + room + '2" > <label for="roomtype" >Kids (5 - 12Yrs)</label><select name="child2[]" class="traveler_child form-control" id="traveler_kids_' + room + '2" onchange="checkTravellers(this, ' + room + ');">  <option value="0"> Select Kids</option>  <option value="1">1</option> <option value="2">2</option> </select> </div>' + '<div class="col-md-3 form-group1 room-row-child-bedtype-' + room + '" style="display: none" id="room-row-child-bedtype-' + room + '-1">' +
                '<label for="roomtype">Extra Bedtype</label><select name="child1_bed_type[]" class="traveler_child form-control" id="room-row-child-bedtype-1-1" onchange="checkAdultBedType(this);"><option value="">Child 1 Bedtype</option><option value="withoutbed">Without Bed</option><option value="extrabed">With Bed</option><option value="none">None</option></select></div><div class="col-md-3 form-group1 room-row-child-bedtype-' + room + '" style="display: none" id="room-row-child-bedtype-' + room + '-2">' +
                '<label for="roomtype">Extra Bedtype</label><select name="child2_bed_type[]" class="traveler_child form-control" id="room-row-child-bedtype-1-2" onchange="checkAdultBedType(this);"><option value="">Child 2 Bedtype</option><option value="withoutbed">Without Bed</option><option value="extrabed">With Bed</option><option value="none">None</option></select></div> <div class="col-md-3 form-group1">' + '<label for="roomtype">Infant (0 - 2Yrs)</label>' + '<select name="infant[]" class="traveler_infant form-control" id="traveler_infant_' + room + '" onchange="checkTravellers(this,' + room + ');">' + '<option value="0">Infant(0 - 2Yrs)</option>' + '<option value="0">0</option>' + '<option value="1"> 1</option>' + '<option value="2"> 2</option>' + '<option value="3"> 3</option>' + '<option value="4"> 4</option>' + '</select>' + '</div>' + '</div>' + '</div>');
        modify_QuadPrice(room, mtype)
    } else {
        $('.room-rows-container').append('<div class="row">' + '<div class="col-lg-12 room-box room-row inserted-room-row">' + '<div class="row">' + '<div class="col-md-12 colspan-booking">' + '<div class="table-bordered"></div>' + '<label >Room ' + room + ' </label><button style="right:15px;" type="button" class="pull-right rounded text-danger removeit" aria-hidden="true" title="Remove Room">x</button>' + ' <input type="hidden" name="room[]" value="' + room + '" />' + '</div>' + '  <div class="cl"></div>' + '<div class="col-md-3 form-group1">' + '' + '<select name="adult[]" id="traveler_adult_' + room + '"  class="traveler_adult form-control" onchange="checkTravellers(this ,' + room + ');">' + '<option value="1">Adults(+12Yrs)</option>' + '<option value="1"> 1</option>' + '<option value="2"> 2</option>' + '<option value="3"> 3</option>' + '</select>' + '  </div>' + '<div class="col-md-3 form-group1" style="display: none" id="room-row-adult-bedtype-' + room + '"><select name="adult_bed_type[]" class="traveler_child form-control" onchange="checkAdultBedType(this);"><option value="">Adult Bedtype</option><option value="withoutbed">Without Bed</option><option value="extrabed">With Bed</option></select></div><div class="col-md-3 form-group1">' + '' + '<select name="child[]" class="traveler_child form-control" id="traveler_kids_' + room + '" onchange="checkTravellers(this,' + room + ');">' + '<option value="0">Kids(2 - 12Yrs)</option>' + '<option value="0">0</option>' + '<option value="1"> 1</option>' + '<option value="2"> 2</option>' + '</select>' + ' </div>' + '<div class="col-md-3 form-group1 room-row-child-bedtype-' + room + '" style="display: none" id="room-row-child-bedtype-' + room + '-1"><select name="child1_bed_type[]" class="traveler_child form-control" id="room-row-child-bedtype-1-1" onchange="checkAdultBedType(this);"><option value="">Child 1 Bedtype</option><option value="withoutbed">Without Bed</option><option value="extrabed">With Bed</option><option value="none">None</option></select></div><div class="col-md-3 form-group1 room-row-child-bedtype-' + room + '" style="display: none" id="room-row-child-bedtype-' + room + '-2"><select name="child2_bed_type[]" class="traveler_child form-control" id="room-row-child-bedtype-1-2" onchange="checkAdultBedType(this);"><option value="">Child 2 Bedtype</option><option value="withoutbed">Without Bed</option><option value="extrabed">With Bed</option><option value="none">None</option></select></div> <div class="col-md-3 form-group1">' + '' + '<select name="infant[]" class="traveler_infant form-control" id="traveler_infant_' + room + '" onchange="checkTravellers(this,' + room + ');">' + '<option value="0">Infant(0 - 2Yrs)</option>' + '<option value="0">0</option>' + '<option value="1"> 1</option>' + '<option value="2"> 2</option>' + '<option value="3"> 3</option>' + '<option value="4"> 4</option>' + '</select>' + '</div>' + '</div>' + '</div>');
    }
    $('#itinerary_inputs').val(parseInt(count) + 1);
    $('#itinerary_rooms').val(parseInt(room) + 1);
    $('#roomlp').val(parseInt(room));
});

function modify_QuadPrice(room, type) {
    var quad = '';
    if (type == 1) {
        quad = 'quad';
    } else if (type == 2) {
        quad = 'quint';
    } else if (type == 3) {
        quad = 'hexa';
    }
    var IsQuadCh = $('#adult_type_' + quad + '_' + room).prop('checked');
    $('.adult_type_' + room).prop('checked', false);
    var IsQuad = false;
    var IsQuint = false;
    var IsHexa = false;
    if (IsQuadCh == true) {

        if (type == 1) {
            IsQuad = true;
            $('#adult_type_quad_' + room).prop('checked', true);
        } else if (type == 2) {
            IsQuint = true;
            $('#adult_type_quint_' + room).prop('checked', true);
        } else if (type == 3) {
            IsHexa = true;
            $('#adult_type_hexa_' + room).prop('checked', true);
        }
    }
    $('.traveler_kids_div_' + room + '2').hide();
    $('.traveler_kids_label_' + room).html('Kids (2 - 12Yrs)');
    $('#traveler_adult_' + room).val(2);
    var id123 = "traveler_adult_" + room;
    $("#" + id123 + " option[value='4']").attr("hidden", true);
    $("#" + id123 + " option[value='5']").attr("hidden", true);
    $("#" + id123 + " option[value='6']").attr("hidden", true);
    if (IsQuad == true) {

        $("#" + id123 + " option[value='4']").attr("hidden", false);
        $('.traveler_kids_div_' + room + '2').show();
        $('.traveler_kids_label_' + room).html('Kids (2 - 4Yrs)');
    } else if (IsQuint == true) {
        $("#" + id123 + " option[value='4']").attr("hidden", false);
        $("#" + id123 + " option[value='5']").attr("hidden", false);
        $('.traveler_kids_div_' + room + '2').show();
        $('.traveler_kids_label_' + room).html('Kids (2 - 4Yrs)');

    } else if (IsHexa == true) {
        $("#" + id123 + " option[value='4']").attr("hidden", false);
        $("#" + id123 + " option[value='5']").attr("hidden", false);
        $("#" + id123 + " option[value='6']").attr("hidden", false);
        $('.traveler_kids_div_' + room + '2').show();
        $('.traveler_kids_label_' + room).html('Kids (2 - 4Yrs)');
    }
}


function modify_enquiry(that) {
    $(that).hide();
    if ($('#check_TravelAgent').val() == 1) {
        $('.sending1').html('Check Rate &amp; Get Proposal').show();
        $('.sending2').html('Check Rate &amp; Get Proposal').show();
    } else {
        $('.sending1').html('Continue to Book').show();
        $('.sending2').html('Continue to Book').show();
        $('#tableCost').hide();
    }
    $('.class-book-now-btn').hide();
    $('.sending1').html('Continue to Book').attr('disabled', false);
    $('.sending2').html('Continue to Book').attr('disabled', false);
    $('.smsg1').html('');
}

function modify_enquiry_btn(that) {
    $(that).hide();
    if ($('#check_TravelAgent').val() == 1) {
        $('.sending1').html('Check Rate &amp; Get Proposal').show();
        $('.sending2').html('Check Rate &amp; Get Proposal').show();
    } else {
        $('.sending1').html('Continue to Book').show();
        $('.sending2').html('Continue to Book').show();
        $('#tableCost').hide();
    }
    $('#leadsends').val(0);
    $('.class-book-now-btn').hide();
    $('.sending1').html('Continue to Book').attr('disabled', false);
    $('.sending2').html('Continue to Book').attr('disabled', false);
    $('.smsg1').html('');
}

function checkAdultBedType(that) {
    if ($(that).val() == '') {
        alert('Please select bed type');
        $(that).val('extrabed');
        return false;
    }
}

function ptMoneyFormatINR(n, prec, currSign) {
    if (prec == null)
        prec = 2;
    var n = ('' + parseFloat(n).toFixed(prec).toString()).split('.');
    var num = n[0];
    var dec = n[1];
    var r, s, t;
    if (num.length > 3) {
        s = num.length % 3;
        if (s) {
            t = num.substring(0, s);
            num = t + num.substring(s).replace(/(\d{3})/g, ",$1");
        } else {
            num = num.substring(s).replace(/(\d{3})/g, ",$1").substring(1);
        }
    }
    //    return(currSign == null ? "" : currSign + "") + num + '.' + dec;
    return (currSign == null ? "" : currSign + "") + num;
}



function changeContentByCategory(cname, desname, packageId, catId, gtxId, tourType, mp) {
    var fixDestinations = $('.fixdeparture-destinations' + parseInt(packageId)).val();
    var catIdVal = $(catId).val();
    if (catIdVal == undefined) {
        var catIdVal = catId;
    }
    // alert(cname);
    //     var data = SITEURL + 'detail/'+cname+'/'+desname+'-'+packageId+'-'+catId+'-'+gtxId+'-'+tourType+'-'+mp+'.html';
    var countryname = cname;
    var name = desname + '-' + packageId + '-' + catIdVal + '-' + gtxId + '-' + tourType + '-' + mp + '.html';
    // alert(name);
    // alert("work");
    $.ajax({
        url: SITEURL + 'detail/index/index-ajax-data',
        type: 'POST',
        data: {countryname: countryname, name: name, fixDestinations: fixDestinations},
        dataType: 'html',
        beforeSend: function () {
            //      alert("hello");
        },
        success: function (result) {
            // console.log(result);
            $('#changeContentByajax').html('');
            $('#changeContentByajax').html(result);
            $('#downloadBroucherData').attr('href', SITEURL + 'detail/index/download-package-pdf/gtxid/' + gtxId + '/pkgid/' + packageId + '/catid/' + catIdVal);
            //copyPriceFunction(packageId, parseInt(catIdVal));
            return false;
        },
        error: function () {
            alert('Oops unable to connect with server!!');
            return false;
        }
    });
}
//function changeContentBytabFunc(PkgSysId, tab) {
//    //var hotel = $('#hotelTypeElement_' + packageId).val();
//
//    var packageId = PkgSysId;
//    var gtxId = $('#gtxpackage_' + packageId).val();
//    var desname = $('#citytxtval_' + packageId).val();
//    var cname = $('#package_location_' + packageId).val();
//    var catId = $('#hotelcategoryid_' + packageId).val();
//    var tourType = $('#tourtype_' + packageId).val();
//    var mp = $('#mealplantype_' + packageId).val();
//    var hotel_type = document.getElementById("hotelType_" + packageId).value;
//    changeContentBytab(cname, desname, packageId, catId, gtxId, tourType, mp, tab, hotel_type);
//    //alert(hotel_type);
//
//}
changeContentBytabFunc = function (that, tab) {

    var packageId = $(that).attr('PkgSysId');
    var gtxId = $('#gtxpackage_' + packageId).val();
    var desname = $('#citytxtval_' + packageId).val();
    var cname = $('#package_location_' + packageId).val();
    var catId = $('#hotelcategoryid_' + packageId).val();
    var tourType = $('#tourtype_' + packageId).val();
    var mp = $('#mealplantype_' + packageId).val();
    var hotel_type = $("#hotelType_" + packageId).val();



    changeContentBytab(cname, desname, packageId, catId, gtxId, tourType, mp, tab, hotel_type);

};
changeContentBytabCategoryFunc = function (that, tab) {
    var packageId = $(that).attr('PkgSysId');
    var catId = $(that).val();
    var gtxId = $('#gtxpackage_' + packageId).val();
    var desname = $('#citytxtval_' + packageId).val();
    var cname = $('#package_location_' + packageId).val();
    $('#hotelcategoryid_' + packageId).val(catId);
    var tourType = $('#tourtype_' + packageId).val();
    var mp = $('#mealplantype_' + packageId).val();
    var hotel_type = $('.categorySelect_' + parseInt(packageId) + ' option:selected').attr('categoryName');
    changeContentBytab(cname, desname, packageId, catId, gtxId, tourType, mp, tab, hotel_type);
    changeContentByCategory(cname, desname, packageId, catId, gtxId, tourType, mp);


}

function changeContentBytab(cname, desname, packageId, catId, gtxId, tourType, mp, tab, hotel_type, desid, tabprice) {

    $('#list_BudgetActive').show();
    var catIdRoom = catId;
    var catIdVal = $(catId).val();
    if (catIdVal == undefined) {
        var catIdVal = catId;
    }
    if (desname == '') {
        var desname = mp;
    }

    if (catId == '') {
        var catId = mp;
    }
    if (tourType == '') {
        var tourType = 1;
    }
    if (catIdVal == '') {
        var catIdVal = 1;
    }

    // var data = SITEURL + 'detail/'+cname+'/'+desname+'-'+packageId+'-'+catId+'-'+gtxId+'-'+tourType+'-'+mp+'.html';
    var countryname = cname;
    var tab = tab;
    var hotel_type = hotel_type;
    var name = desname + '-' + packageId + '-' + catIdVal + '-' + gtxId + '-' + tourType + '-' + mp + '.html';
    var fixdestinations = $('.fixdeparture-destinations' + packageId).val();
// alert(fixdestinations);
    //var fixdeparture_destinations = $('.fixdeparture-destinations' + parseInt(packageId)).val();
    if (fixdestinations == '' || fixdestinations == undefined) {
        fixdestinations = '';
    }
    $(".PriceDivByCat_" + packageId).hide();
    $(".PriceDivByCat_" + packageId + "_" + fixdestinations + "_" + hotel_type).show();
    $.ajax({
        url: SITEURL + 'detail/index/index-ajax-tab',
        type: 'POST',
        data: {countryname: countryname, name: name, tab: tab, hotel_type: hotel_type, fixdestinations: fixdestinations},
        dataType: 'html',
        async: false,
        beforeSend: function () {
            $('#changeContentByajax_' + packageId).html('<div class="loadertab"></div>');
        },

        success: function (result) {
            // console.log(result);
            $('#changeContentByajax_' + packageId).html(result);
            var CategoryWiseTPId = $('.CategoryWiseTPId_' + parseInt(packageId) + parseInt(catIdVal)).val();
            $('#packagetpid_' + packageId).val(CategoryWiseTPId);


            if (hotel_type != 'Budget') {

                $('#list_BudgetActive').hide();
            }
            if (tabprice == 'tabprice') {

                $('#list_BudgetActive').show();
            }

            if (catIdRoom == '1') {
                $('#list_BudgetActive').show();
            } else if (catIdRoom == '2') {
                $('#list_StandardActive').show();
            } else if (catIdRoom == '3') {
                $('#list_DeluxeActive').show();
            } else if (catIdRoom == '4') {
                $('#list_LuxuryActive').show();
            } else if (catIdRoom == '5') {
                $('#list_PremiumActive').show();
            }
			
			 
			 var hotel_type = $('.categorySelect_' + parseInt(packageId) + ' option:selected').attr('categoryName');

            $('#list_' + hotel_type + 'Active').show();

            return false;
        },
        error: function () {
            alert('Oops unable to connect with server!!');
            return false;
        }
    });
}


function copyPriceFunction(PkgSysId, catIdVal) {

    var pkgprice_copy = $('.priceByCategory').val();
    // alert(pkgprice_copy);
    var pkgprice_copyNoformat = $('.priceByCategoryNoFormat').val();

    var PackageType = $('#mpackagetpid_' + PkgSysId).val();
    $('#pkgprice_paste1').html(pkgprice_copy);
    $('#pkgprice_paste2').html(pkgprice_copy);
    $('#pkgprice_pasteMobile2').html(pkgprice_copy);

    $('#original_pkgprice_' + parseInt(PkgSysId)).val(pkgprice_copyNoformat);
    $('#updated_pkgprice_' + parseInt(PkgSysId)).val(pkgprice_copyNoformat);
    $('#package_tpid').val(PackageType);
    $('#package_hotelcategoryid').val(catIdVal);
}

function viewPerPersonPrice() {
    var data = $(".package_rate_enquiry").serialize();
    $.ajax({
        url: SITEURL + 'gtxwebservices/send-enquiry/get-per-person-price',
        type: 'POST',
        data: data,
        dataType: 'html',
        beforeSend: function () {},
        success: function (result) {
            $('#myModa1PerPersonPrice').modal('show');
            $('#myModa1PerPersonPriceHtml').html(result);
        },
        error: function (result) {

        }
    });



}

function moreless(type, e) {
    if (type == null) {
        $(e).parent().find('a.limore').toggleClass("hidee");
    } else if (type == 'li') {
        $(e).parent().parent().find('li.limore').toggleClass("hidee")
    }
    $(e).html(($(e).text() == '-') ? '+' : '-');
}

function resetfilter() {
    $('.filtercheckbox').each(function () {
        console.log('reset');
        var isChecked = $(this).is(':checked');
        if (isChecked == true) {
            $(this).trigger('click');
        }
    });
}
$(document).on('click', '.iamplusminus', function () {
    if ($(this).hasClass('expand')) {
        $(this).html('<i class="icon-plus"></i>').addClass('collepse').removeClass('expand').attr('title', 'More...');
        $(this).parent().css({'height': '180px'});
    } else {
        $(this).html('<i class="icon-minus"></i>').addClass('expand').removeClass('collepse').attr('title', 'Less...');
        ;
        $(this).parent().css({'height': 'auto'});
    }
});
$(".activity_enquiry").on('submit', function (e) {
    var EmailReg = new RegExp(/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/);
    e.preventDefault();
    var data = $(this).serialize();
    var leadsend = $("#leadsend_act").val();

    if ($('.activity_enquiry input[name="name"]').val() == '') {
        $('.msg').show().html('Please enter your name');
        $('.activity_enquiry input[name="name"]').focus();
        return false;
    }
    if ($('.activity_enquiry input[name="email"]').val() == '') {
        $('.msg').show().html('Please enter your email address');
        $('.activity_enquiry input[name="email"]').focus();
        return false;
    }
    if (!EmailReg.test($('.activity_enquiry input[name="email"]').val())) {
        $('.msg').show().html('Please enter valid email address!!!');
        $('.activity_enquiry input[name="email"]').focus();
        return false;
    }
    if ($('.activity_enquiry input[name="mobile"]').val() == '') {
        $('.msg').show().html('Please enter your mobile number');
        $('.activity_enquiry input[name="mobile"]').focus();
        return false;
    }
    // if ($('.activity_enquiry input[name="mobile"]').val().length != '10') {
    //     $('.msg').show().html('Mobile should be 10 digit?');
    //     $('.activity_enquiry input[name="mobile"]').focus();
    //     return false;
    // }
    if (!$.isNumeric($('.activity_enquiry input[name="mobile"]').val())) {
        $('.msg').show().html('Mobile should be numeric!!');
        $('.activity_enquiry input[name="mobile"]').focus();
        return false;
    }
    if (leadsend == '0') {
        $.ajax({
            url: SITEURL + 'cms/index/sendenquiry',
            type: 'POST',
            data: data,
            dataType: 'json',
            beforeSend: function () {
                $('.activity_enquiry .msg').hide().html('');
                $('.activity_enquiry .sending').html('<i class="ace-icon fa fa-spinner fa-spin orange bigger-125"></i> Sending...').attr('disabled', 'disabled');
            },
            success: function (result) {
                $(".activity_enquiry #leadsend_act").val('1');
                $('.activity_enquiry .sending').html('Calculate Cost &amp; Send Enquiry').attr('disabled', false);
                $('.activity_enquiry .expandsave').show();
                $('.activity_enquiry').submit();

            },
            error: function (result) {
                $('.activity_enquiry .smsg').show().html('Sorry, System encountered some error.\n\ We will revert back with suitable suggestions.').css({'color': '#ff0000'});
            }
        });
    } else {

        if ($('.activity_enquiry input[name="date"]').val() == '') {
            $('.activity_enquiry .msg').show().html('Please enter travel date');
            $('.activity_enquiry input[name="date"]').focus();
            return false;
        }
        $('.activity_enquiry .msg').hide().html('');
        $.ajax({
            url: SITEURL + 'gtxwebservices/send-enquiry-activity/post',
            type: 'POST',
            data: data,
            dataType: 'json',
            beforeSend: function () {
                $('.activity_enquiry .sending').html('<i class="ace-icon fa fa-spinner fa-spin orange bigger-125"></i> Getting Cost...').attr('disabled', 'disabled');
            },
            success: function (result) {
                //                console.log(result);
                if ((result.status == 'success') && (result.availability == true)) {
                    $('.smsg').show().html("Thanks! Your enquiry submitted successfully. Soon our expert will contact you.").css({'color': '#5cb85c'});
                    var priceTax = result.addtional['GSTAmount']; // Tax
                    var sumRoomWise = result.addtional['MyCost']; // TotalPrice
                    var priceGT = result.addtional['AmountWithGST']; // GrandTotal
                    if (priceTax == 0) {
                        $('.totalBasicCostTR , .activity_enquiry .totalTaxCostTR').hide();
                        $('.GSTI').show().html('GST (Included)');
                    } else {
                        $('.totalBasicCostTR , .activity_enquiry .totalTaxCostTR').show();
                        $('.GSTI').hide().html('');
                    }
                    var priceTaxFormatted, priceBCFormatted, priceGTFormatted = '';
                    priceTaxFormatted = rvMoneyFormatINR(priceTax, 2, null);
                    priceBCFormatted = rvMoneyFormatINR(sumRoomWise, 2, null);
                    priceGTFormatted = rvMoneyFormatINR((priceGT), 2, null);
                    $('.totalBasicCost').html(priceBCFormatted);
                    $('.totalTaxCost').html(priceTaxFormatted);
                    $('.totalGrandCost').html(priceGTFormatted);
                    $('.activity_enquiry .tableCost').show();
                    if (result.url != '') {
                        $('.bookingButtonHtml').html('<a href="' + result.url + '" class="btn btn-success">Continue to pay</a>');
                    }
                    //alert()
                    //                    $('.activity_enquiry').find('input , select ').attr('disabled', 'disabled');
                } else if ((result.status == 'success') && (result.availability == "false")) {
                    $('.smsg').show().html("Thanks! Your enquiry submitted successfully. Soon our expert will contact you.").css({'color': '#5cb85c'});
                    //                    $('.activity_enquiry').find('input , select ').attr('disabled', 'disabled');
                    $('.sending').hide();
                } else if ((result.status == false) && (result.availability == "false")) {
                    $('.smsg').show().html('Sorry, This package is not available on selected date.\n\ But we will revert back with suitable suggestions.').css({'color': '#5cb85c'});
                    //                    $('.activity_enquiry').find('input , select ').attr('disabled', 'disabled');
                    $('.sending').hide();
                } else {
                    $('.smsg').show().html('Sorry, System encountered some error.\n\ We will revert back with suitable suggestions.').css({'color': '#ff0000'});
                    $('.sending').hide();
                }
                $('.activity_enquiry .sending').html('Book Now');
                $('.hidebutton').find('.sending').hide();
            },
            error: function (result) {
                $('.activity_enquiry .smsg').show().html('Sorry, System encountered some error.\n\ We will revert back with suitable suggestions.').css({'color': '#ff0000'});
                $('.activity_enquiry .sending').hide();
            }
        });
    }
});


function vivreadMore(actionId) {
    var styleread = {
        '-webkit-line-clamp': 'inherit',
        'height': 'auto'
    };
    $("#content_" + actionId).removeClass("show_wrap_less");
    $(".readMore_" + actionId).hide();
    $(".readLess_" + actionId).show();
    $(".show_hide111").addClass("showlwssbtn");
    $("#content_overview").css(styleread);
    $("#content_" + actionId).css(styleread);



}
;

function BrowserVal(opt) {
    //alert(opt);
    var ht = {
        '-webkit-line-clamp': '3',
        'height': '70px'
    };
    if (navigator.userAgent.search("MSIE") >= 0) {

    } else if (navigator.userAgent.search("Chrome") >= 0) {
        ht = {
            '-webkit-line-clamp': '3',
            'height': '60px'
        };
    } else if (navigator.userAgent.search("Firefox") >= 0) {
        ht = {
            '-webkit-line-clamp': '3',
            'height': '67px'
        };
    } else if (navigator.userAgent.search("Safari") >= 0 && navigator.userAgent.search("Chrome") < 0) {

    } else if (navigator.userAgent.search("Opera") >= 0) {

    } else {

    }
    if (BrowserVal == 1) {
        return ht;
    } else {
        return ht; //for other conditions
    }
}

function vivreadLess(actionId) {
    var styleread1 = BrowserVal(1);

    $("#content_" + actionId).addClass("show_wrap_less");
    $(".readLess_" + actionId).hide();
    $(".readMore_" + actionId).show();
    $(".show_hide111").removeClass("showlwssbtn");
    $("#content_" + actionId).css(styleread1);


}



function rvMoneyFormatINR(n, prec, currSign) {
    if (prec == null)
        prec = 2;
    var n = ('' + parseFloat(n).toFixed(prec).toString()).split('.');
    var num = n[0];
    var dec = n[1];
    var r, s, t;
    if (num.length > 3) {
        s = num.length % 3;
        if (s) {
            t = num.substring(0, s);
            num = t + num.substring(s).replace(/(\d{3})/g, ",$1");
        } else {
            num = num.substring(s).replace(/(\d{3})/g, ",$1").substring(1);
        }
    }
    //    return(currSign == null ? "" : currSign + "") + num + '.' + dec;
    return (currSign == null ? "" : currSign + "") + num;
}

function openWhatsappWindow(that) {
    var PkgSysId = $(that).attr('PkgSysId');
    var whatsappHtmlHidden = $('#whatsappHtmlHidden' + parseInt(PkgSysId)).val();
    var whatsappnumber = $('#whatsappnumber').val();
    window.open('whatsapp://send?text=' + whatsappHtmlHidden + '&phone=' + whatsappnumber, '_blank');
}

function showfilterCountDiv() {
    $('.filter-box').show();
    $('#filterCountDiv').focus();
}

function rvSanitizeForUrl(str) {
    str = str.replace(/\s\s+/g, ' ').toLowerCase();
    str = str.replace(/#|(|)|,|\/|_|  +/g, '');
    str = str.split(',').join('-');
    str = str.split(' ').join('-');
    return str.replace('--', '-');
}

function changeHotelCategoryAndPrice(catVal, PkgSysId, desid) {

    $('.HotelstabDiv').hide();
    $('.HotelstabDiv' + catVal + PkgSysId).show();
    // alert(desid);
    //    var fixdeparture_destinations = $('.fixdeparture-destinations'+parseInt(PkgSysId)).val();
    //    var TotalPriceWithflight = parseInt($('#TotalPriceWithflight_'+parseInt(PkgSysId)+''+parseInt(fixdeparture_destinations)).val());
    //    if(isNaN(TotalPriceWithflight)){
    //        TotalPriceWithflight = 0;
    //    }

    // var price = $('.getPriceByCategory' + catVal).val() ;
    // var DecimalSeparator = Number("1.2").toLocaleString().substr(1, 1);
    // var AmountWithCommas = price.toLocaleString();
    // var arParts = String(AmountWithCommas).split(DecimalSeparator);
    // var intPart = arParts[0];
    // var decPart = (arParts.length > 1 ? arParts[1] : '');
    // decPart = (decPart + '00').substr(0, 2);

    // if (price != '0') {
    //     $('.changedPrice_' + PkgSysId).html(intPart);
    // } else {
    //     $('.changedPrice').text('Price on request');
    // }

    var priceflight = $('.getPriceByCategoryFlight' + catVal).val();
    //alert(priceflight);
    var DecimalSeparator2 = Number("1.2").toLocaleString().substr(1, 1);
    var AmountWithCommas2 = priceflight.toLocaleString();
    var arParts2 = String(AmountWithCommas2).split(DecimalSeparator2);
    var intPart2 = arParts2[0];
    var decPart2 = (arParts2.length > 1 ? arParts2[1] : '');
    decPart2 = (decPart2 + '00').substr(0, 2);


    if (priceflight != '0') {
        $('.changedPriceFlight_' + PkgSysId).html(intPart2);
    } else {
        $('.changedPriceFlight_').text('Price on request');
    }

    var GetCatPrice = $('.getPriceByCategory' + catVal).val();
    var Changepkgprice_paste2 = parseInt(GetCatPrice) + parseInt(intPart2);
    var monyFormatPrice = new Intl.NumberFormat('en-US').format(Changepkgprice_paste2);
    //alert(Changepkgprice_paste2);
    //alert(catVal);


    $('.changedPrice_' + PkgSysId).html(monyFormatPrice);



    var categoryName = $("#hotelType_" + PkgSysId).val();
    var temp, pType, packageName, gtxid, catid, newurl, tourtype, Countries, mp = '';
    pType = parseInt($('input[name="tType_' + PkgSysId + '"]').val());
    // var categoryId = HOTEL_CATEGORY[catVal];
    // $('.categorySelect_' + PkgSysId).val(categoryId);
    packageName = $('#packagename_' + PkgSysId).val();
    Countries = $('#package_location_' + PkgSysId).val();
    catid = $("#hotelcategoryid_" + PkgSysId).val();
    gtxid = $("#GTX_package_id_" + PkgSysId).val();
    tourtype = $("#tourtype_" + PkgSysId).val();
    mp = $('#mealplantype_' + PkgSysId).val();
    var CategoryWiseTPId = $('#CategoryWiseTPId_' + PkgSysId + catVal).val();

    newurl = SITEURL + 'detail/tour-package-for-' + this.rvSanitizeForUrl(Countries) + '/' + this.rvSanitizeForUrl(packageName) + '-' + PkgSysId + '-' + catid + '-' + gtxid + '-' + tourtype;
    newurl += (mp) ? ("-" + mp) : "";
    newurl += ".html";
    $('.detail_link_' + PkgSysId).attr('href', newurl);
    // $('#hotelcategoryid_' + PkgSysId).val(categoryId);
    $('#packagetpid_' + PkgSysId).val(CategoryWiseTPId);
    $('#hotelType_' + PkgSysId).val(catVal);
}

function changeHotelCategoryAndPriceHotel(catVal, PkgSysId, catId = null) {
    var packageId = PkgSysId;
    var catVal = catVal;
    $(".categorySelect_" + PkgSysId).val(catId);
    var tab = 'Hotelstab';
    var gtxId = $('#gtxpackage_' + packageId).val();
    var desname = $('#citytxtval_' + packageId).val();
    var cname = $('#package_location_' + PkgSysId).val();
    $('#hotelcategoryid_' + packageId).val(catId);
    var tourType = $('#tourtype_' + packageId).val();
    var mp = $('#mealplantype_' + packageId).val();
    var hotel_type = catVal;

    changeContentBytab(cname, desname, packageId, catId, gtxId, tourType, mp, tab, hotel_type);
    changeContentByCategory(cname, desname, packageId, catId, gtxId, tourType, mp);


}

if ($(window).innerWidth() < 992) {
    $(document).ready(function () {
        $('.footer-nav-title').next('.links').css('display', 'none');
        $('.footer-nav-title').click(function () {
            $(this).next('.links').slideToggle();
            $(this).toggleClass('footer-nav-toggle');
        });
    });
}

$(document).ready(function () {
    $(".flight-from-select").select2();
    $(".flight-to-select").select2();
});

Youez - 2016 - github.com/yon3zu
LinuXploit