
function Scroll(idBox,idText,boxWidth){this.scrollboxid=idBox;this.scrolltextid=idText;this.msgWidth=0;this.bannerWidth=boxWidth;this.doscroll=false;this.timerID=null;this.xScrollPos=0;this.dx=4;this.msDelay=150;}
Scroll.prototype.initScroll=function(width){this.msgWidth=width;var el=document.getElementById(this.scrollboxid);if(width>this.bannerWidth){document.getElementById(this.scrolltextid).style.left=this.bannerWidth+"px";this.doscroll=true;}else{document.getElementById(this.scrolltextid).style.left="-6px";this.doscroll=false;}
el=document.getElementById(this.scrolltextid);}
Scroll.prototype.scroll=function(type){var self=this;if(type=='start'){if(this.doscroll){this.xScrollPos=this.bannerWidth;var text=document.getElementById(this.scrolltextid);text.style.left=this.xScrollPos+"px";this.timerID=setTimeout(function(){self.loop();},this.msDelay);}}else
if(this.timerID!=null){clearTimeout(this.timerID);this.timerID=null;}}
Scroll.prototype.clearText=function(){this.scroll('stop');var el=document.getElementById(this.scrolltextid);el.style.left=this.bannerWidth+"px";}
Scroll.prototype.loop=function(){var text=document.getElementById(this.scrolltextid);this.xScrollPos-=this.dx;text.style.left=this.xScrollPos+"px";if(this.xScrollPos<-this.msgWidth){this.xScrollPos=this.bannerWidth;}
var self=this;this.timerID=setTimeout(function(){self.loop();},this.msDelay);}