/*
 * show_tooltip(): Display a tooltip, either using a modern
 *                 browser's native support for this feature, or
 *                 by simulating it for older browsers using
 *                 layers.
 */
function show_tooltip(element, event, text){

    /*
     * If this is IE (document.all) or a modern,
     * standards-compliant browser (document.getElementById),
     * use the 'title' property to set the tooltip natively.
     */
    if (document.all || document.getElementById) {

        element.title = text

    /*
     * Otherwise this is an older Netscape browser (document.layers),
     * so use layers to simulate the same thing.  Be sure to include a
     * <div id="tooltip"> element after the <body> tag, otherwise this
     * won't work.  e.g.
     * <div id="tooltip" style="position:absolute;visibility:hidden"></div>
     */
    } else if (document.layers){

        document.tooltip.document.write('<layer bgColor="#FFFFE7" ' +
                                               'style="border:1px solid black;' +
                                                      'font-size:12px;' +
                                                      'color:#000000;">' +
                                         text +
                                        '</layer>')
        document.tooltip.document.close()
        document.tooltip.left = event.pageX + 5
        document.tooltip.top = event.pageY + 5
        document.tooltip.visibility = "show"

    }
}


/*
 * hide_tooltip(): Hide a tooltip.
 */
function hide_tooltip() {

    /*
     * Modern browsers auto-hide tooltips after 5 seconds and
     * onMouseOut.  For older Netscape browsers, explicitly
     * hide the tooltip element when the onMouseOut event is
     * triggered.
     */
    if (document.layers) {
        document.tooltip.visibility = "hidden"
    }
}

