(function($){$.fn.spinner=function(options){var opts=$.extend({},$.fn.spinner.defaults,options);return this.each(function(){var l=0,t=0,w=0,h=0,shim=0,$s;var $this=$(this);if(options=='remove'||options=='close'){var $s=$this.data('spinner');var o=$this.data('opts');if(typeof $s!='undefined'){$s.remove();$this.removeData('spinner').removeData('opts');if(o.hide)$this.css('visibility','visible');o.onFinish.call(this);return;}}
var pos=$this.offset();w=$this.outerWidth();h=$this.outerHeight();if(h>opts.height)shim=Math.round((h-opts.height)/2);else if(h<opts.height)shim=0-Math.round((opts.height-h)/2);t=pos.top+shim+'px';if(opts.position=='right'){l=pos.left+w+10+'px';}else if(opts.position=='left'){l=pos.left-opts.width-10+'px';}else{l=pos.left+Math.round(.5*w)-Math.round(.5*opts.width)+'px';}
opts.onStart.call(this);if(opts.hide)$this.css('visibility','hidden');$s=$('<img src="'+opts.img+'" style="position: absolute; left: '+l+'; top: '+t+'; width: '+opts.width+'px; height: '+opts.height+'px; z-index: '+opts.zIndex+';" />').appendTo('body');$this.data('spinner',$s).data('opts',opts);});};$.fn.spinner.defaults={position:'center',img:'typo3conf/ext/rwd_exhibitions/static/images/spinner.gif',height:24,width:24,zIndex:1001,hide:false,onStart:function(){},onFinish:function(){}};})(jQuery);

