/*************************************************************************
  cs_log.js 
  version date: 26 June 2005 
	
  Author: Louis Baliotis
*************************************************************************/
var csLog = {
    DEBUG: 0,
    INFO: 1,
    WARN: 2,
    ERROR: 5,
    severity: 5,  //Default to ERROR logging only
    hideDelay: 200,
    
    ready:false,
  
    init: function() {  
		/*var winOptions = "toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,copyhistory=no,scrollbars=yes,width=300,height=200,top=10,left=100";
		this.logWin = window.open('', 'tooltipLog', winOptions);
	    str = '<html><head><title>Client Side Log Window</title></head>';
	  	str += '<body style="text-align:left; padding-left:20px">';
	  	str += '<table id="logTable" name="logTable" border="1" cellpadding="2" cellspacing="0">';
	  	str += '<tr><th width="10%">LEVEL</th><th width="15%">TIMESTAMP</th><th width="75%">MESSAGE</th></tr>';
	    str += '</table>';
	  	str += '</body></html>'
	  	this.logWin.document.write(str);*/
	  	this.ready = true;
    },
    isDebugEnabled: function() {
    	if(this.severity <= this.DEBUG) return true;
    	else return false;
    },
	debug: function(msg) {
		if(!this.ready) this.init();
		if(this.logWin && this.logWin.closed) return;

		this.writeMessage('DEBUG',msg);
	},
	info: function(msg) {
		if(this.severity <= this.INFO) {
		
		}
	},
	writeMessage: function(severity, msg) {
		/*var logTable = this.getObj('logTable');
		if(logTable && logTable.insertRow && logTable.insertCell) {
			oTR = logTable.insertRow();
			oTD = oTR.insertCell();
			oTD.innerText = severity;
			oTD = oTR.insertCell();
			oTD.innerText = new Date();
			oTD = oTR.insertCell();
			oTD.innerText = this.HTMLEncode(msg);
		}
		else {*/
			alert(severity + " " + msg);
		//}
	},
	
	HTMLEncode: function(msg) {
		//Write code here to conver to &lt; &gt; &eq;, &quot;, &amp;
		return msg;
	},
	getObj: function( name, forceIEBehavior )
	{
	    var newObj;
	    if(!this.logWin) return;
	    if ( typeof name == "string" ) {
	        if (this.logWin.document.getElementById) {
	            newObj = this.logWin.document.getElementById(name);
	            if ( newObj == null && forceIEBehavior != null & forceIEBehavior ) {
	                var newObjArray = this.logWin.document.getElementsByName( name );
	                if ( newObjArray != null && newObjArray.length > 0 ) 
	                    newObj = newObjArray[ 0 ];
	            }else{
	                var newObjArray = this.logWin.document.getElementsByName( name );
	                if ( newObjArray != null && newObjArray.length > 0 ) 
	                    newObj = newObjArray[ 0 ];
	            }
	        }
	        else if (this.logWin.document.all) {
	            newObj = this.logWin.document.all[name];
	        }
	        else if (this.logWin.document.layers) {
	            newObj = this.logWin.document.layers[name];
	        }
	    }
	    else {
	        newObj = name;
	    }
	    return newObj;
	}
}
//++
// cross browser get object by id or name.  if the name is
// not a string, it is passed by unchanged since it can't be an id.
// if it is a string, it tries DOM first, then IE 4/5 then Netscape 4
// if forceIEBehavior is true and the getElementById
// fails, routine will try to find a name instead of IE
//--


