var prod_length;
var prod_count;
var prod_current;
var prod_direction;
var product_inteval;

$(document).ready(function(){
  // latest news shadow
  $('.homeNewsList').dropShadow({left: 4, top: 4});
  
  // products scroller
  prod_count = $('div.productScroller > a').size();
  prod_length = 116 * prod_count;
  prod_current = 0;
  prod_direction = -1;

  product_inteval = setInterval(product_rotate,5000); 
  $('.productSliceShow').hover(
    function(){clearInterval(product_inteval);},
    function(){
      product_inteval = setInterval(product_rotate,5000);
      product_rotate();
    });
    
  $('.productScroller img').hover(
    function(){$(this).addClass("on");},
    function(){$(this).removeClass("on");}
    );
});

function product_rotate() {
  prod_current = (prod_direction < 0) ? prod_current+1 : prod_current-1;
  if(prod_current % (prod_count-4) == 0) prod_direction *= -1;
  $('div.productScroller')
    .animate({left: -prod_current*118},2000);
}     
