﻿    var m_bDebug = false; // If you set this to true, a new window will be opened, and all debug info will redirect to it. 
    var windowDebug = "";  
      
    //
    // Send info to the debug window, if m_bDebug = true
    // This actually will pop a seperate debug window, and then re-use
    // 
    function DebugOut(sMsg)
    {    
        if(m_bDebug == true)
        {
            if(windowDebug == "")
            {
                windowDebug = window.open('', 'DebugWindow');
            }
                    
            if(windowDebug != "")
                windowDebug.document.write("Debug (" + Date() + "): " + sMsg + " <br/>");        
        }           
    } 