var wndLog = null;
var startDate;
var startTime;


function logDebug (message)
{
  if (wndLog == null)
    wndLog = window.open ("", "log");
  wndLog.document.write (message + "<br/>");
}


function stack()
{
  try
  {
    throw Error()
  }
  catch(ex)
  {
    alert(ex.stack);
  }
}


// before calling logElapsedTime, do this:
//   startDate = new Date();           // Grab new copy of date
//   startTime = startDate.getTime();  // Grab current millisecond #

function logElapsedTime ()
{
  var n = new Date();           // grab new copy of date
  var s = n.getTime();          // grab current millisecond #
  var diff = s - startTime;     // calculate the difference.
  logDebug ("operation took " + diff + " milliseconds");
}