function mouseOverAction()
{
    if (document.getElementById("flashDiv") != null) 
    {
        var flashDivObj = document.getElementById("flashDiv");
        flashDivObj.style.display = 'none';
    }
}

function mouseOutAction()
{
    if (document.getElementById("flashDiv") != null) 
    {
        var flashDivObj = document.getElementById("flashDiv");
        flashDivObj.style.display = '';
    }
}

// Main popup window handler
function message_popup_init(custom_text, custom_width, custom_height) {
    // show modal div
    $("html").css("overflow", "hidden");
    $("body").append("<div id='popup_overlay'></div><div id='popup_window'></div>");
    $("#popup_overlay").addClass("popup_overlayBG");
    $("#popup_overlay").fadeIn("slow");

    // build message box
    $("#popup_window").append("<h1>Message</h1>");
    $("#popup_window").append("<div id='popup_message_container' style='overflow: auto; overflow-x: auto; overflow-y: auto; margin-bottom: 4px; '><p id='popup_message'>" + custom_text + "</p></div>");
    $("#popup_window").append("<div class='buttons'><center><button id='continue' class='positive' type='submit'><img src='images/tick.png' alt=''/> Close</button></center></div>");

    // attach action to button
    $("#continue").click(message_popup_remove);

    // display message window
    if (custom_width == null) custom_width = 600;
    if (custom_height == null) custom_height = 400;
    message_popup_position(custom_width, custom_height);
    $("#popup_window").css({ display: "block" }); //for safari using css instead of show
    $("#continue").focus();
    $("#continue").blur();
}

// determine size of popup window and adjust position
function message_popup_position(P_WIDTH, P_HEIGHT) {
    var scrolling_width = 0;
    var popup_width = $("#popup_window").width();
    if (P_WIDTH > popup_width) popup_width = P_WIDTH;
    if (popup_width > $(window).width()) popup_width = ($(window).width() - 40);

    var popup_height = $("#popup_window").height();
    if (P_HEIGHT > popup_height) popup_height = P_HEIGHT;
    if (popup_height > $(window).height()) {
        popup_height = ($(window).height() - 40);
        scrolling_width = 30;
    }

    $("#popup_window").css({ marginLeft: '-' + parseInt((popup_width / 2), 10) + 'px', width: popup_width + 'px' });
    $("#popup_window").css({ marginTop: '-' + parseInt((popup_height / 2), 10) + 'px', height: popup_height + 'px' });
    $("#popup_message_container").css({ height: (popup_height - 70) + 'px' });
    if ($.browser.msie)
        $("#popup_message_container").css({ height: (popup_height - 80) + 'px', width: (popup_width - 10 - scrolling_width) + 'px' });
}

// remove all added objects
function message_popup_remove() {
    $("#popup_window").fadeOut("fast", function() { $('#popup_window,#popup_overlay').trigger("unload").unbind().remove(); });
    $("body", "html").css({ height: "auto", width: "auto" });
    $("html").css("overflow", "");
}