/*
 * StatusBarHelper.js
 *
 * Used to create create change the browser status bar for
 * selected elements.
 *
 * Should create a new instance of this helper, then as part
 * of the document.onload event, call addMessage();
 */

function StatusBarHelper() {
    var logger = LogFactory.getLog("StatusBarHelper.js");

    var self = this;

    this.addMessage = function(idVal, message) {
        logger.debug("Enter addMessage()");

        var elem = document.getElementById( idVal );
        if( ! elem ) {
            alert("Element with id: " + idVal + " not found!");
            return;
        }

        if( elem.onmouseover ) {
            alert("There is already an onmouseover event handler on " +
                  "this element!");
            return;
        }
        if( elem.onmouseout ) {
            alert("There is already an onmouseout event handler on " +
                  "this element!");
            return;
        }
        elem.onmouseover = function() {
            window.status = message;
            return true;
        };

        elem.onmouseout = function() {
            window.status = "";
            return true;
        };

        logger.debug("Exit addMessage()");
    }


}
