var ScrollProduct_Inteval=new Array();var ScrollProduct_Lock=new Array();var ScrollProduct_RegisteredCnt=0;function ScrollProduct_Register(c,a,b,i){ScrollProduct_Lock[c]=false;ScrollProduct_RegisteredCnt++;Event.observe($("scroller_left"+c),"click",function(d){if(ScrollProduct_Inteval[c]!=-1 && ScrollProduct_Inteval[c]!=null){clearInterval(ScrollProduct_Inteval[c]);ScrollProduct_Inteval[c]=null}if(ScrollProduct_Lock[c]!=true){ScrollProduct_MoveLeft(c,a,b)}if(ScrollProduct_Inteval[c]!=-1){ScrollProduct_SetInterval(c,a,b)}});Event.observe($("scroller_right"+c),"click",function(d){if(ScrollProduct_Inteval[c]!=-1 && ScrollProduct_Inteval[c]!=null){clearInterval(ScrollProduct_Inteval[c]);ScrollProduct_Inteval[c]=null}if(ScrollProduct_Lock[c]!=true){ScrollProduct_MoveRight(c,a,b)}if(ScrollProduct_Inteval[c]!=-1){ScrollProduct_SetInterval(c,a,b)}});$("scroller"+c).select("a").each(function(d){Event.observe(d,"mouseover",function(e){ScrollProduct_Lock[c]=true});Event.observe(d,"mouseout",function(e){ScrollProduct_Lock[c]=false})});if(i != false){setTimeout(function(d){ScrollProduct_SetInterval(c,a,b)},ScrollProduct_RegisteredCnt*1000)}else{ScrollProduct_Inteval[c]=-1}}function ScrollProduct_SetInterval(c,a,b){ScrollProduct_Inteval[c]=setInterval(function(){if(ScrollProduct_Lock[c]!=true){ScrollProduct_MoveRight(c,a,b)}},6000)}function ScrollProduct_MoveRight(h,a,d){try{ScrollProduct_Lock[h]=true;var g=$("scroller"+h).childElements();if(a<g.length){if(a*2>g.length){a=g.length-a}for(var c=0;c<g.length;c+=a){for(var b=0;b<a&&c+b<g.length;b++){if(c==0){g[c+b].addClassName("goToBottom")}}}new Effect.Move($("scroller"+h),{x:-1*a*d,y:0,afterFinish:function(e){for(var j=0;j<g.length;j++){if(g[j].hasClassName("goToBottom")){$("scroller"+h).appendChild(g[j].remove());g[j].removeClassName("goToBottom")}}e.element.style.left="0px";ScrollProduct_Lock[h]=false}})}else{ScrollProduct_Lock[h]=false}}catch(f){}}function ScrollProduct_MoveLeft(h,a,d){ScrollProduct_Lock[h]=true;var g=$("scroller"+h).childElements();if(a<g.length){if(a*2>g.length){a=g.length-a}for(var c=g.length-1;c>=0;c-=a){for(var b=0;b<a&&c-b>0;b++){if(c==g.length-1){g[c-b].addClassName("goToTop")}}}$("scroller"+h).style.left=(-1*a*d)+"px";for(var c=0;c<g.length;c++){if(g[c].hasClassName("goToTop")){try{$("scroller"+h).insertBefore(g[c].remove(),g[0])}catch(f){$("scroller"+h).insertBefore(g[c].remove(),0)}g[c].removeClassName("goToTop")}}new Effect.Move($("scroller"+h),{x:a*d,y:0,afterFinish:function(e){e.element.style.left="0px";ScrollProduct_Lock[h]=false}})}else{ScrollProduct_Lock[h]=false}};
