function checkKey(e) {
    switch (e.keyCode) {
        case 27:
            hideMessageBox()
            break;
    }
}

function hideMessageBox() {
    $("#messageBox").hide();
    $("#messageBoxInside").hide();
}

function showMessageBox(tip, redirect, mesaj, titlu) {
    if (tip == 1) {
        //afiseaza doar mesajul dorit.
        //<button class="buttonOK" onclick="hideMessageBox()"><strong>OK</strong></button>
        $("#messageBoxButtons").html('<button class="buttonOK" onclick="hideMessageBox()"><strong>OK</strong></button>');
    }
    else if (tip == 2) {
        //afiseaza mesajul + redirectare formular
        $("#messageBoxButtons").html(redirect);
    }
    
    $("#messageBox").css("top", ($(window).height() - 200) / 2 + $(window).scrollTop() + "px");
    $("#messageBox").css("left", ($(window).width() - 600) / 2 + $(window).scrollLeft() + "px");
    $("#messageBoxInside").css("top", ($(window).height() - 190) / 2 + $(window).scrollTop() + "px");
    $("#messageBoxInside").css("left", ($(window).width() - 590) / 2 + $(window).scrollLeft() + "px");
    $("#messageBoxTitle").text(titlu);
    $("#messageBoxDiv").html(mesaj);
    $("#messageBox").show();
    $("#messageBoxInside").show();
}

function hideContentBox() {
    $("#contentBox").hide();
    $("#contentBoxInside").hide();
}

function showContentBox(redirect, mesaj, titlu) {
    $("#contentBoxButtons").html(redirect);
    $("#contentBox").css("top", ($(window).height() - 300) / 2 + $(window).scrollTop() + "px");
    $("#contentBox").css("left", ($(window).width() - 600) / 2 + $(window).scrollLeft() + "px");
    $("#contentBoxInside").css("top", ($(window).height() - 290) / 2 + $(window).scrollTop() + "px");
    $("#contentBoxInside").css("left", ($(window).width() - 590) / 2 + $(window).scrollLeft() + "px");
    $("#contentBoxTitle").text(titlu);
    $("#contentBoxDiv").html(mesaj);
    $("#contentBox").show();
    $("#contentBoxInside").show();
}
