			  $('.counter2').on("click", function(event){
    const buttonType = event.target.innerText.includes("اتصل") ? "call" : "whatsapp";

    $.ajax({
        url: "https://" + window.location.hostname + "/set_counter_hour.php?button_type=" + buttonType + "&_=" + new Date().getTime(),
        type: "get",
        dataType: 'json',
        success: function(result) {
            console.log(result);
        }
    });
});


$(document).ready(function () {
    var callUs = $('.anibtn');
    
    function updateHref() {
        if ($(window).width() > 992) {
            callUs.attr("href", "#last");
        } else {
            callUs.attr("href", "tel:" + phoneNumber);
        }
    }

    updateHref();
    $(window).resize(updateHref);

    $('.counter').on("click", function() {
        $.ajax({
            url: "https://" + window.location.hostname + "/set_counter.php?_=" + new Date().getTime(),
            type: "get",
            dataType: 'json',
            success: function(result) {
                console.log("Counter updated");
            }
        });
    });
});

          
          
      var url = 'https://wati-integration-service.clare.ai/ShopifyWidget/shopifyWidget.js?6262';
var s = document.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = url;

var options = {
    "enabled": true,
    "chatButtonSetting": {
        "backgroundColor": "#4dc247",
        "ctaText": "",
        "borderRadius": "25",
        "marginLeft": "0",
        "marginBottom": "50",
        "marginRight": "50",
        "position": "right"
    },
    "brandSetting": {
        "brandName": "",
        "brandSubTitle": "سيتم الرد بأسرع وقت",
        "brandImg": "https://cdn.clare.ai/wati/images/WATI_logo_square_2.png",
        "welcomeText": "لأي مساعدة الرجاء التحدث الينا",
        "messageText": "السلام عليكم ",
        "backgroundColor": "#0a5f54",
        "ctaText": "ابدأ المحادثة",
        "borderRadius": "25",
        "autoShow": false,
        "phoneNumber": phoneNumber2  // استخدام المتغير هنا
    }
};

s.onload = function() {
    CreateWhatsappChatWidget(options);
};

var x = document.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
