

     
 var Parent = document.getElementById("Parent");
           var ChildA = document.getElementById("Child_A");
           var parentWidth = 390;
           var count=2; 
           ChildA.innerHTML = ChildA.innerHTML + " " + ChildA.innerHTML;
           while (Parent.scrollWidth<=parentWidth)
            {    
              count *=2;
              ChildA.innerHTML = ChildA.innerHTML + " " + ChildA.innerHTML;
             }
            var speed=10;
             function Marquee()
             {
              if (ChildA.offsetWidth/count-Parent.scrollLeft<0)//NB Cacluate the optimal position
                {
                  Parent.scrollLeft -= ChildA.offsetWidth/count;
                }
              else
               {
                  Parent.scrollLeft++ 
				}
              }
             var MyMar=setInterval(Marquee,speed)
             Parent.onmouseover=function() {clearInterval(MyMar)}
             Parent.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
    