/*(C) Andrea Giammarchi*/(function(d,e){function h(m){function q(){k.removeChild(s);s=i=null;m.interval=0;m.callee=m.pause=m.play=null;if(m.callback){m.callback(m)}}var k=m.target.appendChild(m.document.createElement("div")),j=k.cloneNode(true),l=this.width,v=this.height,s=this,w=k.style,t=j.style,i=s.style,p=m.scale||2000,o=m.speed||10,n,u,r;g(w,t,i);f(w,t);a(t,i);w.position="relative";w.width=l+"px";w.height=v+"px";w.overflow="hidden";i.zIndex=1;t.zIndex=2;p/=100;switch(m.direction){case"top":t.height=0+"px";t.width=l+"px";i.top=(u=v)+"px";s.setAttribute("width",l);s.setAttribute("height",d(p*v));n=0;p=o/p;m.interval=setTimeout(m.callee=function(){if(n<v){u-=o;i.top=d(u+n)+"px";if(u<0){t.height=d(n+=p)+"px"}m.interval=setTimeout(m.callee,15)}else{q()}},15);break;case"bottom":t.height=0+"px";t.width=l+"px";t.top=v+"px";i.top=(u=-d(p*v))+"px";s.setAttribute("width",l);s.setAttribute("height",-u);l=-d(p*v-v);n=0;p=o/p;m.interval=setTimeout(m.callee=function(){if(n<v){u+=o;i.top=d(u-n)+"px";if(l<u){t.height=(r=d(n+=p))+"px";t.top=(v-r)+"px"}m.interval=setTimeout(m.callee,15)}else{q()}},15);break;case"right":t.width=0+"px";t.left=l+"px";t.height=v+"px";i.left=(n=-d(p*l))+"px";s.setAttribute("width",-n);s.setAttribute("height",v);v=-d(p*l-l);u=0;p=o/p;m.interval=setTimeout(m.callee=function(){if(u<l){n+=o;i.left=d(n-u)+"px";if(v<n){t.width=(r=d(u+=p))+"px";t.left=(l-r)+"px"}m.interval=setTimeout(m.callee,15)}else{q()}},15);break;default:t.width=0+"px";i.top="0px";t.height=v+"px";i.left=(n=l)+"px";s.setAttribute("width",d(p*l));s.setAttribute("height",v);u=0;p=o/p;m.interval=setTimeout(m.callee=function(){if(u<l){n-=o;i.left=d(n+u)+"px";if(n<=0){t.width=d(u+=p)+"px"}m.interval=setTimeout(m.callee,15)}else{q()}},15);break}t.background=(m.background||"transparent")+" url("+m.src+") no-repeat "+(m.direction||"left");k.appendChild(s);k.appendChild(j)}function b(m){function q(){l.parentNode.removeChild(l);l.removeChild(s);l.removeChild(j);l=j=s=w=t=i=null;m.interval=0;m.callee=m.pause=m.play=null;if(m.callback){m.callback(m)}}var j=m.target.getElementsByTagName("div"),l=j[0],j=j[1],s=m.document.createElement("img"),w=l.style,t=j.style,i=s.style,k=parseInt(w.width,10),v=parseInt(w.height,10),p=m.scale||2000,o=m.speed||10,n,u,r;a(i);g(i);i.zIndex=1;t.backgroundPosition=m.direction||"left";p/=100;s.onload=function(){switch(m.direction){case"top":s.setAttribute("width",k);s.setAttribute("height",k=d(p*v));i.top=(u=-k+v)+"px";n=0;p=o/p;m.interval=setTimeout(m.callee=function(){if(u+n<v){u+=o;i.top=d(u+n)+"px";if(-v<(r=d(n-=p))){t.height=(v+r)+"px"}m.interval=setTimeout(m.callee,15)}else{q()}},15);break;case"bottom":s.setAttribute("width",k);s.setAttribute("height",k=d(p*v));k+=n=v;u=0;p=o/p;m.interval=setTimeout(m.callee=function(){if(-u<k){u-=o;i.top=d(u+(v-n))+"px";t.top=(v-(r=d(n-=p)))+"px";if(0<r){t.height=r+"px"}m.interval=setTimeout(m.callee,15)}else{q()}},15);break;case"right":s.setAttribute("height",v);s.setAttribute("width",v=d(p*k));n=u=0;p=o/p;m.interval=setTimeout(m.callee=function(){if(-n-u<v){i.left=d((n-=o)+u)+"px";if((r=d(u+=p))<k){t.width=(k-r)+"px";t.left=r+"px"}m.interval=setTimeout(m.callee,15)}else{q()}},15);break;default:s.setAttribute("height",v);s.setAttribute("width",n=d(p*k));i.left=(n=-(n-k))+"px";u=0;p=o/p;m.interval=setTimeout(m.callee=function(){if(n-u<k){i.left=d((n+=o)-u)+"px";r=d(u+=p);if(r<k){t.width=(k-r)+"px"}m.interval=setTimeout(m.callee,15)}else{q()}},15);break}};l.insertBefore(s,j);s.src=m.src}function g(){for(var j=0,k=arguments.length;j<k;++j){arguments[j].padding=arguments[j].margin=arguments[j].border="0px"}}function f(){for(var j=0,k=arguments.length;j<k;++j){arguments[j].fontSize=arguments[j].lineHeight="0px";arguments[j].textAlign="left"}}function a(){for(var j=0,k=arguments.length;j<k;++j){arguments[j].top=arguments[j].left="0px";arguments[j].position="absolute"}}function c(j){if(j.reverse){b(j)}else{var i=(j.document||(j.document=document)).createElement("img");i.onload=function(){i.removeAttribute("onload");if(j.onload){j.onload(i)}h.call(i,j)};i.src=j.src;j.pause=function(){clearTimeout(j.interval)};j.play=function(){j.interval=setTimeout(j.callee,15)}}return j}e.Liquid=c})(Math.round,window);
