// Phils general javascript utilities


// Global debug control.
// Set to 1 to enable debug messages
var debugEnabled = 0;     // Default to off .. but it can be set anywhere
var debug_first_pass = 1;


// Print to the report specified region
function print(divID, report)
{
  var theReport = document.createTextNode(report)
  document.getElementById(divID).appendChild(theReport);
  var newLine = document.createElement('BR')
  document.getElementById(divID).appendChild(newLine);
}

function debug(report)
{
  // Special case, it can be knobbled!
  if (debugEnabled == 1)
  {
    if (debug_first_pass == 1)
    {
      document.getElementById("debug").style.visibility = "visible";  // Show the debug pane
      document.getElementById("debug").style.display = "block";
      debug_first_pass = 0;                                           // No need to do this again
    }
    print("debug", report);
  }
}



