(function(a){var b=function(c){return c?Math.round(Math.random()*c):0};a.fn.matrix=function(f){var e,c,d;e=a.extend({},a.fn.matrix.settings,f);c=function(h,j,k,g){if(j%e.charstep===1){var i=document.createElement("span");i.appendChild(document.createTextNode(h.firstChild.nodeValue));a(i).animate({opacity:"0"},g);h.parentNode.insertBefore(i,h);h.firstChild.nodeValue=k.substr(j%k.length,1)}};d=function(q){if(q.children().length<e.maxStrings){var p=q.width(),l=q.height(),g=b(3),o=20-3*g,i=o*b(p/o),h=e.speedSeed+b(e.speedSeed)+(3-g)*b(e.speedSeed),m={step:0,data:e.data[b(e.data.length-1)],randset:(e.fadingSeed+b(e.fadingSeed))},k=document.createElement("span"),n=a(k),j=document.createElement("span");k.setAttribute("class","ui-matrix-string ui-matrix-string-size"+g);k.style.left=i+"px";k.style.top="-"+(50+b(l))+"px";j.setAttribute("class","ui-matrix-string-first");j.appendChild(document.createTextNode("0"));k.appendChild(j);q.append(n);n.animate({top:l+10},{duration:h,step:function(){m.step++;c(j,m.step,m.data,m.randset)},complete:function(){this.parentNode.removeChild(this)}})}window.setTimeout(function(){d(q)},e.distanceRoot+b(e.distanceSeed))};return this.each(function(){var g=a(this);g.addClass("ui-matrix");d(g)})};a.fn.matrix.settings={data:["abcdefghijklmnopqrstuvwxyz0123456789"],maxStrings:100,charstep:22,speedSeed:10000,fadingSeed:8000,distanceRoot:100,distanceSeed:500}}(jQuery));
