var hostWebSite = "";
var locHost = location.host;
if (locHost.indexOf('localhost') > -1) {
    hostWebSite = "http://localhost/www.aetalia.com";
} else {
    hostWebSite = "https://" + location.host;
}

$(document).ready(function () {
    // SOLO NUMERI
    $("body").delegate(".onlyNumber", "keypress", function (e) {
        if (e.which == 8 || e.which == 48 || e.which == 49 || e.which == 50 || e.which == 51 || e.which == 52 || e.which == 53 || e.which == 54 || e.which == 55 || e.which == 56 || e.which == 57) {
        } else {
            return false;
        }
    });
});



function getRandomInt(min, max) {
    return Math.floor(Math.random() * (max - min + 1)) + min;
}

function valid_email(email) {
    var pattern = new RegExp(/^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]+$/);
    return pattern.test(email);
}


function OpenSuccessBottonLoader($box) {
    var textLabel = $box.attr("data-label");
    var textSuccess = $box.attr("data-label-success");
    $box.html("<i class=\"icon-spin5\"></i> " + textSuccess);

    $box.closest("form").find("input").val("");
    $box.closest("form").find("input").removeClass("error");
}
function OpenWaitBottonLoader($box) {
    var textLabel = $box.attr("data-label");
    var textWait = $box.attr("data-label-wait");
    $box.attr("disabled", "disabled")
    $box.addClass("disabled")
    $box.attr("aria-current", "page");
    $box.html("<i class=\"icon-spin5\"></i> " + textWait);
}
function CloseWaitBottonLoader($box) {
    var textLabel = $box.attr("data-label");
    var textWait = $box.attr("data-label-wait");
    $box.removeAttr("disabled")
    $box.removeClass("disabled")
    $box.removeAttr("aria-current")
    $box.html(textLabel);
}