// Takes in a JSON result and displays it as a status message for the AJAX event that called it
function processAjaxMessage(data) {
    $("#status_message").remove();
    $("body").append('<div id="status_message"><div class="status_' + data['status'] + '"><p style="float: right;margin: -1em -1em 0 0;text-align: right;"><a href="javascript:$(\'#status_message\').remove()">Close</a></p>' + data['message'] + '</div></div>');
    
    if(data['status'] != "error")
        setTimeout(function(){$("#status_message").fadeOut(1500)}, 1500);
}

function hideNProcess(data) {
    hideOverlay();
    processAjaxMessage(data);
}

function displayOverlayMessage(message, styling) {
    message = '<img id="overlay_close" src="/assets/img/closex.png" alt="x" onclick="hideOverlay()" />' + message;
    $("body").append('<div id="overlay"></div><div id="overlay_msg"><div id="overlay_msg_contents" class="adjust_font" style="' + styling + '">' + message + '</div></div>');
    $("#overlay, #overlay_msg").show();
}
function hideOverlay() {
    $("#overlay, #overlay_msg").remove();
}
