/**
 * Class for debugging, used for testing and outputting various data and
 * functionality
 *
 * Usage:
 * 
 * var debug = new gravDebug();
 * debug.log("testData", testData);
 * 
 **/
function gravDebug(disabledOpt, showAlertsOpt)
{
	// Private members
	var showAlerts = false;
	var disabled = true;
	
	// Private functions
	var logItem = function(toLog) {
		
		if (disabled == false)
		{
			if (window.console)
			{
				console.log(toLog);
			}
			else
			{
				if (showAlerts == true)
				{
					alert(toLog);
				}
			}
		}
	}
	
	// Public functions
	this.log = function() {
		
		var logStr = "";
		
		for (var i = 0; i < arguments.length; i++)
		{
			logStr += arguments[i] + " ";
		}
		
		logItem(logStr);
	}
	
	// CONSTRUCTOR: Anything following this will be used as the constructor
	// --------------------------------------------------------------------
	
	if (typeof(disabledOpt) == "boolean")
	{
		disabled = disabledOpt;
	}
	
	// If set to true, will output debug data using alert() if there is no
	// console available
	if (typeof(showAlertsOpt) == "boolean")
	{
		showAlerts = showAlertsOpt;
	}
}
