var Utilities = 
{
	/*	
		START------------------------------------------------------------------------------------------
		
		Name	: clsUtilities.js
		Version	: 1.0
		Author	: Henrik Andersen
		Mail	: Henrik@vectorpanic.com
		Date	: 2009-08-25 07:39
		
		SYNTAX-----------------------------------------------------------------------------------------
		
		DESCRIPTION------------------------------------------------------------------------------------
			
		TO DO'S----------------------------------------------------------------------------------------
				
		END--------------------------------------------------------------------------------------------
	*/
	
	// CONSTRUCTOR FUNCTION
	
	/*------------------------------------------------------------------------------------------------
	init:								
	This function is thought to act as a class constructor.
	------------------------------------------------------------------------------------------------*/
	init : function()
	{
		// NOTHING YET..
	},
	
	// PUBLIC FUNCTIONS
	
	/*------------------------------------------------------------------------------------------------
	ajax:								
	General feature allows handling of external / internal AJAX-call. This feature is an extension 
	of jQuery AJAX handling and therefore requires jQuery to work. Simple but very useful.
	
	!strURL				String		The URL for the data to be retrieved.
	!strData			String		Parameters to be sent with the call (GET or POST).
	!strType			String		Method to be used to send the call (GET or POST).
	!strMethod			String		The data type that the call is expected to be in response (text, XML or JSON).
	?fncCallback		Function	The function that is executed when data is retrieved.
	?arrParameters		Array		Optional parameters passed to the callback function.
	------------------------------------------------------------------------------------------------*/
	ajax : function(strURL, strData, strType, strMethod, fncCallback, arrParameters)
	{
		if(!arrParameters)
		{
			arrParameters	= new Array();
		}
		
		ajaxRequest 	= $.ajax({
			url			: strURL,
			data		: strData,
			type		: strType,
			dataType	: strMethod,
			async		: true,
			success		: function(responseData)
			{
				if(fncCallback)
				{
					fncCallback(true, responseData, arrParameters);
				}
			},
			error		: function(responseData)
			{
				if(fncCallback)
				{
					fncCallback(false, responseData, arrParameters);
				}
			}
			
		}).responseText;
	},
	
	/*------------------------------------------------------------------------------------------------
	getUrlVars:								
	Function used to retrieve the GET parameters from the current URL.
	
	@Return		Array		An associative array containing all GET parameters.
	------------------------------------------------------------------------------------------------*/
	getUrlVars : function()
	{
	    var vars = [], hash;
	    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
	
	    for(var i = 0; i < hashes.length; i++)
	    {
	        hash = hashes[i].split('=');
	        vars.push(hash[0]);
	        vars[hash[0]] = hash[1];
	    }
	
	    return vars;
	}
}
