(function(b){var a={ajax:true,delay:0,image:"throbber.gif",parent:"",wrap:""};b().ajaxStop(function(){_throbberHide(b(".throbber_ajax"))});_throbberShow=function(c,e){var d;if(c.parent){e=null;d=b(c.parent)}else{d=(e?e.parent():b("body"))}if(d.find(".throbber").length==0){window.clearTimeout(d.data("throbber_timeout"));d.data("throbber_timeout",window.setTimeout(function(){var f=b('<img src="'+c.image+'" class="throbber" />');if(c.ajax){f.addClass("throbber_ajax")}if(e){f.data("throbber_element",e);e.hide().after(f)}else{d.children().hide().end().append(f)}if(c.wrap!=""){f.wrap(c.wrap)}},c.delay))}};_throbberHide=function(c){c.each(function(){var d=b(this);var e=d.data("throbber_element");if(e){e.show()}else{d.siblings().show()}window.clearTimeout(d.parent().data("throbber_timeout"));d.remove()})};b.fn.throbber=function(d,c){if(typeof d=="undefined"){d="click";c={}}else{if(typeof d=="object"){c=d;d="click"}else{if(typeof c=="undefined"){c={}}}}c=b.extend({},a,c);b(this).each(function(){var e=b(this);e.bind(d,function(){_throbberShow(c,e)})});return b(this)};b.throbberShow=function(c){c=b.extend({},a,c);_throbberShow(c,null);return b};b.throbberHide=function(){_throbberHide(b(".throbber"));return b}})(jQuery);