﻿var objDiv = document.createElement('div');
var objSfondo = document.createElement('div');

function AX_openMess(messaggio) {
    
    if (navigator.appVersion.indexOf("MSIE")!=-1){
        document.documentElement.style.overflow = 'hidden';
    }
    else{
        document.body.style.overflow = 'hidden';
    }

    objDiv.style.visibility = 'visible';
    objDiv.style.display = 'block';
    objDiv.style.position = 'absolute';
    objDiv.style.zIndex = '11';
    objDiv.style.width = '400px'
    objDiv.style.height = '120px'
    objDiv.style.background = '#ffffff';
    objDiv.style.border = '3px #5CA626 solid';
    objDiv.style.padding = '20px 20px 20px 20px';
    
    
    var schermo_x = screen.width;
    var schermo_y = screen.height;

    objSfondo.style.visibility = 'visible';
    objSfondo.style.display = 'block';
    objSfondo.style.position = 'absolute';
    objSfondo.style.background = '#000000';
    objSfondo.style.filter = 'alpha(opacity=60)'
    objSfondo.style.opacity = '.6'
    objSfondo.style.top = '0';
    objSfondo.style.left = '0';
    objSfondo.style.zIndex = '10';
    objSfondo.style.width = schermo_x + "px";
    objSfondo.style.height = schermo_y + "px";
    objSfondo.style.cursor = 'pointer';
    objSfondo.setAttribute("onclick", "AX_closeMess();");
    
    objDiv.style.top = schermo_y / 2 - 200 + "px";
    objDiv.style.left = (schermo_x - 400)/2 + "px";

    var strDesc, strChiudi;
    strDesc = "<p style=\"text-align:center;vertical-align:middle;height:100%;\">" + messaggio + "</p>";
    strChiudi = "<div style=\"text-align:right;padding-bottom:10px;\"><img src=\"/images/popup/closeGreen.jpg\" style=\"cursor:pointer;\" onclick=\"AX_closeMess();\" /></div>";

    //objDiv.innerHTML = strTop + strLato + strChiudi + strDesc + strLato + strBottom;
    objDiv.innerHTML = strChiudi + strDesc;

    if ((navigator.userAgent.search("MSIE") != -1)) {
        //alert("prova");
        document.body.firstChild.appendChild(objSfondo);
        document.body.firstChild.appendChild(objDiv);
    } else {
        document.body.appendChild(objSfondo);
        document.body.appendChild(objDiv);
    }
    

}


function AX_closeMess() {

    if (navigator.appVersion.indexOf("MSIE")!=-1){
        document.documentElement.style.overflow = 'auto';
    }
    else{
        document.body.style.overflow = 'auto';
    }
    
    objSfondo.style.visibility = 'hidden';
    objSfondo.style.display = 'none';
    
    objDiv.style.visibility = 'hidden';
    objDiv.style.display = 'none';
}
