jQuery(document).ready(function($){
 
  var slides1 = $.makeArray ($("#slideshow ul.top li"));
  var slides2 = $.makeArray ($("#slideshow ul.bottom li"));
  var real_w1 = 0;
  var real_w2 = 0;
  var scontenttop = $("#slideshow ul.top").html();
  var scontentbottom = $("#slideshow ul.bottom").html();
  for (x in slides1)
  {
    real_w1 = real_w1 + 10 + ($(slides1[x]).width());
  }
  $("#slideshow ul.top").width(real_w1);
  for (x in slides2)
  {
    real_w2 = real_w2 + 10 + ($(slides2[x]).width());
  }
  $("#slideshow ul.bottom").width(real_w2);
  
  tf = setInterval(move_top, 25)
  bf = setInterval(move_bottom, 25)
  
 $("#slideshow ul.top").hover(
    function () {clearInterval(tf);},
    function () {tf = setInterval(move_top,25);}
  );
  
  $("#slideshow ul.bottom").hover(
    function () {clearInterval(bf);},
    function () {bf = setInterval(move_bottom,25);}
  );
  
  function move_top () {
  
  ml = $("#slideshow ul.top").css('margin-left').split('px')[0] - 1;
  $("#slideshow ul.top").css('margin-left', ml+'px');
  if (ml == 840 - real_w1) $("#slideshow ul.top").width(real_w1 * 2).append(scontenttop);
  if (ml == - real_w1) $("#slideshow ul.top").width(real_w1).html(scontenttop).css('margin-left', '0px');; 
 }
 
 function move_bottom () {
  
  mr = $("#slideshow ul.bottom").css('margin-right').split('px')[0] - 1;
  $("#slideshow ul.bottom").css('margin-right', mr+'px');
  if (mr == 840 - real_w2) $("#slideshow ul.bottom").width(real_w2 * 2).append(scontentbottom);
  if (mr == - real_w2) $("#slideshow ul.bottom").width(real_w2).html(scontentbottom).css('margin-right', '0px');; 
 }

 });
 
 
 
