$(document).ready(function () {

    $('.gallery-container').magnificPopup({
        delegate: 'img',
        type: 'image',
        fixedContentPos: true,
        callbacks: {
            elementParse: function (qw) {
                qw.src = qw.el.attr('src');
            }
        }
    });

    $('.highlights-container').magnificPopup({
        delegate: 'img',
        type: 'image',
        gallery: {
            enabled: true
        },
        callbacks: {
            elementParse: function (qw) {
                qw.src = qw.el.attr('src');
            }
        }
    });

});

var KTAvatar1 = function () {
    return {
        init: function () {
            new KTAvatar("kt-avatar")
        }
    };
}();

function IsNullOrWhiteSpace(value) {
    return value === null || value.match(/^\s*$/) !== null;
}

function IsValidEmail(value) {
    var pattern = /^\b[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}\b$/i;
    return pattern.test(value);
}

function IsValidString(value) {
    var pattern = /[A-Za-z0-9!#$%&'*+-/=?_`().]+$/;
    return pattern.test(value);
}

function numberOnly(e) {
    e = (e) ? e : window.event;
    var charCode = (e.which) ? e.which : e.keyCode;
    if (charCode > 31 && (charCode < 48 || charCode > 57 || charCode === 46)) {
        e.preventDefault();
    }
    else {
        return true;
    }
}

$('.my-card-container .floater').on('click', function (e) {
    $('.my-card-container .floater').toggleClass('is-active');
    e.stopPropagation();

    if ($(".my-card-container .floater").hasClass("is-active")) {
        $(".my-card-container .floater__list").css("bottom", "11rem");
    }
    else {
        $(".my-card-container .floater__list").css("bottom", "1000rem");
    }
});

$('.my-card-container').on('click', function () {
    $('.my-card-container .floater').removeClass('is-active');
    $(".my-card-container .floater__list").css("bottom", "1000rem");
});

//$('.my-card-container .highlights-container').owlCarousel({
//    center: true,
//    items: 1,
//    loop: true,
//});

$('.my-card-container .testimonials-container').owlCarousel({
    center: true,
    items: 1,
    loop: true,
    autoplay: true,
    autoplayTimeout: 5000,
    autoplayHoverPause: true
});

function copyLink(link) {
    var input = document.createElement('input');
    input.setAttribute('value', link);
    document.body.appendChild(input);
    input.select();
    var result = document.execCommand('copy');
    document.body.removeChild(input);

    $(".copied-text").removeClass("display-none");

    setTimeout(function () {
        $(".copied-text").addClass("display-none");
    }, 1500);

    return result;
}

function shareViaWhatsApp() {
    var whatsAppNumber = $("#whatsAppNumber").val();
    if (whatsAppNumber === null || whatsAppNumber === "91" || whatsAppNumber.match(/^\s*$/) !== null || whatsAppNumber.match(/^91\s*$/) !== null) {
        //no action to be taken
    }
    else {
        var shareViaWhatsAppLink = $("#shareViaWhatsAppLink");
        shareViaWhatsAppLink.attr("href", shareViaWhatsAppLink.attr("href") + whatsAppNumber);
        shareViaWhatsAppLink[0].click();
    }
}