

function debugPanel (lineCount, rows, cols)
{
   var i;
   if (!rows) rows=20;
   if (!cols) cols=50;

   document.write('<table id=debug style="position:absolute; bottom:0; right:0" border="1" cellpadding="1" cellspacing="1">');
   document.write('<font face="Courier">');

   for (i = 1; i <= lineCount; i++)
   {
       document.write('<tr><td><span id=debug' + i + '>Debug info ' + i + '</span></td><tr>');
   }
  document.write('</font>');
  document.write('<tr><td><table border=0><tr><td><TEXTAREA ID="debugLog" COLS=' + cols + ' ROWS=' + rows + '>** Debug Log **</TEXTAREA></td></tr></table></td></tr>');
  document.write('</table>');
}


function debugLogEntry (s)
{
   if (debugging)
   {
      debugLog.value += "\n" + s;
	  debugLog.scrollTop = debugLog.scrollHeight;
   }
}

function getFunctionName ()
{
   return arguments.callee.caller.toString().substr(0, arguments.callee.caller.toString().indexOf('{')).replace(/\r/g,"").replace(/\n/g,"");
   
//    debugLogEntry(arguments.callee.toString().substr(0, arguments.callee.toString().indexOf('{')));    // return function name
//    debugLogEntry(arguments.callee.caller.toString().substr(0, arguments.callee.caller.toString().indexOf('{')));    //return caller
}


function debugStatusEntry (n, s)
{
   if (debugging)
   {
      document.getElementById("debug"+n).innerHTML = s;
   }
}

