$(document).ready(function() {


    $(document).on({
        click: function() {
            event.preventDefault();
            if ($(this).data('ser')) {
                var dataStr = 'infoNo=' + $(this).data('ser');
                $.ajax({
                    url: "/tpl/php/modal_info.php",
                    type: 'post',
                    data: dataStr,
                    dataType: 'html',
                    success: function(responseHtml) {

                        $('#info-modal').find('.modal-inner').html(responseHtml);
                        $('#info-modal').modal('show');
                    },
                    error: function(request) {
                        console.log(request.responseText);
                    }
                });

            }

        }
    }, '.fnmodal, .modal-link');

    $("#gotop").click(function() {
        $("html,body").animate({
            scrollTop: 0
        }, 1000);
    });


    if ($('.stay-visible').length) {
        $('.stay-visible').each(function(idx, elem) {
            $(elem).stayVisible();
        });
    }




    $(window).scroll(function() {
        if ($(this).scrollTop() > 300) {
            $('#gotop').fadeIn("fast");
        } else {
            $('#gotop').stop().fadeOut("fast");
        }

        if ($('.stay-visible').length) {
            $('.stay-visible').each(function(idx, elem) {
                $(elem).stayVisible();
            });
        }


    });

    $(window).resize(function() {
        if ($('.stay-visible').length) {
            $('.stay-visible').each(function(idx, elem) {
                $(elem).stayVisible();
            });
        }
    });




    $(window).trigger('resize');


    if ($('#pagearea').length) {
        $(".about-service .icon-col").click(function() {
            $(this).toggleClass("active")
        });
    }




}); //document.ready

function setCookie(key, value, minutes) {
    var expires = new Date();
    expires.setTime(expires.getTime() + (minutes * 60 * 1000));
    document.cookie = key + '=' + value + ';expires=' + expires.toUTCString() + ';path=/';
}

function getCookie(key) {
    var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)');
    return keyValue ? keyValue[2] : null;
}

function delCookie(name) {
    createCookie(name, "", -1);
}