﻿function AX_openPopUp() {
    $("#box_popup").fadeIn("slow");
    $("#box_popup").css({ "position": "absolute", "left": "0", "top": "0", "z-index": "100" });
    $("#sfondoOpaco").css({ "width": $(document).width() + "px", "height": $(window).height() + $(window).scrollTop() + "px", "background-color": "#000000" }).fadeTo("slow", 0.6);
    centerDiv("#text_popup");
    
    return false;
}

function AX_closePopUp() {
    $("#box_popup").fadeOut("slow");
}

function centerDiv(div) {
    var DIVwidth = $(div).width();
    var DIVheight = $(div).height();
    var SCREENwidth = $(document).width();
    var SCREENheight = $(window).height();
    var SCREENscrolltop = $(window).scrollTop();
    $(div).hide();
    $(div).css({ "position": "absolute", "left": (SCREENwidth - DIVwidth) / 2 + "px", "top": (SCREENheight - DIVheight) / 2 + SCREENscrolltop + "px" });
    $(div).show();
}
