(function(){function c(a,b){a&&(this.element=a,i.remove(a),i.removeDetached(),this.options=f.extend({radii:[5,10],color:"#000",dashWidth:1.8,dashes:12,opacity:1,padding:3,speed:.7,build:!0},b||{}),this._position=0,this._state="stopped",this.build(),i.add(this))}function b(a){this.element=a}function a(a){return a*Math.PI/180}var d={Version:"2.0_b1"},e=Array.prototype.slice,f={extend:function(a,b){for(var c in b)a[c]=b[c];return a},"break":{},_each:function(a,b){for(var c=0,d=a.length;c<d;c++)b(a[c])},each:function(a,b,c){var d=0;try{this._each(a,function(a){b.call(c,a,d++)})}catch(e){if(e!=f["break"])throw e}},bind:function(a,b){var c=e.call(arguments,2);return function(){return a.apply(b,c.concat(e.call(arguments)))}},scroll:function(a,b){if(!b)return a;var c=a.slice(0,b);return a.slice(b,a.length).concat(c)},any:function(a,b,c){var d=!1;f.each(a||[],function(a,e){if(d|=b.call(c,a,e))return f["break"]});return!!d},member:function(a,b){var c=!1;f.any(a||[],function(a){if(c=a===b)return!0});return c},select:function(a,b,c){var d=[];f.each(a||[],function(a,e){b.call(c,a,e)&&(d[d.length]=a)});return d},without:function(a){var b=e.call(arguments,1);return f.select(a,function(a){return!f.member(b,a)})}},g={drawRoundedRectangle:function(b,c){var d=f.extend({top:0,left:0,width:0,height:0,radius:0},c||{}),e=d.left,g=d.top,h=d.width,i=d.height,d=d.radius;b.beginPath(),b.moveTo(e+d,g),b.arc(e+h-d,g+d,d,a(-90),a(0),!1),b.arc(e+h-d,g+i-d,d,a(0),a(90),!1),b.arc(e+d,g+i-d,d,a(90),a(180),!1),b.arc(e+d,g+d,d,a(-180),a(-90),!1),b.closePath(),b.fill()}},h=function(){function a(a){var c=[];a.indexOf("#")==0&&(a=a.substring(1)),a=a.toLowerCase();if(a.replace(b,"")!="")return null;a.length==3?(c[0]=a.charAt(0)+a.charAt(0),c[1]=a.charAt(1)+a.charAt(1),c[2]=a.charAt(2)+a.charAt(2)):(c[0]=a.substring(0,2),c[1]=a.substring(2,4),c[2]=a.substring(4));for(a=0;a<c.length;a++)c[a]=parseInt(c[a],16);c.red=c[0],c.green=c[1],c.blue=c[2];return c}var b=RegExp("[0123456789abcdef]","g"),c=function(){function a(a,b,c){a=a.toString(c||10);return Array(b-a.length).join("0")+a}return function(b,c,d){return"#"+a(b,2,16)+a(c,2,16)+a(d,2,16)}}();return{hex2rgb:a,hex2fill:function(b,c){typeof c=="undefined"&&(c=1);var d=c,e=a(b);e[3]=d,e.opacity=d;return"rgba("+e.join()+")"},rgb2hex:c}}();f.extend(d,{enabled:!1,support:{canvas:function(){var a=document.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")}()},dom:function(){var a,b;a=b=function(){throw"Using Spinners with a CSS Selector requires a selector engine, include one of: Sizzle (jQuery 1.4+/Prototype 1.7+), NWMatcher or Slick (MooTools 1.3+)."},window.Sizzle?(a=Sizzle,b=Sizzle.matches):window.jQuery?(a=jQuery.find,b=function(a,b){return jQuery(a).is(b)}):window.NWMatcher&&NW.Dom?(a=NW.Dom.select,b=NW.Dom.match):window.Prototype&&Prototype.Selector?(a=Prototype.Selector.select,b=Prototype.Selector.match):window.Slick&&(a=function(a,b){return Slick.search(b||document,a)},b=Slick.match);return{select:a,match:b}}(),init:function(){if(!this.support.canvas&&!window.G_vmlCanvasManager)if(window.attachEvent&&navigator.userAgent.indexOf("Opera")===-1)alert("Spinners requires ExplorerCanvas (excanvas.js)");else return;window.G_vmlCanvasManager&&window.G_vmlCanvasManager.init_(document),this.enabled=!0},create:function(a,c){b.create(a,c);return this.get(a)},get:function(a){return new b(a)},play:function(a){this.get(a).play();return this},pause:function(a){this.get(a).pause();return this},toggle:function(a){this.get(a).toggle();return this},stop:function(a){this.get(a).stop();return this},remove:function(a){this.get(a).remove();return this},removeDetached:function(){i.removeDetached();return this},getDimensions:function(a){a=i.get(a)[0].getLayout().workspace.radius*2;return{width:a,height:a}}});var i={spinners:[],get:function(a){if(a){var b=[];f.each(this.spinners,function(c){c&&(a.nodeType==1?c.element==a:d.dom.match(c.element,a))&&b.push(c)});return b}},add:function(a){this.spinners.push(a)},remove:function(a){var b=[];f.each(this.spinners,function(c){(a.nodeType==1?c.element==a:d.dom.match(c.element,a))&&b.push(c.element)}),f.each(b,f.bind(function(a){this.removeByElement(a)},this))},removeByElement:function(a){if(a=this.get(a)[0])a.remove(),this.spinners=f.without(this.spinners,a)},removeDetached:function(){return function(){f.each(this.spinners,function(a){a&&!a.isAttached()&&this.remove(a.element)},this)}}()};f.extend(b,{create:function(a,b){if(a){var e=b||{},g=[];a.nodeType==1?g.push(new c(a,e)):f.each(d.dom.select(a)||[],function(a){g.push(new c(a,e))});return g}}}),f.extend(b.prototype,{items:function(){return i.get(this.element)},play:function(){f.each(this.items(),function(a){a.play()});return this},stop:function(){f.each(this.items(),function(a){a.stop()});return this},pause:function(){f.each(this.items(),function(a){a.pause()});return this},toggle:function(){f.each(this.items(),function(a){a.toggle()});return this},remove:function(){i.remove(this.element);return this}}),f.extend(c.prototype,function(){function b(){var a=this.options.speed*1e3/this.options.dashes;this.nextPosition(),this._playTimer=window.setTimeout(f.bind(b,this),a)}return{remove:function(){this.canvas&&(this.stop(),this.canvas.parentNode.removeChild(this.canvas),this.ctx=this.canvas=null)},build:function(){this.remove();var a=this.getLayout().workspace.radius,b=a*2;this.canvas=document.createElement("canvas"),this.canvas.style.zoom=1,this.canvas.height=b,this.canvas.width=b,document.body.appendChild(this.canvas),window.G_vmlCanvasManager&&G_vmlCanvasManager.initElement(this.canvas),this.ctx=this.canvas.getContext("2d"),this.ctx.globalAlpha=this.options.opacity,this.element.appendChild(this.canvas),this.ctx.translate(a,a),this.drawPosition(0);return this},getLayout:function(){if(this._layout)return this._layout;var a=this.options,b=a.dashes,c=a.radii,d=a.dashWidth,e=Math.min(c[0],c[1]),c=Math.max(c[0],c[1]),f=Math.ceil(Math.max(Math.max(d,c),Math.sqrt(c*c+d/2*(d/2))));f+=a.padding;for(var a=f,g=1/b,h=[],i=0;i<b;i++)h.push((i+1)*g);return this._layout=b={workspace:{radius:a,opacities:h},dash:{position:{top:f-c,left:f-d/2},dimensions:{width:d,height:c-e}}}},isAttached:function(){if(!this.element)return!1;var a;for(a=this.element;a&&a.parentNode;)a=a.parentNode;return!!a&&!!a.body},_nextPosition:b,nextPosition:function(){this._position==this.options.dashes-1&&(this._position=-1),this._position++,this.drawPosition(this._position)},drawPosition:function(b){var c=this.getLayout().workspace,d=c.radius*2,e=-1*c.radius,g=this.options.dashes;this.ctx.clearRect(e,e,d,d),d=a(360/g),b=f.scroll(c.opacities,b*-1);for(c=0;c<g;c++)this.drawDash(b[c],this.options.color),this.ctx.rotate(d)},drawDash:function(a,b){this.ctx.fillStyle=h.hex2fill(b,a);var c=this.getLayout(),d=c.workspace.radius,e=c.dash.position,c=c.dash.dimensions;g.drawRoundedRectangle(this.ctx,{top:e.top-d,left:e.left-d,width:c.width,height:c.height,radius:Math.min(c.height,c.width)/2})},play:function(){if(this._state!="playing"){this._state="playing";var a=this.options.speed*1e3/this.options.dashes;this._playTimer=window.setTimeout(f.bind(b,this),a);return this}},pause:function(){if(this._state!="paused")return this._pause(),this._state="paused",this},_pause:function(){this._playTimer&&(window.clearTimeout(this._playTimer),this._playTimer=null)},stop:function(){if(this._state!="stopped")return this._pause(),this._position=0,this.drawPosition(0),this._state="stopped",this},toggle:function(){this[this._state=="playing"?"pause":"play"]();return this}}}()),window.Spinners=d,d.init(),d.enabled||f.each("create get remove play stop pause toggle".split(" "),function(a){d[a]=function(){return this}})})();
