









/**
 * Contains RY specific modifications and utilities for use with the
 * jQuery library.
 *
 * Copyright (c) 2008 Radley Yeldar
 */

/**
 * Modify the load method to always send a timestamp request parameter. 
 * This prevents IE6 from caching ajax responses.
 */
$.prototype.load_overridden = $.prototype.load;
$.prototype.load = function (url, data, callback){
	params = (data != undefined && data != null) ? data : {};
	params['preventCaching'] = new Date().getTime();
	return this.load_overridden(url, params, callback);
}

/**
 * Calls load after displaying a loading indicator. The indicator is then
 * hidden after the load has completed.
 * 
 * This function is an alternative to using the ajaxStart and ajaxStop 
 * functions which work best when indicators are shown in only one
 * location on a page. This function allows multiple indicators to be 
 * used anywhere on the page. 
 */
$.prototype.loadWithIndicator = function (url, data, callback, indicator){
	indicator.show();
	return this.load(url, data, function() {
		indicator.hide();
		if (callback != undefined && callback != null) {new callback;}
	});
}