//
// Winternetizer Web 2.snow
//
// Also in this file: jQuery CSS transform patch and jQuery CSS rotate/scale animation patch
//
// Zachary Johnson
// http://www.zachstronaut.com/
// December 2009
//
(function(b){function c(e){var d=["transform","WebkitTransform","MozTransform"];var f;while(f=d.shift()){if(typeof e.style[f]!="undefined"){return f}}return"transform"}var a=b.fn.css;b.fn.css=function(d){if(typeof b.props.transform=="undefined"&&(d=="transform"||(typeof d=="object"&&typeof d.transform!="undefined"))){b.props.transform=c(this.get(0))}if(d=="transform"){d=b.props.transform}return a.apply(this,arguments)}})(jQuery);(function(d){var c="deg";d.fn.rotate=function(g){var f=d(this).css("transform")||"none";if(typeof g=="undefined"){if(f){var e=f.match(/rotate\(([^)]+)\)/);if(e&&e[1]){return e[1]}}return 0}var e=g.toString().match(/^(-?\d+(\.\d+)?)(.+)?$/);if(e){if(e[3]){c=e[3]}d(this).css("transform",f.replace(/none|rotate\([^)]*\)/,"")+"rotate("+e[1]+c+")")}};d.fn.scale=function(i,h,f){var g=d(this).css("transform");if(typeof i=="undefined"){if(g){var e=g.match(/scale\(([^)]+)\)/);if(e&&e[1]){return e[1]}}return 1}d(this).css("transform",g.replace(/none|scale\([^)]*\)/,"")+"scale("+i+")")};var b=d.fx.prototype.cur;d.fx.prototype.cur=function(){if(this.prop=="rotate"){return parseFloat(d(this.elem).rotate())}else{if(this.prop=="scale"){return parseFloat(d(this.elem).scale())}}return b.apply(this,arguments)};d.fx.step.rotate=function(e){d(e.elem).rotate(e.now+c)};d.fx.step.scale=function(e){d(e.elem).scale(e.now)};var a=d.fn.animate;d.fn.animate=function(f){if(typeof f.rotate!="undefined"){var e=f.rotate.toString().match(/^(([+-]=)?(-?\d+(\.\d+)?))(.+)?$/);if(e&&e[5]){c=e[5]}f.rotate=e[1]}return a.apply(this,arguments)}})(jQuery);(function(i){var h=0;var c=0;var l=0;var o=0;var g=0;var n=true;var d=0;var e=["\u2744","\u2745","\u2746"];var b;var a=200;var j=0;i(m);function m(){var q=function(){h=i(window).width();c=i(window).height();l=h+300;o=-300;g=c+300};q();i(window).resize(q);if(!i("body").css("textShadow")){n=false}if(/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)){alert("Because you are using Internet Explorer I'm afraid your snow won't be as awesome... and if you are using IE6? Well then you get coal.")}if(/windows/i.test(navigator.userAgent)){e=["*"]}var p=50;while(p--){k(true)}b=new Date().getTime();setInterval(f,50)}function k(t){j++;var z=[{r:1,css:{fontSize:15+Math.floor(Math.random()*20)+"px",textShadow:"9999px 0 0 rgba(238, 238, 238, 0.5)"},v:2},{r:0.6,css:{fontSize:50+Math.floor(Math.random()*20)+"px",textShadow:"9999px 0 2px #eee"},v:6},{r:0.2,css:{fontSize:90+Math.floor(Math.random()*30)+"px",textShadow:"9999px 0 6px #eee"},v:12},{r:0.1,css:{fontSize:150+Math.floor(Math.random()*50)+"px",textShadow:"9999px 0 24px #eee"},v:20}];var q=i('<span class="winternetz">'+e[Math.floor(Math.random()*e.length)]+"</span>").css({color:"#eee",display:"block",position:"fixed",background:"transparent",width:"auto",height:"auto",margin:"0",padding:"0",textAlign:"left",zIndex:9999});if(n){q.css("textIndent","-9999px")}var w=Math.random();var u=z.length;var s=0;while(u--){if(w<z[u].r){s=z[u].v;q.css(z[u].css);break}}var p=(-300+Math.floor(Math.random()*(h+300)));var A=0;if(typeof t=="undefined"||!t){A=-300}else{A=(-300+Math.floor(Math.random()*(c+300)))}q.css({left:p+"px",top:A+"px"});q.data("x",p);q.data("y",A);q.data("v",s);q.data("half_v",Math.round(s*0.5));i("body").append(q)}function f(){if(Math.random()>0.8){d+=-1+Math.random()*2;if(Math.abs(d)>3){d=3*(d/Math.abs(d))}}var q=new Date().getTime();var p=q-b;b=q;if(p<55&&j<a){k()}else{if(p>150){i("span.winternetz:first").remove();j--}}i("span.winternetz").each(function(){var r=i(this).data("x");var u=i(this).data("y");var s=i(this).data("v");var t=i(this).data("half_v");u+=s;r+=Math.round(d*s);r+=-t+Math.round(Math.random()*s);if(r>l){r=-300}else{if(r<o){r=h}}if(u>g){i(this).remove();j--;k()}else{i(this).data("x",r);i(this).data("y",u);i(this).css({left:r+"px",top:u+"px"});if(s>=6){i(this).animate({rotate:"+="+t+"deg"},0)}}})}})(jQuery);