(function(w){var k=function(b,c){typeof c=="undefined"&&(c={});this.init(b,c)},a=k.prototype,o,p=["canvas","vml"],i=["oval","spiral","square","rect","roundrect"],x=/^\#([a-fa-f0-9]{6}|[a-fa-f0-9]{3})$/,v=navigator.appversion.indexof("msie")!==-1&&parsefloat(navigator.appversion.split("msie")[1])===8?true:false,y=!!document.createelement("canvas").getcontext,q=true,n=function(b,c,a){var b=document.createelement(b),d;for(d in a)b[d]=a[d];typeof c!=="undefined"&&c.appendchild(b);return b},m=function(b, c){for(var a in c)b.style[a]=c[a];return b},t=function(b,c){for(var a in c)b.setattribute(a,c[a]);return b},u=function(b,c,a,d){b.save();b.translate(c,a);b.rotate(d);b.translate(-c,-a);b.beginpath()};a.init=function(b,c){if(typeof c.safevml==="boolean")q=c.safevml;try{this.mum=document.getelementbyid(b)!==void 0?document.getelementbyid(b):document.body}catch(a){this.mum=document.body}c.id=typeof c.id!=="undefined"?c.id:"canvasloader";this.cont=n("div",this.mum,{id:c.id});if(y)o=p[0],this.can=n("canvas", this.cont),this.con=this.can.getcontext("2d"),this.ccan=m(n("canvas",this.cont),{visibility:"hidden"}),this.ccon=this.ccan.getcontext("2d");else{o=p[1];if(typeof k.vmlsheet==="undefined"){document.getelementsbytagname("head")[0].appendchild(n("style"));k.vmlsheet=document.stylesheets[document.stylesheets.length-1];var d=["group","oval","roundrect","fill"],e;for(e in d)k.vmlsheet.addrule(d[e],"behavior:url(#default#vml); position:absolute;")}this.vml=n("group",this.cont)}this.setcolor(this.color); this.draw();m(this.cont,{visibility:"hidden"})};a.cont={};a.can={};a.con={};a.ccan={};a.ccon={};a.timer={};a.activeid=0;a.diameter=40;a.setdiameter=function(b){this.diameter=math.round(math.abs(b));this.redraw()};a.getdiameter=function(){return this.diameter};a.crgb={};a.color="#000000";a.setcolor=function(b){this.color=x.test(b)?b:"#000000";this.crgb=this.getrgb(this.color);this.redraw()};a.getcolor=function(){return this.color};a.shape=i[0];a.setshape=function(b){for(var c in i)if(b===i[c]){this.shape= b;this.redraw();break}};a.getshape=function(){return this.shape};a.density=40;a.setdensity=function(b){this.density=q&&o===p[1]?math.round(math.abs(b))<=40?math.round(math.abs(b)):40:math.round(math.abs(b));if(this.density>360)this.density=360;this.activeid=0;this.redraw()};a.getdensity=function(){return this.density};a.range=1.3;a.setrange=function(b){this.range=math.abs(b);this.redraw()};a.getrange=function(){return this.range};a.speed=2;a.setspeed=function(b){this.speed=math.round(math.abs(b))}; a.getspeed=function(){return this.speed};a.fps=24;a.setfps=function(b){this.fps=math.round(math.abs(b));this.reset()};a.getfps=function(){return this.fps};a.getrgb=function(b){b=b.charat(0)==="#"?b.substring(1,7):b;return{r:parseint(b.substring(0,2),16),g:parseint(b.substring(2,4),16),b:parseint(b.substring(4,6),16)}};a.draw=function(){var b=0,c,a,d,e,g,k,j,r=this.density,s=math.round(r*this.range),l,h,q=0;h=this.ccon;var f=this.diameter;if(o===p[0]){h.clearrect(0,0,1e3,1e3);t(this.can,{width:f,height:f}); for(t(this.ccan,{width:f,height:f});b=1;)b.removechild(b.firstchild)}};a.redraw=function(){this.clean(); this.draw()};a.reset=function(){typeof this.timer==="number"&&(this.hide(),this.show())};a.tick=function(){var b=this.con,a=this.diameter;typeof timer!=="number"&&(this.activeid+=360/this.density*this.speed);o===p[0]?(b.clearrect(0,0,a,a),u(b,a*0.5,a*0.5,this.activeid/180*math.pi),b.drawimage(this.ccan,0,0,a,a),b.restore()):(this.activeid>=360&&(this.activeid-=360),m(this.vml,{rotation:this.activeid}))};a.show=function(){if(typeof this.timer!=="number"){var a=this;this.timer=self.setinterval(function(){a.tick()}, math.round(1e3/this.fps));m(this.cont,{visibility:"visible"})}};a.hide=function(){typeof this.timer==="number"&&(clearinterval(this.timer),delete this.timer,m(this.cont,{visibility:"hidden"}))};a.kill=function(){var a=this.cont;typeof this.timer==="number"&&this.hide();o===p[0]?(a.removechild(this.can),a.removechild(this.ccan)):a.removechild(this.vml);for(var c in this)delete this[c]};w.canvasloader=k})(window);