moving_step=1; // 1,2,5,10,11

top_movies_title=new Array();
top_movies_obj=new Array();
top_movies_pic=new Array();
bottom_movies_title=new Array();
bottom_movies_obj=new Array();
bottom_movies_pic=new Array();

top_all_m=0;
bottom_all_m=0;
top_counter_m=0;
bottom_counter_m=0;
top_global_counter=0;
bottom_global_counter=0;

function start_move() {
   top_sc=document.getElementById('top_subcontainer');
   bottom_sc=document.getElementById('bottom_subcontainer');

   beginning_top_offset=top_sc.offsetWidth;
   top_sc.style.left=(997-top_sc.offsetWidth)+'px';
   top_all_m=8;
   bottom_all_m=6;
   top_movies_title[0]='Рекламный ролик Бинго';
   top_movies_obj[0]='<OBJECT width="417" height="308"><PARAM name="movie" value="http://video.rutube.ru/7620a89af37badf9396480112cfb04b2"></PARAM><PARAM name="wmode" value="window"></PARAM><PARAM name="allowFullScreen" value="true"></PARAM><EMBED src="http://video.rutube.ru/7620a89af37badf9396480112cfb04b2" type="application/x-shockwave-flash" wmode="window" width="417" height="308" allowFullScreen="true" ></EMBED></OBJECT>';
   top_movies_pic[0]='plenka/rekl_01.jpg';
   top_movies_title[1]='Рекламный ролик Бинго';
   top_movies_obj[1]='<OBJECT width="417" height="308"><PARAM name="movie" value="http://video.rutube.ru/2adfd2f3096b1847db791556d0fbe636"></PARAM><PARAM name="wmode" value="window"></PARAM><PARAM name="allowFullScreen" value="true"></PARAM><EMBED src="http://video.rutube.ru/2adfd2f3096b1847db791556d0fbe636" type="application/x-shockwave-flash" wmode="window" width="417" height="308" allowFullScreen="true" ></EMBED></OBJECT>';
   top_movies_pic[1]='plenka/rekl_02.jpg';
   top_movies_title[2]='Рекламный ролик Бинго';
   top_movies_obj[2]='<OBJECT width="417" height="308"><PARAM name="movie" value="http://video.rutube.ru/97519ed82aa1461736c12b1ee15b797e"></PARAM><PARAM name="wmode" value="window"></PARAM><PARAM name="allowFullScreen" value="true"></PARAM><EMBED src="http://video.rutube.ru/97519ed82aa1461736c12b1ee15b797e" type="application/x-shockwave-flash" wmode="window" width="417" height="308" allowFullScreen="true" ></EMBED></OBJECT>';
   top_movies_pic[2]='plenka/rekl_03.jpg';
   top_movies_title[3]='Рекламный ролик Бинго';
   top_movies_obj[3]='<OBJECT width="417" height="308"><PARAM name="movie" value="http://video.rutube.ru/5cc7ef467027eb07cf9bb1e5adae95b0"></PARAM><PARAM name="wmode" value="window"></PARAM><PARAM name="allowFullScreen" value="true"></PARAM><EMBED src="http://video.rutube.ru/5cc7ef467027eb07cf9bb1e5adae95b0" type="application/x-shockwave-flash" wmode="window" width="417" height="308" allowFullScreen="true" ></EMBED></OBJECT>';
   top_movies_pic[3]='plenka/rekl_04.jpg';
   top_movies_title[4]='Рекламный ролик Бинго';
   top_movies_obj[4]='<OBJECT width="417" height="308"><PARAM name="movie" value="http://video.rutube.ru/141881ef80b3e8b70f00db11553f7314"></PARAM><PARAM name="wmode" value="window"></PARAM><PARAM name="allowFullScreen" value="true"></PARAM><EMBED src="http://video.rutube.ru/141881ef80b3e8b70f00db11553f7314" type="application/x-shockwave-flash" wmode="window" width="417" height="308" allowFullScreen="true" ></EMBED></OBJECT>';
   top_movies_pic[4]='plenka/rekl_05.jpg';
   top_movies_title[5]='Рекламный ролик Бинго';
   top_movies_obj[5]='<OBJECT width="417" height="308"><PARAM name="movie" value="http://video.rutube.ru/45146d737a13d2a6c3f773eb6d365178"></PARAM><PARAM name="wmode" value="window"></PARAM><PARAM name="allowFullScreen" value="true"></PARAM><EMBED src="http://video.rutube.ru/45146d737a13d2a6c3f773eb6d365178" type="application/x-shockwave-flash" wmode="window" width="417" height="308" allowFullScreen="true" ></EMBED></OBJECT>';
   top_movies_pic[5]='plenka/rekl_06.jpg';
   top_movies_title[6]='Рекламный ролик Бинго';
   top_movies_obj[6]='<OBJECT width="417" height="308"><PARAM name="movie" value="http://video.rutube.ru/773006a629dedcbd8c7e286a91cc2adb"></PARAM><PARAM name="wmode" value="window"></PARAM><PARAM name="allowFullScreen" value="true"></PARAM><EMBED src="http://video.rutube.ru/773006a629dedcbd8c7e286a91cc2adb" type="application/x-shockwave-flash" wmode="window" width="417" height="308" allowFullScreen="true" ></EMBED></OBJECT>';
   top_movies_pic[6]='plenka/rekl_07.jpg';
   top_movies_title[7]='Рекламный ролик Бинго';
   top_movies_obj[7]='<OBJECT width="417" height="308"><PARAM name="movie" value="http://video.rutube.ru/5274f6036acbc399905fc0acedd7dc7c"></PARAM><PARAM name="wmode" value="window"></PARAM><PARAM name="allowFullScreen" value="true"></PARAM><EMBED src="http://video.rutube.ru/5274f6036acbc399905fc0acedd7dc7c" type="application/x-shockwave-flash" wmode="window" width="417" height="308" allowFullScreen="true" ></EMBED></OBJECT>';
   top_movies_pic[7]='plenka/rekl_08.jpg';


   bottom_movies_title[0]='Лотерея Бинго 1-ый тираж';
   bottom_movies_obj[0]='<OBJECT width="417" height="308"><PARAM name="movie" value="http://video.rutube.ru/50af3aa3bcaa7c6ee9e2b64d61ca2a27"></PARAM><PARAM name="wmode" value="window"></PARAM><PARAM name="allowFullScreen" value="true"></PARAM><EMBED src="http://video.rutube.ru/50af3aa3bcaa7c6ee9e2b64d61ca2a27" type="application/x-shockwave-flash" wmode="window" width="417" height="308" allowFullScreen="true" ></EMBED></OBJECT>';
   bottom_movies_pic[0]='plenka/0001_round.jpg';
   bottom_movies_title[1]='Лотерея Бинго 6-ой тираж';
   bottom_movies_obj[1]='<OBJECT width="417" height="308"><PARAM name="movie" value="http://video.rutube.ru/496bef2ec4333ea4e0f30987be77b1cc"></PARAM><PARAM name="wmode" value="window"></PARAM><PARAM name="allowFullScreen" value="true"></PARAM><EMBED src="http://video.rutube.ru/496bef2ec4333ea4e0f30987be77b1cc" type="application/x-shockwave-flash" wmode="window" width="417" height="308" allowFullScreen="true" ></EMBED></OBJECT>';
   bottom_movies_pic[1]='plenka/0006_round.jpg';
   bottom_movies_title[2]='Лотерея Бинго 181-ый тираж';
   bottom_movies_obj[2]='<OBJECT width="417" height="308"><PARAM name="movie" value="http://video.rutube.ru/0abfb5239cbe2934c0bb72a5d391657c"></PARAM><PARAM name="wmode" value="window"></PARAM><PARAM name="allowFullScreen" value="true"></PARAM><EMBED src="http://video.rutube.ru/0abfb5239cbe2934c0bb72a5d391657c" type="application/x-shockwave-flash" wmode="window" width="417" height="308" allowFullScreen="true" ></EMBED></OBJECT>';
   bottom_movies_pic[2]='plenka/0181_round.jpg';
   bottom_movies_title[3]='Лотерея Бинго 235-ый тираж';
   bottom_movies_obj[3]='<OBJECT width="417" height="308"><PARAM name="movie" value="http://video.rutube.ru/83fc6da8cb157a25d1d8da8d20000939"></PARAM><PARAM name="wmode" value="window"></PARAM><PARAM name="allowFullScreen" value="true"></PARAM><EMBED src="http://video.rutube.ru/83fc6da8cb157a25d1d8da8d20000939" type="application/x-shockwave-flash" wmode="window" width="417" height="308" allowFullScreen="true" ></EMBED></OBJECT>';
   bottom_movies_pic[3]='plenka/0235_round.jpg';
   bottom_movies_title[4]='Лотерея Бинго 280-ый тираж';
   bottom_movies_obj[4]='<OBJECT width="417" height="308"><PARAM name="movie" value="http://video.rutube.ru/7f8b5b79dcde7bf812614afb0bee68d8"></PARAM><PARAM name="wmode" value="window"></PARAM><PARAM name="allowFullScreen" value="true"></PARAM><EMBED src="http://video.rutube.ru/7f8b5b79dcde7bf812614afb0bee68d8" type="application/x-shockwave-flash" wmode="window" width="417" height="308" allowFullScreen="true" ></EMBED></OBJECT>';
   bottom_movies_pic[4]='plenka/0280_round.jpg';
   bottom_movies_title[5]='Лотерея Бинго 343-ий тираж';
   bottom_movies_obj[5]='<OBJECT width="417" height="308"><PARAM name="movie" value="http://video.rutube.ru/18965792652236c77d9a03c5684783a7"></PARAM><PARAM name="wmode" value="window"></PARAM><PARAM name="allowFullScreen" value="true"></PARAM><EMBED src="http://video.rutube.ru/18965792652236c77d9a03c5684783a7" type="application/x-shockwave-flash" wmode="window" width="417" height="308" allowFullScreen="true" ></EMBED></OBJECT>';
   bottom_movies_pic[5]='plenka/0343_round.jpg';


  for (i=0;i<10;i++)
   {
      create_new_img(top_counter_m,top_global_counter,top_sc,0);
      create_new_img(bottom_counter_m,bottom_global_counter,bottom_sc,1);
      top_global_counter++;
      top_counter_m++;
      if (top_counter_m==top_all_m) top_counter_m=0;
      bottom_global_counter++;
      bottom_counter_m++;
      if (bottom_counter_m==bottom_all_m) bottom_counter_m=0;
   }
 top_move_plenka=setInterval(top_moving,40);
 bottom_move_plenka=setInterval(bottom_moving,40);
}

function create_new_img(counter_m,global_counter,sc,tb)
{
      im=document.createElement('img');
      im.setAttribute('id','im_'+tb+'_'+global_counter);
      sc.appendChild(im);
      document.getElementById('im_'+tb+'_'+global_counter).style.position="absolute";
      document.getElementById('im_'+tb+'_'+global_counter).style.top="20px";
      document.getElementById('im_'+tb+'_'+global_counter).style.width="80px";
      document.getElementById('im_'+tb+'_'+global_counter).style.height="60px";
      if (tb==0) {
          document.getElementById('im_'+tb+'_'+global_counter).src=top_movies_pic[counter_m];
          document.getElementById('im_'+tb+'_'+global_counter).title=top_movies_title[counter_m];
          document.getElementById('im_'+tb+'_'+global_counter).style.left=(sc.offsetWidth-global_counter*110-90)+'px';
          document.getElementById('im_'+tb+'_'+global_counter).onmouseover=function() {
            this.style.left=(this.offsetLeft-10)+'px';
            this.style.top='12px';
            this.style.width='100px'
            this.style.height='75px'
            if (top_move_plenka!=-2) { clearInterval(top_move_plenka); top_move_plenka=-1; }
          };
          document.getElementById('im_'+tb+'_'+global_counter).onmouseout=function() {
            this.style.left=(this.offsetLeft+10)+'px';
            this.style.top='20px';
            this.style.width='80px'
            this.style.height='60px'
            if (top_move_plenka==-1) top_move_plenka=setInterval(top_moving,40);
          };
          document.getElementById('im_'+tb+'_'+global_counter).onclick=function() {
            var h1=top_movies_title[counter_m].split(",");
            document.getElementById('cnt2').innerHTML="<h1>"+h1[0]+"</h1><br><div class=telek><div class=telek_ekran>"+top_movies_obj[counter_m]+"</div></div>";
          };
      } else {
          document.getElementById('im_'+tb+'_'+global_counter).src=bottom_movies_pic[counter_m];
          document.getElementById('im_'+tb+'_'+global_counter).title=bottom_movies_title[counter_m];
          document.getElementById('im_'+tb+'_'+global_counter).style.left=(global_counter*110+10)+'px';
          document.getElementById('im_'+tb+'_'+global_counter).onmouseover=function() {
            this.style.left=(this.offsetLeft-10)+'px';
            this.style.top='12px';
            this.style.width='100px'
            this.style.height='75px'
            if (bottom_move_plenka!=-2) { clearInterval(bottom_move_plenka); bottom_move_plenka=-1; }
          };
          document.getElementById('im_'+tb+'_'+global_counter).onmouseout=function() {
            this.style.left=(this.offsetLeft+10)+'px';
            this.style.top='20px';
            this.style.width='80px'
            this.style.height='60px'
            if (bottom_move_plenka==-1) bottom_move_plenka=setInterval(bottom_moving,40);
          };
          document.getElementById('im_'+tb+'_'+global_counter).onclick=function() {
            var h1=bottom_movies_title[counter_m].split(",");
            document.getElementById('cnt2').innerHTML="<a name=rolik><h1>"+h1[0]+"</h1><br><div class=telek><div class=telek_ekran>"+bottom_movies_obj[counter_m]+"</div></div>";
            document.location="#rolik";
          };
      }
}


function isInteger(s)
{
    var i;
	s = s.toString();
      for (i = 0; i < s.length; i++)
      {
         var c = s.charAt(i);
         if (isNaN(c))
	   {
		return false;
	   }
      }
      return true;
}

function bottom_moving()
{
  if (bottom_sc.offsetLeft<-(bottom_sc.offsetWidth-1000-2*moving_step)) { clearInterval(bottom_move_plenka); bottom_move_plenka=-2; }
  bottom_sc.style.left=(bottom_sc.offsetLeft-moving_step)+'px';
  if (isInteger(-bottom_sc.offsetLeft/110)) {
      bottom_sc.removeChild(document.getElementById('im_1_'+(bottom_global_counter-10)));
      create_new_img(bottom_counter_m,bottom_global_counter,bottom_sc,1);
      bottom_global_counter++;
      bottom_counter_m++;
      if (bottom_counter_m==bottom_all_m) bottom_counter_m=0;
  }
}

function top_moving()
{
  if (top_sc.offsetLeft>-10) { clearInterval(top_move_plenka); top_move_plenka=-2; }
  top_sc.style.left=(top_sc.offsetLeft+moving_step)+'px';
  if (isInteger((top_sc.offsetWidth-997+top_sc.offsetLeft)/110)) {      top_sc.removeChild(document.getElementById('im_0_'+(top_global_counter-10)));
      create_new_img(top_counter_m,top_global_counter,top_sc,0);
      top_global_counter++;
      top_counter_m++;
      if (top_counter_m==top_all_m) top_counter_m=0;
  }
}
