/**
 * Attaching loading indicator to :submit button
 */
jQuery.fn.LoadingIcon = function(customText, options) {
    if(customText == undefined){customText = "Search in progress"}
	var o = $.extend({
		className: 'loading_indicator',
		text: "" + customText
	}, options);
	return this.each(function() {
		var subject = this;
		var span = jQuery('<span></span>').text(o.text).addClass(o.className);
		jQuery(subject).after(span).after(' ').click(function() {
			span.show();
		});
		jQuery(window).unload(function() {
			span.hide();
		});
		span.hide();
	});
};
