	/**
	 * @namespace This namespace holds all client side exception handling
	 * @author erik 12/27/2007
	 */	
	Sureflix.Error = {};
	
	
	/**
	 * @class This class handles all client side exceptions
	 * @author erik 12/27/2007
	 */	
	Sureflix.Error.ErrorHandler = {
		standardMessage: "A JavaScript error has occurred: #{message}\n\n(Line #{lineNumber} in #{fileName})"
	};


	//Shorthand
	SxEr = Sureflix.Error.ErrorHandler;
	
	
	/**
	 *	Displays the error details in the console if Firebug is installed
	 *	Use this method for debugging in cases where the user will not notice that an error has occurred
	 *	@param {Error} The error object returned in a catch statement
	 *	@author Erik 7/23/2008
	 */
	Sureflix.Error.ErrorHandler.consoleError = function(e, customMessage) {
		if (!customMessage) {
			customMessage = this.standardMessage;
		}
		
		if (typeof e == "string") {
			e = new Error(e);
		}
		
		if ((window.console) && (console.firebug)) {
			var myTemplate = new Template(customMessage);
			var errorMessage = myTemplate.evaluate(e);
			console.error(errorMessage);

		}
	}
	
	
	/**
	 *	Displays the error details to the user
	 *	Use this method any time a user's request could not be completed
	 *	@param {Error} e The error object returned in a catch statement
	 *	@param {String} customMessage A template string to show the user: "Something bad happened: #{message}\n\n(Line #{lineNumber} in #{fileName})"
	 *	@author Erik 7/23/2008
	 */
	Sureflix.Error.ErrorHandler.userError = function(e, customMessage) {
		if (typeof e == "string") {
			e = new Error(e);
		}
		
		this.consoleError(e, customMessage);

		if (!customMessage) {
			customMessage = this.standardMessage;
		}
		
		var myTemplate = new Template(customMessage);
		alert(myTemplate.evaluate(e));
	}
	
	
	
	/**
	 *	Displays a log message in the console if Firebug is installed
	 *	@param {String} text The text to be logged
	 *	@author Erik 10/10/2008
	 */
	Sureflix.Error.ErrorHandler.consoleLog = function(text) {
		if ((window.console) && (console.firebug)) {
			console.log(text);
		}
	}
