var hosturl = $('#hosturl').val();
var lang = $('#lang').val();


$(document).ready(function () {

    $.post(hosturl + '/index/increaseVisitorsno', function () {
    });
    // change lang
    $('#change_lang').click(function (e) {
        e.preventDefault();
        $lang = $(this).attr('data-lang');
        $.post(hosturl + '/index/changelang', {newlang: $lang}, function (rslt) {
            window.location.reload();
        });
    });
    $('.addVisit').on('click', function () {
        var site = $(this).attr('data-site');
        $.post(hosturl + '/index/addVisit', {site: site}, function () {
        });
    });
    /*----------------------------------*/
    $('.subscribePack').on('click', function () {
        $.post(hosturl + '/package/subscribePack', $('#packForm').serialize(), function (data) {
            if (data == 1) {
                $('#packsucessmsg').show();
                setTimeout(function () {
                    $('#packsucessmsg').hide();
                }, 3000);
            } else {
                $('#packerrormsg').show();
                setTimeout(function () {
                    $('#packerrormsg').hide();
                }, 3000);
            }
        });
    });
    $('.orderService').on('click', function () {
        $.post(hosturl + '/services/orderService', $('#serviceForm').serialize(), function (data) {
            if (data == 1) {
                $('#servicesucessmsg').show();
                setTimeout(function () {
                    $('#servicesucessmsg').hide();
                }, 3000);
            } else {
                $('#serviceerrormsg').show();
                setTimeout(function () {
                    $('#serviceerrormsg').hide();
                }, 3000);
            }
        });
    });
    $('.single-price').on('click', function () {
        $("#packId").val($(this).attr('data-id'));
    });
    $('.single-service').on('click', function () {
        $("#serviceId").val($(this).attr('data-id'));
    });
    /*----------------------------------*/


    /*$('#regionid').on('change', function () {
     var id = $(this).val();

     $.post(hosturl + '/branch/getCity', {id: id}, function (data) {
     $('#cityid').html(data);
     });

     $.post(hosturl + '/branch/getBranch', {regionid: id}, function (res) {
     $('#branchDiv').html(res);
     });
     });

     $('#cityid').on('change', function () {
     var id = $(this).val();
     if (id)
     {
     $.post(hosturl + '/branch/getBranch', {cityid: id}, function (res) {
     $('#branchDiv').html(res);
     });
     }
     });*/




});

