/**
 * Log Class - Create easy Javascript logs in your HTML page
 *
 * @author 	Eric Jeker <eric.jeker@virtua.ch>
 * @version	0.1
 * @licence DWYW : Do Whatever You Want
**/

var Logs = 	{
	container 	: null,
	content 	: null,
	activated 	: true,
	
	setOnOff : function (b)	{
		Logs.activated = b ;
	},
	
	// Define the log container (must contain a 'content' element)
	setContainer : function (el) {
		Logs.container = el ;
		Logs.content = Container.getChildNodeById(Logs.container, 'content') ;
	},
	
	// Add some text in the log container
	add : function (str)	{
		if (Logs.container && Logs.activated)	{
			Logs.content.innerHTML = getNow() + '> ' + str + Logs.content.innerHTML ;
			return true ;
		}
		
		return false ;
	},
	
	// Add a text line in the log container
	addLine : function (str)	{
		if (Logs.container && Logs.activated)	{
			Logs.content.innerHTML = getNow() + '> ' + str + '<br/>' + Logs.content.innerHTML ;
			return true ;
		}
		
		return false ;
	},
	
	// Set the text in the log container
	set : function (str)	{
		if (Logs.content && Logs.activated)	{
			Logs.content.innerHTML = getNow() + '> ' + str ;
			return true ;
		}
		
		return false ;
	},

	// Clear the log container
	clear : function ()	{
		Logs.content.innerHTML = '' ;
		return true ;
	}
}