    var language_site=$.cookie('site_lang', true);
    var currency_name;
    var your_order;
    var sub_total_name;
    var discount_name;
    var vat_name;
    var total_name;  
    var delivery_fee_name;
    var delivery_fess_title;
    var addition_title;
    var remove_title;
    var drink_title;
    var potato_title;
    var sizes_title;
    var bread_title;
    var size_title;  
    if(language_site=="ar"){
        currency_name="د.ب";
        your_order="طلبك ";
        sub_total_name="المجموع";
        discount_name="الخصم";
        vat_name="الضريبة";
        total_name="الأجمالي";
        delivery_fee_name="رسوم التوصيل ";
        order_summary="ملخص الطلب ";
        checkout="أستمرار ";
        delivery_fess_title="تم اضافة رسوم توصيل   ";
        addition_title="الأضافات ";
        remove_title="الأزالات ";
        drink_title="أختر مشروبك المفضل ";
        potato_title="أختر نوع البطاطس المفضل لديك ";
        sizes_title="أختر حجمك المفضل  ";
        bread_title="أختر نوع الخبز";
        size_title="الأحجام ";
        delivery_fee_title =" سوف يتم أضافة رسوم توصيل لـ ";
                    
      
    }else{
        currency_name="BHD";
        your_order="Your Order";
        sub_total_name="Sub Total";
        discount_name="Discount";
        vat_name="VAT";
        total_name="Total";  
        delivery_fee_name="delivery fee";
        checkout="Checkout";
        delivery_fess_title="Deliver Fees Added Check Your Order Summery";
        addition_title="Additions";
        remove_title="Removes";
        drink_title="Your Choice Of Drinks";
        potato_title="Your Choice Of Potato";
        sizes_title="Select Your Size ";
            bread_title="Your choice of bread";
            size_title="Sizes";
               delivery_fee_title=" Will Be Added As A Delivery Charge To ";
        
      
    }
    
    

    $(function () {
        $('.lazy').Lazy({
            effect: 'fadeIn',
            visibleOnly: true
        });
    });

    $(window).bind("load", function () {
        setTimeout(function () {
            $('.progress-page-load').fadeOut(100);
        }, 200);
    });
    
    $(function () {
        var radio_value = $('input:radio[name="order_type"]').val();
        if (radio_value == "TakeAway") {
            //hide all address info
            $('#customRadioInline22').prop('checked', true);
            $('.deliver_order').hide();
            $(".option_require").removeAttr("required");
            

        } else if (radio_value == "Delivery") {
            //show all address info
            $('#customRadioInline11').prop('checked', true);
            $('.deliver_order').show();
            //$(".option_require").setAttribute("required", "required");
            $('.option_require').attr('required', true);

        } else if (radio_value == "InRestaurant") {
            //show all address info
            $('#customRadioInline33').prop('checked', true);
            $('.deliver_order').hide();
            $(".option_require").removeAttr("required");

        }
    });
    
    $(function() { $('input:radio[name="order_type"]').change(function() {
          var radio_value=$(this).val();
          if(radio_value=="TakeAway"){
              //hide all address info 
              $('.deliver_order').hide();
              $(".option_require").removeAttr("required");

        } else if (radio_value == "Delivery") {
              //show all address info 
              $('.deliver_order').show();
            //$(".option_require").setAttribute("required", "required");
              $('.option_require').attr('required', true);

        } else if (radio_value == "InRestaurant") {
              //show all address info 
              $('.deliver_order').hide();
              $(".option_require").removeAttr("required");

          }    
         
         
     });
    });

    function OrderForm() {
        $(document).ready(function () {
            $('[data-dismiss="modal"]').off('click');
            $('[data-dismiss="modal"]').on('click', function () {
                $('#order-now').modal('hide');
            });
            
            
            
            // var discount_percentage=$("#discount_percentage").val();
            // console.log(discount_percentage);
            // if(discount_percentage != 0 ){
            //     alert("We Have " + discount_percentage + " % Discount");
            // }
            $('#region_id').off('change');
            $('#region_id').on('change', function () {

                var region_id = $('#region_id').val();
                $.ajax({
                    url: "ajax/region_data.php",
                    type: "POST",
                    data: {region_id: region_id},
                    success: function (data)
                    {
                        var json = $.parseJSON(data);
                        var charge_cost = parseFloat(json['charge']);
                        var min_order = json['min_order'];
                        var old_min = $('#delivery-fee').text().split(' ')[0];

                        $('#delivery-fee').html('').text(charge_cost.toFixed(3) + ' ' + currency_name);
                        $('#cart-total-span').text();

                        var total_sum = $('#cart-total-span').text().split(' ')[0];
                        total_sum = parseFloat(total_sum);
                        total_sum += parseFloat(charge_cost) - parseFloat(old_min);
                        total_sum = total_sum.toFixed(3);
                        $('#cart-total-span').html('').text(total_sum + ' '+ currency_name );
                        var region_name=json['region_name_en'];
                        console.log(region_name);
                        alert(charge_cost.toFixed(3) + delivery_fee_title + region_name );
                    
                        
                        
                    }
                });

            });

            $('.set-price .plus').off('click');
            $('.set-price .plus').on('click', function () {
                var $index = $('.set-price .plus').index(this);
                var $val = Number($('.set-price input').eq($index).val());
                $val = ($val + 1);
                $('.set-price input').eq($index).val($val);
                $('.set-price input').change();
            });



            $('.set-price .minus').off('click');
            $('.set-price .minus').on('click', function () {
                var $index = $('.set-price .minus').index(this);
                var $val = Number($('.set-price input').eq($index).val());
                $val = ($val - 1);
                if ($val >= 1) {
                    $('.set-price input').eq($index).val($val);
                }
                $('.set-price input').change();
            });

            $('.set-price input').off('change');
            $('.set-price input').on('change', function () {
                var $index = $('.set-price input').index(this);
                var $val = Number($('.set-price input').eq($index).val());
                var $price = Number($('div[data-price]').eq($index).attr('data-price'));
                var $total=$price * $val;
                $total=Number($total).toFixed(3);
                
                $price = (new Intl.NumberFormat('en-IN', {maximumSignificantDigits: 3}).format($total));
               $price=Number($price).toFixed(3);
                console.log($price);
                $('.set-price [data-price]').eq($index).text(currency_name + ' ' + $price);
            });
            
            $('.cart-item .remove-item').off('click');
            $('.cart-item .remove-item').on('click', function () {
                var $index = $('.cart-item .remove-item').index(this);
                $('.cart-item').eq($index).slideUp(250, () => {
                    var cart_id = $('.cart-item .remove-item').eq($index).attr('data-id');
                    $('.cart-item').eq($index).remove();
                    removeItemFromOrder(cart_id);
                });
            });
            $('.branches > .row.w-100').hide(0);
            $('.branches > .row.w-100').eq(0).show(0);
            $('[select-target="true"]').off('click');
            $('[select-target="true"]').on('click', function () {
                $('.bg-area').addClass('pin-bg-area');
                var $index = $('[select-target="true"]').index(this);
                var $id = $('[select-target="true"]').eq($index).attr('href');
                $('.nav-link').removeClass('active');
                $('.nav-link').eq($index).addClass('active');
                $('.branches > .row.w-100').hide(0);
                $('#navbarNav').collapse('toggle');
                $($id).show(0);
                $('.nav-scroller .nav').animate({
                    scrollLeft: ($('[select-target]').eq($index).position().left)
                }, 1000);
                $('body,html').animate({
                    scrollTop: ($($id).position().top - (($('.top-header').height() + 65) + 30))
                }, 1000);
                event.preventDefault();
            });
        });
    }
    $(document).ready(function () {
        var $_list_of_elements = $('*'),
                $_count_of_elements = ($_list_of_elements.length > 0 ? ($_list_of_elements.length - 1) : $_list_of_elements.length);
        $_list_of_elements.each(function (element_index) {
            if ($(element_index).on('ready')) {
                if (element_index <= $_count_of_elements) {
                    setTimeout(function () {
                        $_percentage = Math.ceil(element_index * 100 / $_count_of_elements);
                        $(".progress-page-load .progress-bar").css("width", $_percentage + "%");
                        $(".progress-page-load .progress-bar").attr("aria-valuenow", $_percentage);
                    }, 100);
                }
            }
        });
        if ($('[data-toggle="tooltip"]').length > 0) {
            $('[data-toggle="tooltip"]').tooltip();
        }

        OrderForm();

        $(window).on('scroll', function () {
            if ($(window).scrollTop() > 80) {
                $('.bg-area').addClass('pin-bg-area');
            } else {
                $('.bg-area').removeClass('pin-bg-area');
            }

            if ($(window).scrollTop() > 195) {
                $('body').css({'padding-top': '113px'});
                $('.navbar-area').addClass('pin-top');
            } else {
                $('body').css({'padding-top': '60px'});
                $('.navbar-area').removeClass('pin-top');
            }
            var $_position = $('.nav-link.active').position();
            if ((typeof $_position) == 'object') {
                $('.nav-scroller .nav').stop();
                $('.nav-scroller .nav').animate({
                    scrollLeft: ($('.nav-link.active').position().left)
                }, 1000);

            }
            var _elements_top = [];
            $('[id^="cat-"]').each(function (_index) {
                $('.nav-link').removeClass('active');
                if ($('[id^="cat-"]').eq(_index).position().top >= ($(window).scrollTop())) {
                    _elements_top.push(_index);
                    $('.nav-link').eq(_elements_top[0]).addClass('active');

                }
            });




        });
        $('.side-bar .close').on('click', function () {
            $('.side-bar').addClass('hide');
        });
        $('.show-side-bar').on('click', function () {
            $('.side-bar').removeClass('hide');
        });








        $('.ChangeLang').on('click', function () {

            if ($.cookie('site_lang', true) == 'ar') {
                $.cookie({'site_lang': 'en'}, false);
            } else {
                $.cookie({'site_lang': 'ar'}, false);
            }

            window.location.reload();
            return true;

        });




    });
    function getCheckedBoxes(chkboxName) {
        var checkboxes = document.getElementsByName(chkboxName);
        var checkboxesChecked = '';
        // loop over them all
        for (var i = 0; i < checkboxes.length; i++) {
            // And stick the checked ones onto an array...
            if (checkboxes[i].checked) {
                checkboxesChecked += checkboxes[i].getAttribute('data') + ',';
            }
        }
        // Return the array if it is non-empty, or null
        return checkboxesChecked ? checkboxesChecked : null;
    }

    function addItemToOrder() {
        var sub_id = $('#add_item_to_order').val();
        var notes = $('#sub-cat-notes-value').val();
        var price = $('#sub-cat-price').attr('data-price');
        var quantity = $('#sub-cat-quanity').val();
        var additions = getCheckedBoxes("addition_checkBox");
        var removes = getCheckedBoxes("customRadio");
        var size =getCheckedBoxes("sub_sizes");
        console.log(size);
        $.ajax({
            url: "ajax/add_item_to_order.php",
            type: "POST",
            data: {sub_id: sub_id, notes: notes, price: price, quantity: quantity, additions: additions, removes: removes ,size: size},
            success: function (data)
            {
                console.log("addItem");
                console.log(data);    
                $('#cart-item-count').html('').text(data);
                $('.cart-count2').text(data);

            }
        });

    }
    function removeItemFromOrder(cart_id) {
        $.ajax({
            url: "ajax/remove_item_from_order.php",
            type: "POST",
            data: {cart_id: cart_id},
            success: function (data)
            {
                showModalCartDetials();
                getCartCountStart();

                var loc = location.href;
                var pieces = loc.split("/");
                var current_path = pieces[pieces.length - 1];
                if (current_path == "checkout_continue.php" || current_path == "checkout_confirm.php") {
                    location.reload();
                }

            }
        });

    }

    function getCartCountStart() {
        $.ajax({
            url: "ajax/cart_count.php",
            type: "POST",
            data: {},
            success: function (data)
            {
                $('#cart-item-count').html('').text(data);
                $('.cart-count2').text(data);

            }
        });
    }
//get Count of Cart items At  Start
    getCartCountStart();

    function showModal(sub_id) {
        $.ajax({
            url: "ajax/sub_cat.php",
            type: "POST",
            data: {sub_id: sub_id},
            success: function (data)
            {
                var json = $.parseJSON(data);
                var price = Number(json['sub_category_price']).toFixed(3);
                var name = json['sub_category_name'];
                var desc = json['sub_category_desc'];
                var image = "./TimThumb-master/timthumb.php?src="+ json['sub_category_image'] + "&w=500&h=500" ;
                var additions = json['additions'];
                var removes = json['removes'];
                var sizes = json['sizes'];
                console.log(sizes);

                $('#add_item_to_order').val(sub_id);

                $("#order-nowModalLabel").html('').text(name);
                $("#sub-cat-title").html('').text(name);
                $("#sub-cat-desc").html('').text(desc);

                //change image src and Alt
                $('#sub-image-modal').attr('src', image);
                $('#sub-image-modal').attr('alt', name);

                //change price value
                $("#sub-cat-price").html('').text(currency_name+ ' ' + price);
                $('#sub-cat-price').attr('data-price', price);
                //change Sub-Cat Quantity and Notes
                $('#sub-cat-quanity').val(1);
                $('#sub-cat-notes-value').val(' ');

                //draw additions
                $("#additions").html('');
                var additions_length = additions.length;
                if (additions_length) {
                    var additions_html = '';
                    additions_html += '<h5> Additions </h5>';
                    var i = 0;
                    additions.forEach((row) => {
                        var name = row.sub_category_addition_name;
                        var price = row.sub_category_addition_price;
                        additions_html += ' <div class="custom-control custom-checkbox my-1"><input name="addition_checkBox" data="' + name + '" onclick="sizeChecked()" value="' + price + '" type="checkbox" class="custom-control-input" id="customCheck' + i + '"><label class="custom-control-label" for="customCheck' + i + '">' + name + '+ ' + price + ' '+ currency_name  + '</label></div>';
                        i++;
                    });
                    $("#additions").html(additions_html);
                }
                //draw removes
                $("#removes").html('');
                var removes_length = removes.length;
                if (removes_length) {
                    var remove_html = '';
                    remove_html += '<h5> Removes </h5>';
                    var i = 0;
                    removes.forEach((row) => {
                        var title = row.title;
                        remove_html += ' <div class="custom-control custom-checkbox my-1"><input name="customRadio" data="' + title + '" onclick="" value="" type="checkbox" class="custom-control-input" id="customCheckRemoves' + i + '"><label class="custom-control-label" for="customCheckRemoves' + i + '">' + title + '</label></div>';
                        i++;
                    });
                    remove_html+='<hr class="w-100 d-block">';
                    $("#removes").html(remove_html);
                }
                
                //draw removes
                $("#sizes").html('');
                var size_length = sizes.length;
                if (size_length) {
                    var size_html = '';
                    size_html += '<h5> ' + size_title + ' </h5>';
                    var i = 0;
                    sizes.forEach((row) => {
                        var size_id=row.sub_category_size_price_id;
                        var name = row.sub_category_size_name;
                        var price = Number(row.sub_category_size_price).toFixed(3);
                        var checked_size="";
                        if(i==0){var checked_size="checked";}
                        size_html += ' <div class="custom-control custom-checkbox my-1"><input ' + checked_size + ' name="sub_sizes" data="' + size_id + '" onclick="sizeChecked()" value="' + price + '" type="radio" class="custom-control-input" id="sub_sizes' + i + '"><label class="custom-control-label" for="sub_sizes' + i + '">' + name + '+ ' + price + ' ' + currency_name + '</label></div>';
                        i++;
                    });
                    
                    $("#sizes").html(size_html);
                }
                
                
                

                $('#order-now').modal('show');
            }
        });


    }

    function showModalCartDetials() {
        $.ajax({
            url: "ajax/cart_detials.php",
            type: "POST",
            data: {},
            success: function (data)
            {
                var data = $.parseJSON(data);
                var json = data['data'];
                var discount = data['discount'];
                var vat = data['vat'];
                var accept_order=data['accept_order'];
                
               
               $('#cart-detials-body').html('').text('');
                var draw_div = '';
                var sum_total = 0;
                json.forEach((item) => {
                    var id = item.cart_id;
                    var sub_catgeory_id = item.sub_catgeory_id;
                    var sub_category_name = item.sub_category_name;
                    var sub_category_image = "./TimThumb-master/timthumb.php?src="+ item.sub_category_image  ;
                    var price = item.price;
                    var notes = item.note;
                    var removes = item.remove_id;
                    var additions = item.addition_id;
                    var quantity = item.quantity;
                    var status = item.status;
                    var user_id = item.user_id;
                    var date_added = item.date_added;
                    var total_price = Number(item.price).toFixed(3);
                    sum_total += parseFloat(total_price);
                    //  console.log(sub_category_image);
                    draw_div += '<div class="row cart-item mb-4"><div class="col-8 p-0"><h5 class="d-flex"><img class="img-fluid col-6 h-100 px-2" src="' + sub_category_image + '"/>' + quantity + 'x ' + sub_category_name + '</h5><p class="text-secondary">' + additions + removes + notes + '</p></div><div class="col-4 p-0 text-right"><span class="total-price d-block">' + total_price + ' '+ currency_name + ' </span><a class="remove-item size12 cursor d-inline-block mt-3" data-id="' + id + '" data-icon="&#xe912"></a></div></div>';
                });

                sum_total = sum_total.toFixed(3);
                var discount_value = parseFloat(sum_total) * ((discount / 100).toFixed(3));
                discount_value=discount_value.toFixed(3);
                var total = sum_total  - discount_value;

                var vat_value = parseFloat(total) * parseFloat((vat / 100));
                vat_value=vat_value.toFixed(3)
                var net_value =(parseFloat(vat_value) + parseFloat(total)) .toFixed(3);
              
              
              
                if (sum_total > 0 & accept_order==1 ) {
                    
                    
                    draw_div += '<div class="row cart-total"><div class="col-8 p-0"><h5>' + sub_total_name +'</h5></div><div class="col-4 p-0 text-right"><span class="total-price d-block">' + sum_total + ' ' +currency_name + ' </span></div></div>';
                    if(discount > 0 ){
                       draw_div += '<div class="row cart-total"><div class="col-8 p-0"><h5>' + discount_name +'(' + discount + '%)</h5></div><div class="col-4 p-0 text-right"><span class="total-price d-block">' + discount_value +  ' ' +currency_name + ' </span></div></div>';
                    }
                    draw_div += '<div class="row cart-total"><div class="col-8 p-0"><h5>' + vat_name +'(' + vat + '%)</h5></div><div class="col-4 p-0 text-right"><span class="total-price d-block">' + vat_value +   ' ' +currency_name + ' </span></div></div>';
                    
                    draw_div += '<div class="row cart-total"><div class="col-8 p-0"><h5>' + total_name +'</h5></div><div class="col-4 p-0 text-right"><span class="total-price d-block">' + net_value +   ' ' +currency_name + ' </span></div><div class="col-12 px-0 pt-4"><a href="checkout_continue.php" class="btn btn-danger btn-block">' + checkout + '</a></div></div>';
            
                }else if(accept_order==0){
                    draw_div += '<h3>The Restutant Is Closed Now, We Will Back Soon ! </h3>';
                }else if(sum_total==0){
                      
                    draw_div += '<h3>No items Added </h3>';
                  
                }
                
                $('#cart-detials-body').html(draw_div);
                OrderForm();
            }
        });
        $('#Cart').modal('show');

    }
    function additionChecked() {
        var input_val = parseFloat(event.target.value);
        var price_item = $('#sub-cat-price').attr('data-price');
        var quanity = $('#sub-cat-quanity').val();
        var checked = event.target.checked;

        if (checked) {
            var total_one = parseFloat(price_item) + parseFloat(input_val);
            var total_all = parseFloat(quanity) * parseFloat(total_one);

        } else {
            var total_one = parseFloat(price_item) - parseFloat(input_val);
            var total_all = parseFloat(quanity) * parseFloat(total_one);
        }
        total_one = total_one.toFixed(3);
        total_all = total_all.toFixed(3);
        $("#sub-cat-price").html('').text(currency_name +' ' + total_all);
        $('#sub-cat-price').attr('data-price', total_one);
    }
    
    function sizeChecked(){
        
        var input_val = parseFloat(event.target.value);
        var price_item = $('#sub-cat-price').attr('data-price');
        var quanity = $('#sub-cat-quanity').val();
        var checked = event.target.checked;
        console.log(input_val);

        if (checked) {
            var total_one =  parseFloat(input_val);
            var total_all = parseFloat(quanity) * parseFloat(total_one);

        } else {
            var total_one = parseFloat(price_item) - parseFloat(input_val);
            var total_all = parseFloat(quanity) * parseFloat(total_one);
        }
        total_one = total_one.toFixed(3);
        total_all = total_all.toFixed(3);
        $("#sub-cat-price").html('').text( currency_name + ' ' + total_all);
        $('#sub-cat-price').attr('data-price', total_one);
    }
    
    function check_order_payment(min_order) {
        // alert(min_order)
        var payment = $("input[name='payment']:checked").val();
        console.log(min_order);
        switch (payment) {
            case "1":
                finish_order_confirm(min_order);
                break;
            case "2":
                finish_order_confirm_debit(min_order);
                break;
            case "3":
                finish_order_confirm_credit(min_order);
                break;
            default:
                finish_order_confirm_debit(min_order);
                break;
        }
    }
    function finish_order_confirm_debit(min_order) {
        //check if total if order > or equal of the min region charge
        min_order = Number(min_order).toFixed(3);
        var payment = $("input[name='payment']:checked").val();
        var set_client_id = $("#set_client_id").val();
        var client_address_id = $("#client_address_id").val();
        var all_cart_ids = $("#all_cart_ids").val();
        var site_url = $("#site_url").val();
        
        $.ajax({
            url: "ajax/check_minimun_order.php",
            type: "POST",
            data: {min_order: min_order},
            success: function (data)
            {
                if (data != 0) {
                    var send_data = 'set_client_id=' + set_client_id + "&set_client_address_id=" + client_address_id + '&cart_id=' + all_cart_ids + '&set_payment=debit';
                    $.ajax({
                        type: "POST",
                        url: "ajax/open_sessions.php",
                        data: send_data,
                        dataType: 'json',
                        cache: false,
                        success: function (result) {
                            if (result.success == "1") {
                                var link = site_url + "debit/init.php?amount=" + result.order_price + '&type=debit&client_address_id='+client_address_id+'&client_id='+set_client_id;
                                document.location.href = link;
                            }
                        }
                    });
                } else {
                    var region_name = " ";
                    alert("Sorry, The miminum order for Selected" + region_name + "  region is " + min_order + ' ' +"BD" );
                }

            }
        });


    }

    function finish_order_confirm_credit(min_order) {
        //check if total if order > or equal of the min region charge
        min_order = Number(min_order).toFixed(3);
        var payment = $("input[name='payment']:checked").val();
        var set_client_id = $("#set_client_id").val();
        var client_address_id = $("#client_address_id").val();
        var all_cart_ids = $("#all_cart_ids").val();
        var site_url = $("#site_url").val();
        var ran = Math.random(); // returns a random number
        console.log(min_order);
        $.ajax({
            url: "ajax/check_minimun_order.php",
            type: "POST",
            data: {min_order: min_order},
            success: function (data)
            {
                if (data != 0) {
                    var send_data = 'set_client_id=' + set_client_id + "&set_client_address_id=" + client_address_id + '&cart_id=' + all_cart_ids + '&set_payment=credit';
                    $.ajax({
                        type: "POST",
                        url: "ajax/open_sessions.php",
                        data: send_data,
                        dataType: 'json',
                        cache: false,
                        success: function (result) {
                            if (result.success == "1") {
                                var link = site_url + "credit/init.php?client_id=" + set_client_id + "&amount=" + result.order_price + "&orderID=" + ran + '&type=credit&client_address_id='+client_address_id+'&client_id='+set_client_id;
                                document.location.href = link;
                            }
                        }
                    });
                } else {
                    var region_name = " ";
                    alert("Sorry, The miminum order for Selected" + region_name + "  region is " + min_order + ' '+"BD" );
                }

            }
        });

    }

    function finish_order_confirm(min_order) {
        //check if total if order > or equal of the min region charge
        min_order = Number(min_order).toFixed(3);
        var payemnt_value=$("input[name='payment']:checked").val();
       
        var region_name=$('#region_name_selected').val();
        $.ajax({
            url: "ajax/finish_order.php",
            type: "POST",
            data: {min_order: min_order, payemnt_value: payemnt_value},
            success: function (data)
            {   
                console.log("returned value ");
                console.log(data);
                if (data != 0) {
                    getCartCountStart();
                    if(data){
                        if(language_site=="ar"){
                            message_confirm_order="طلبك في مرحلة التجهيز , شكر لك , سوف يتم توصيل الطلب في أقرب وقت ";
                        }else{
                              message_confirm_order="Your Order In Preparation, Thanks ,We Will deliver Your Order As soon as Possible  ";
                        }
                        
                        $('#checkout-confirm-finish').html('<h3>' + message_confirm_order  + '</h3> <h2> Order Number #' + data + '</h2>');
                        setInterval('window.location.reload()', 6000);
                        console.log("order Finished Successfully");
                    } else {
                        console.log("order Finished Withe Error");
                        $('#checkout-confirm-finish').empty().html('');
                    }
                } else {
                    alert("Sorry !! , The miminum order for  " + region_name + "  region is " + min_order + " " + "BD" );
                }

            }
        });


    }





function getRegionDataCurrentOrder(){
    $.ajax({
            url: "ajax/region_data_current_order.php",
            type: "POST",
            data: {getRegionData:1},
            success: function (data)
            {   
               var json = $.parseJSON(data);
               return data;
               
            }
        });
    
    
}


$(document).ready(function() {
$("#hideSearch").on('click', function () {

$("#showSearchDiv").hide();

$("#showLogoDiv").show();

});




$("#showSearch").on('click', function () {

$("#showLogoDiv").hide();

$("#showSearchDiv").show();


});

});