// CLASS CONSTRUCTOR
function Logger(level, width, height){
    //  logLevel = 0 = NONE
    //  logLevel = 1 = ERROR ONLY
    //  logLevel = 2 = ERROR / WARNING
    //  logLevel = 3 = ERROR / WARNING / DEBUG
    this.logLevel = 0;
    this.showLogger = true;

    if( typeof(level) != 'undefined' ){
        this.logLevel = level;
    }

    this.LogArea = document.createElement("DIV");
    this.LogArea.style.fontFamily = "Courier New";
    this.LogArea.style.fontSize = "8px";
    this.LogArea.style.overflow = "auto";
    this.LogArea.style.margin = "2px 5px 2px 5px";

    if( typeof(width) != 'undefined' ){
        this.LogArea.style.width = width;
    }else{
        this.LogArea.style.width = "290";
    }

    if( typeof(height) != 'undefined' ){
        this.LogArea.style.height = height;
    }else{
        this.LogArea.style.height = "300";
    }
    this.LogArea.innerHTML = "&nbsp;";


    this.duWindow = new DuWindow("Debugger Log", this.LogArea);
    this.duWindow.setListener(this);

    // this.show();
}

Logger.prototype.show = function(){
    this.showLogger = true;
    this.duWindow.show();
}

// FUNCTION DEFINITIONS
Logger.prototype.debug = function(msg){
    if( this.logLevel > 2 ){
        this.print("[DEBUG]", msg);
    }
}

Logger.prototype.warn = function(msg){
    if( this.logLevel > 1 ){
        this.print("[WARNING]", msg);
    }
}

Logger.prototype.error = function(msg){
    if( this.logLevel > 0 ){
        this.print("[ERROR]", msg);
        alert("[ERROR]: "+msg);
    }
}

Logger.prototype.print = function(prefix, msg){
    this.LogArea.innerHTML = prefix + " " + msg + "<br/>" + this.LogArea.innerHTML;
}

Logger.prototype.hideEvent = function(){
    this.debug("Hide Event Fired");
}
Logger.prototype.showEvent = function(){
    this.debug("Show Event Fired");
}
Logger.prototype.destroyEvent = function(){
    this.debug("Destroy Event Fired");
}
Logger.prototype.shadeEvent = function(){
    this.debug("Shade Event Fired");
}
Logger.prototype.unshadeEvent = function(){
    this.debug("Unshade Event Fired");
}


/*
var _logger = new Logger(3);
var handleKeys = function(evt){
    evt = (evt) ? evt : ((window.event) ? event : null);
    if (evt) {
        switch (evt.keyCode) {
        case 113: // F2
            _logger.show();
            break;    
        default:
            break;
        }
    }
}
if( document.onkeyup ){
    document.onkeyup = handleKeys;
}
*/

