// Image Scroller (#include suilib_lite.js)
// Created in Shogo.Ru
var iscroller={defaults:function(){var F=$(suilib.body).filter("*","scroller_l",null,true),G=$(suilib.body).filter("*","scroller_r",null,true),E=$(suilib.body).filter("*","scroller",null,true),A=[],D={animate:true,actions:function(I,H){$(I).setstyle("opacity:"+(H?100:35)+";cursor:"+(H?"pointer":"default"))}};for(var B=0;B<E.length;B++){var C={};C.arrows=[];C.arrows[0]=F[B];C.arrows[1]=G[B];C.object=E[B];C.animate=D.animate;C.actions=D.actions;A.push(C)}return A},interval:null,checker:false,global:[],init:function(){var M=this,J=!(typeof arguments[0]=="object"&&arguments[0].length)?arguments:arguments[0];if(!arguments.callee.gs){arguments.callee.gs={}}if(!arguments.callee.ungs){arguments.callee.ungs={}}var L=function(O,Q,R,T,S,P,N){return function(V){var U=function(){O.goScroll(V,Q,R,T,S.iw,S.fw,S.step,P,N)};U();iscroller.interval=setInterval(U,P?0:150)}};for(var G=0;G<J.length;G++){if(!J[G].arrows||!J[G].object){continue}var K=$(J[G].arrows[0]),F=$(J[G].arrows[1]),A=$(J[G].object),E=J[G].animate,I=J[G].actions;M.global.push(J[G]);var D=M.getWidths(A),C=L(M,K,F,A,D,E,I),H=function(){clearInterval(iscroller.interval);iscroller.interval=null};var B=D.iw<=D.fw;if(B){K.setstyle("visibility:hidden");F.setstyle("visibility:hidden");continue}$(A).style.left=0;I(K,false);I(F,!(B));if(arguments.callee.gs[G]){arguments.callee.gs[G].$$("mousedown",K,F)}if(arguments.callee.ungs[G]){arguments.callee.ungs[G].$$("mouseup",K,F).$$("mouseout",K,F)}C.$("mousedown",K,F);H.$("mouseup",K,F).$("mouseout",K,F);arguments.callee.gs[G]=C;arguments.callee.ungs[G]=H}},getWidths:function(E){var D=$(E).filter("*","scroller_item",null,true),A=0;for(var B=0;B<D.length;B++){A+=D[B].offsetWidth}var C=(D.length>1)?$(D[1]).offset(true)[0]-$(D[0]).offset(true)[0]:0;return{images:D,iw:A,step:C,fw:(suilib.client.msie?$(E).parentNode.offsetWidth:$(E).offsetWidth)}},goScroll:function(G,L,E,A,H,J,C,B,D){if(this.checker){return false}G.returnValue=false;if(G.preventDefault){G.preventDefault()}var I=parseInt($(A).style.left,10);var F=!!((G.target||G.srcElement)===L);if(F?(I>=0):(H+I<=J)){return false}var C=F?I+C:I-C;this.checker=true;var K=function(){D(F?E:L,true);if(F?(C>=0):(H+C<=J)){D(L,!F);D(E,F)}iscroller.checker=false};if(B){if("jTweener" in window){$(A).tweener({left:C,time:0.3,transition:"easeNone",onComplete:K}).tween()}else{$(A).animate(0.5,{left:[I,C]},K)}}else{$(A).style.left=C+"px";K()}},goToImage:function(I,K){var C=this.getWidths(I),B=parseInt($(I).style.left,10);for(var H=0;H<C.images.length;H++){if(C.images[H].id==K){var D=-(H*C.step)}}while(C.iw+D<=(C.fw-C.step)){D=D+C.step}for(var F=0;F<this.global.length;F++){if(this.global[F].object===$(I)){var L=$(this.global[F].arrows[0]),G=$(this.global[F].arrows[1]),A=this.global[F].animate,E=this.global[F].actions}}var J=function(){if(D>=0){E(L,false);E(G,true)}if(C.iw+D<=C.fw){E(L,true);E(G,false)}};if(A){if("jTweener" in window){$(I).tweener({left:D,onComplete:J}).tween()}else{$(I).animate(0.4,{left:[B,D]},J)}}else{$(I).style.left=D+"px";J()}}};(function(){var A=function(){iscroller.init(iscroller.defaults())};if(suilib.client.safari){A.$("load",window)}else{suilib.ready(A)}})();
