/*
	Set up jQuery defaults for general Helmstone usage
	(c) 2010 Rob Watkins
	This code is free to use for any purpose, provided the copyright notice and credit to original author is maintained.
	The code is provided AS IS. No guarantee is made on the fitness of this code for any purpose. Use at your own risk.
*/
/*   ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 
 *   DEPENDENCIES
 *
 *   jQuery (based on 1.4)
 *   tiny 
 *   ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~  */

(function($) 
{ 
	// Set up templating defaults
	if($.fn.hTemplate)
	{
		$.fn.hTemplate.defaults.ajax.getDataArray = function(data /* Response as text */) { return (data.charAt(0) == '(' ? eval(data) :eval('(' + data + ')')).ResultSet.Items; };
		$.fn.hTemplate.defaults.ajax.contentType = 'text/xml';
	}	
	//
	
	// Add ready event to page
	HUI.attachPageToFramework = function(pageinstance)
	{		
		if(typeof pageinstance.ready == 'function')
			$(function($) { pageinstance.ready($); }); // Closure ensures .ready() is called in context of page object like the other events
	};
	//
})(jQuery);

