<!--
var Logger = Class.create();
Logger.prototype = {
  initialize: function(id) {
    var consoleID = id + '.console';
    var windowTopID = id + '.windowTop';
    var clearButtonID = id + '.clearButton';
    var win =
'<table id = "' + id + '" cellspacing="0" cellpadding="0" ' +
    'style = "POSITION:ABSOLUTE; TOP:10px; LEFT:200px ;z-index: 1;' +
             'BACKGROUND-COLOR:#CCCCCC; BORDER-STYLE:outset ; BORDER-WIDTH:2;">' +
  '<tr id = "' + windowTopID + '" style = "font-size:8pt; height:16px; COLOR:#FFFFFF; BACKGROUND-COLOR:#0099FF;">' +
     '<td >DEBUG Console</td>' +  
  '</tr>' +
  '<tr style="height:16px;">' +
    '<td >' +
      '<input id="' + clearButtonID + '" type="button" style="font-size:9pt;" value="clear">' +
    '</td>' +
  '</tr>' +
  '<tr>' +
     '<td>' +
       '<div id="' + consoleID  + '" style="POSITION:static; height:150px; width:250px;' +
              'font-size:9pt; OVERFLOW:AUTO;COLOR:#00FF00; BACKGROUND-COLOR:#000000; BORDER-STYLE:inset ; BORDER-WIDTH:2; BORDER-COLOR:#c0c0c0;">' +
       '</div>' +
     '</td>' +
  '</tr>' +
  '<tr style="height:2px;">' +
    '<td></td>' +
  '</tr>' +
'</table>';
    new Insertion.Bottom(document.body, win);
    this.startDrag = false;
    this.start_x = 0;
    this.start_y = 0;
    this.start_left = 0;
    this.start_top = 0;
    this.move_x = 0;
    this.move_y = 0;
    this.window = $(id);
    this.windowTop = $(windowTopID);
    this.console = $(consoleID);
    this.clearButton = $(clearButtonID);
    Event.observe(this.clearButton, 'click', this.clear.bindAsEventListener(this), true);
    Event.observe(this.windowTop, 'mousedown', this.wintopMousedown.bindAsEventListener(this), false);
    Event.observe(this.windowTop, 'mouseup', this.wintopMouseup.bindAsEventListener(this), false);
    Event.observe(this.windowTop, 'mouseout', this.wintopMouseout.bindAsEventListener(this), false);
    Event.observe(document, 'mousedown', this.mousedown.bindAsEventListener(this), false);
    Event.observe(document, 'mousemove', this.mousemove.bindAsEventListener(this), false);
    Event.observe(document, 'mouseup', this.mouseup.bindAsEventListener(this), false);
  },
  write: function(text)  {
    if (this.console == null) return;
    this.console.innerHTML = this.console.innerHTML + text + '<br>';
    this.console.scrollTop = this.console.scrollTop + 100;
  },
  writeInnerHTML: function(element) {
    this.writeHTML($(element).innerHTML);  
  },
  writeHTML: function(htm) {
    this.write(new String(htm).escapeHTML());  
  },
  clear: function()  {
    if (this.console == null) return;
    this.console.innerHTML = '';
    this.console.scrollTop = 0;
  },
  wintopMousedown : function(e) {
    this.startDrag = true;
    this.start_left = parseFloat(this.window.style.left || 0);
    this.start_top  = parseFloat(this.window.style.top  || 0);
  },
  wintopMouseup : function(e) {
    this.startDrag = false;
  },
  wintopMouseout : function(e) {
    //this.startDrag = false;
  },
  mousedown : function(e){
    //this.write('document.mousedown,x=' + Event.pointerX(e) + ',y=' + Event.pointerY(e)); 
    this.start_x = Event.pointerX(e);
    this.start_y = Event.pointerY(e);
    this.move_x = 0;
    this.move_y = 0;
  },
  mousemove : function(e){
    this.move_x = Event.pointerX(e) - this.start_x;
    this.move_y = Event.pointerY(e) - this.start_y;
    if (this.startDrag) {
      newLeft = (this.start_left + this.move_x);
      newTop  = (this.start_top  + this.move_y);   
      if (newLeft > 0) {
        this.window.style.left = newLeft + 'px';
      } 
      if (newTop > 0) {
        this.window.style.top = newTop + 'px';
      } 
    } 
    //this.write('x=' + this.move_x + ',y=' + this.move_y); 
   },
  mouseup : function (e){
    this.startDrag = false;
    this.move_x = Event.pointerX(e) - this.start_x;
    this.move_y = Event.pointerY(e) - this.start_y;
  }
}
//-->
