(function(){ var topline=null;var bottomline=null;var stack=[]; timer=typeof timer=="undefined"?function(){var d={},f=null,g=false;d.busy=function(){return g};d.stop=function(){if(f){clearTimeout(f);f=false}g=false};d.callibrate=function(h){d.collect(1,function(){for(var a=stack,b={},c=0;c<a.length;c++){var e=a[c];if(b[e])b[e]++;else b[e]=1}var i=a.length/100;a=[];a=[];for(c in b){e=b[c];a.push([e/i,c])}a.sort(function(j,k){var l=j[0],m=k[0];if(l>m)return-1;else if(l<m)return 1;return 0});b=a[0];c=a[1];a=a.length?[b[1],a.length==1?b[1]:c[1]]:[];a.sort();b=a[0]; c=a[1];if(c!=null&&b!=null){topline=c;bottomline=b;h&&h()}else alert("scream")})};d.collect=function(h,a){if(!g){g=true;var b=0;if(h){var c=h*1E3;stack=Array(~~(c/(topline?topline:1)));var e=0;(function(){var i=arguments.callee,j=+new Date;f=setTimeout(function(){var k=+new Date-j;b+=k;stack[e++]=k;if(b<c)i();else{for(d.stop();stack.length;){if(stack[stack.length-1]!=null)break;stack.pop()}a&&a()}},0)})()}else{stack=[];(function i(){var j=+new Date;if(g)f=setTimeout(function(){stack.push(+new Date- j);i()},0)})()}return stack}};return d}():timer; var progress=typeof progress=="undefined"?function(){var d={},f=0,g=[];d.build=function(b){b=typeof b=="string"?document.getElementById(b):b;var a=b.style;a.backgroundColor="black";a.width="128px";a.height="64px";a.margin="1px";a.overflow="hidden";a.position="relative";a=b.appendChild(document.createElement("span")).style;a.height="100%";a.width="2px";a.display="inline-block";a.backgroundColor="black";a=b.appendChild(document.createElement("div")).style;a.backgroundColor="black";a.position="absolute"; a.width="100%";a.height="1%";a.bottom=0;var c=document.createDocumentFragment(),e=document.createElement("span");a=e.style;e.className="ACM_graphUnit";a.width="5px";a.height="1%";a.marginRight="2px";a.padding=0;a.display="inline-block";a.backgroundColor="yellow";for(a=0;a<18;a++)g.unshift(c.appendChild(e.cloneNode(true)));b.appendChild(c)};d.do_next=function(b){var a=g.pop(),c=a.parentNode;g.unshift(a);c.removeChild(a);a.style.height=(b>=100?100:++b)+"%";c.appendChild(a)};d.do_test=function(){var b= g.length;setTimeout(function a(){this.do_next(~~(Math.random()*100));--b&&setTimeout(a,1E3)},1E3)};d.push=function(b,a){var c,e=0;c=0;for(var h=+bottomline,j=0;j<b.length;j++){var i=+b[j];if(i<bottomline)e+=h;else if(i>topline)e+=i;c+=i}c=c/100;c=e?e/c:0;c={p:c>100?100:c,r:e};e=c.r+f;if(e>a){c=~~(e/a);for(h=0;h<c;h++){this.do_next(100);e-=a}f=e}else{this.do_next(c.p);f=0}};d.collect=function(){timer.collect();collector.start(d)};d.stop=function(){timer.stop();collector.stop()};return d}():progress; collector=typeof collector=="undefined"?function(){var d,f={};f.start=function(g){if(d)debug("Collector already started");else d=setInterval(function(){var b=stack;if(b.length){stack=[];g.push(b,1E3)}},1E3)};f.stop=function(){if(d){clearInterval(d);d=null}};return f}():collector; var shiv=shiv||{};shiv._getIEDispatch=function(){var a=function(d){return a.fnc.call(a.node,d||window.event)};return a};shiv.connect=function(a,d,c){if(a.addEventListener)shiv.connect=function(f,b,e){b=/^on/.test(b)?b.substr(2):b;f.addEventListener(b,e,false);return[f,b,e]};else if(a.attachEvent)shiv.connect=function(f,b,e){b=/^on/.test(b)?b:"on"+b;var g=e;e=shiv._getIEDispatch();e.fnc=g;e.node=f;f.attachEvent(b,e);return[f,b,e]};return shiv.connect(a,d,c)}; shiv.disconnect=function(a){var d=a[0];if(d.removeEventListener)disconnect=function(c){c[0].removeEventListener(c[1],c[2],false)};else if(d.detachEvent)disconnect=function(c){c[0].detachEvent(c[1],c[2])};return disconnect(a)};shiv.apos=function(a){var d=0,c=0;a=a;do{d+=a.offsetLeft;c+=a.offsetTop}while((a=a.parentNode)!=null&&a.nodeName.toLowerCase()!="html");return{left:d,top:c}}; window.ACM_init=function(h){var c=shiv,f=document,b=f.createElement("div"),m=b.appendChild(f.createElement("div")),d=b.appendChild(f.createElement("div")),a=b.style,g=false,i=false;if(h)h.appendChild(b);else{f.body.appendChild(b);a.left="10px";a.top="10px";c.connect(b,"onmousedown",function(e){var n=e.clientX;e=e.clientY;var j=shiv.apos(b),o=n-j.left,p=e-j.top,r=c.connect(document,"onmousemove",function(k){var q=k.clientY,l=b.style;l.left=k.clientX-o+"px";l.top=q-p+"px"}),s=c.connect(document,"onmouseup", function(){c.disconnect(s);c.disconnect(r)})})}a.position="absolute";a=d.style;a.position="absolute";a.left="2px";a.top="2px";a.color="white";a.fontSize="10px";a.cursor="pointer";c.connect(d,"onclick",function e(){if(i){if(g){progress.stop();d.innerHTML="Start<br/>base:" +bottomline + "/" + topline}else{progress.collect();d.innerHTML="Stop<br/>base:" +bottomline + "/" + topline}g=!g}else{d.innerHTML="Calibrating";timer.callibrate(function(){i=true;e()})}});d.innerHTML="Click to Start";progress.build(m)}; })();


