/****
* Debugger: Objeto para abrir uma janela e gerar um debug na tela.
****/
function SpdtDebug() {
    this.jan     = null;
    this.lastTime = 0;
}
SpdtDebug.prototype.open = function() {
    var caracts = "toolbar=no,location=no,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,x=0,y=0,top=0,left=0";
    caracts="width="+500+",height="+500+","+caracts;
    if (this.jan == null) {
        this.jan = window.open("about:blank","_debugWindow",caracts);
        this.jan.focus();
    } else {
        if (this.jan.closed) {
           this.jan = window.open("about:blank","_debugWindow",caracts);
        }
        this.jan.focus();
    }
    this.lastTime = (new Date()).getTime();
}
SpdtDebug.prototype.isOpen = function() {
    return ((this.jan != null) && (!this.jan.closed));
}
SpdtDebug.prototype.close = function() {
    if (this.isOpen()) {
        this.jan.close();
    }
}
SpdtDebug.prototype.clear = function() {
    if (this.isOpen()) {
        this.jan.document.clear();
    }
}
SpdtDebug.prototype.write = function(msg) {
    if (!this.isOpen()) {
        this.open();
    }
    this.jan.document.write(msg);
}
SpdtDebug.prototype.writeln = function(msg) {
    if (!this.isOpen()) {
        this.open();
    }
        this.jan.document.writeln(msg+'<br>');
}
SpdtDebug.prototype.writemsg = function(msg) {
    if (!this.isOpen()) {
        this.open();
    }
    this.writeln("<b>DEBUG: </b>"+msg);
}
SpdtDebug.prototype.writetm = function(msg) {
    if (!this.isOpen()) {
        this.open();
    }
    var time = ((new Date()).getTime());
    this.writeln("<b>DEBUG ("+(time-this.lastTime)+"): </b>"+msg);
    this.lastTime = time;
}
var _SpdtDebug = new SpdtDebug();


