/*
	© 2009 by Noël Bossart, namics ag
*/
(function($) {
	NX.util = NX.util || {};
	$.extend(NX.util, {     

		/**
		  * Send debug message, either with plugin jquery.log.js or via Firebug console
		  *                     
		  * @author 	Noël Bossart                             
		  * @param 		{text}				REQUIRED: String to be loged     
		  * @param 		{useConsole}		OPTIONAL: If the output should be forced to console instead of log plugin, set this to true. Usefull for debuging of objects and arrays
		  *
		  * @return 	void
		  **/		
		debug: function(text, useConsole) {
			if($.log && NX.debug && !useConsole){
				$.log.debug(text);
			} 
			else if (window.console && NX.debug) {
				console.log(text);
			}
		},

		/**
		  * Send error message, either with plugin jquery.log.js or via Firebug console
		  *                     
		  * @author 	Noël Bossart                             
		  * @param 		{text}				REQUIRED: String to be loged     
		  *
		  * @return 	void
		  **/
		error: function(text) {
			if($.log && NX.debug){
				$.log.error(text);
			} 
			else if (window.console && NX.debug) {
				console.error(text);
			}
		},

		/**
		  * Send info message, either with plugin jquery.log.js or via Firebug console
		  *                     
		  * @author 	Noël Bossart                             
		  * @param 		{text}				REQUIRED: String to be loged     
		  *
		  * @return 	void
		  **/
		info: function(text) {
			if($.log && NX.debug){
				$.log.info(text);
			} 
			else if (window.console && NX.debug) {
				console.info(text);
			}
		},
              
		/**
		  * Stopp the time, requires plugin jquery.log.js
		  *                     
		  * @author 	Noël Bossart                             
		  * @param 		{text}				REQUIRED: String to be loged     
		  *
		  * @return 	void
		  **/
		time: function(text) {
		    if($.log && NX.debug){
		    	$.log.time(text);
		    } 
			else if (window.console) {
		    	console.info('NX.util.time() requires the jquery.log.js Plugin to be installed! ['+text+']');
		    }
		}

	});    
})(jQuery);
