var dom=YAHOO.util.Dom;var move={v:{gallery_id:"gallery",stop:false,mouseX:null,mitte:null,vpwidth:null,timeout:100,_timeoutId:null,movetimeout:null,anim:null,attrLeft:0,rightborder:null},init:function(){move.v.vpwidth=dom.getViewportWidth();move.v.mitte=move.v.vpwidth/2;move.v.movetimeout=move.v.timeout/1000;move.v.rightborder=-(move.sumLis()-move.v.vpwidth);YAHOO.util.Event.addListener("gallery_mousein","mousemove",move.setMouseX);YAHOO.util.Event.addListener("gallery_mousein","mousedown",move.stop);YAHOO.util.Event.addListener("gallery_mousein","click",move.stop);move.slideshow()},sumLis:function(){var B=dom.getChildren(move.v.gallery_id);var A=parseInt(dom.getStyle(B[0],"margin-right"));var D=-A;for(var C=0;C<B.length;C++){D+=dom.getRegion(B[C]).width+A}return D},setMouseX:function(A){move.v.mouseX=YAHOO.util.Event.getPageX(A);move.v.stop=false;clearTimeout(move.v._timeoutId);move.v._timeoutId=setTimeout(move._process,move.v.timeout)},_process:function(){var C=(move.v.mitte-move.v.mouseX)/move.v.vpwidth;var A=3*C;var D=parseInt(Math.tan(A)*10);var B=10;move.v.attrLeft=parseInt(dom.getStyle(move.v.gallery_id,"left"));if(D<0){B=(move.v.rightborder-move.v.attrLeft)/D}else{B=Math.abs(move.v.attrLeft)/D}if(move.v.anim!=null){move.v.anim.stop(false)}move.v.anim=new YAHOO.util.Anim(move.v.gallery_id,{left:{by:D*B}},move.v.movetimeout*B);move.v.anim.onTween.subscribe(function(){move.v.attrLeft=this.getAttribute("left");if((move.v.attrLeft>0&&D>0)||(move.v.attrLeft<move.v.rightborder&&D<0)){move.stop()}});move.v.attrLeft=parseInt(dom.getStyle(move.v.gallery_id,"left"));if((move.v.attrLeft>=0&&D>0)||(move.v.attrLeft<=move.v.rightborder&&D<0)){move.stop()}if(!move.v.stop){move.v.anim.animate()}},stop:function(){if(move.v.anim==null){return }move.v.stop=true;move.v.anim.stop(false)},rewind:function(){if(move.v.attrLeft>0){move.v.anim=new YAHOO.util.Anim(move.v.gallery_id,{left:{to:0}},move.v.movetimeout,YAHOO.util.Easing.easeBoth);move.v.anim.animate()}if(move.v.attrLeft<move.v.rightborder){move.v.anim=new YAHOO.util.Anim(move.v.gallery_id,{left:{to:move.v.rightborder}},move.v.movetimeout,YAHOO.util.Easing.easeBoth);move.v.anim.animate()}},toImg:function(){var B=location.pathname;var A=B.match(/\/\d+\//);if(A==null){return false}A=A[A.length-1];A=A.replace(/\//g,"");var C=dom.getX(A)-5;(new YAHOO.util.Anim(move.v.gallery_id,{left:{to:-C}},move.v.movetimeout,YAHOO.util.Easing.easeOut)).animate()},slideshow:function(){move.v.mouseX=0.205*move.v.vpwidth-move.v.mitte;move._process()}};YAHOO.util.Event.onDOMReady(function(){if(YAHOO.env.ua.webkit>0){YAHOO.util.Event.onContentReady(move.v.gallery_id,move.init)}else{if(dom.get("bild4")!=null){YAHOO.util.Event.onAvailable("bild4",move.init);YAHOO.util.Event.onContentReady(move.v.gallery_id,move.init)}else{YAHOO.util.Event.on(window,"load",move.init)}}});YAHOO.util.Event.on(window,"resize",function(){clearTimeout(move.v._timeoutId);move.v._timeoutId=setTimeout(move.init,500)});