window.dump2 = function( text )
{
    window.dump2 = function( text ) { window.dump2.target.innerHTML = text + '<br>' + window.dump2.target.innerHTML; }
    var div = document.createElement( 'div' );
    var iframe = document.createElement( 'iframe' );
    iframe.style.width = '400px';
    iframe.style.height = '200px';
    iframe.appendChild(div);

    window.dump2.target = div
    document.body.appendChild( div );

    window.dump2( text );
}
                
function jslog(msg) 
{
    msg = msg + '\n';

    /* Various ways of debugging:
     *    1. window.dump 
     *          - prints to console/xterm
     *    2. Components.utils.reportError 
     *          - didn't work for me in firefox
     *          - prints exceptions/msgs to javascript error console
     *          as errors
     *    3. logStringMessage 
     *          - didn't work for me in firefox
     *      cls=Components.classes["@mozilla.org/consoleservice;1"];
     *      srv=cls.getService(Components.interfaces.nsIConsoleService);
     *      srv.logStringMessage(msg);
     *    4. alert
     *    5. firebug (look it up)
     *    6. window.dump2 - works for all of them
     */
    if( 'undefined' != window.opera && null != window.opera ) {
        // opera has a problem with window.dump
        opera.postError(msg);
    } else if ( navigator.userAgent.indexOf("MSIE") != -1 ) {
        // what to use on on IE ?
    } else {
        window.dump(msg);
    }
}
