
var sliderInterval;
$.moveSlider = function (toPage,speed){   
   clearInterval(sliderInterval);
   newpx = (toPage*978)-978;
   newpxstr = newpx.toString()+'px';
   anim = {'right' : newpxstr}
   $('.bannerimgs').animate(anim,speed,'swing',function(){
       $.startSlider();
   });
}
$.startSlider = function(){
    clearInterval(sliderInterval);
    sliderInterval = setInterval(function(){
        lastKey     = $('.slide:first').html();
        currentKey  = $('.slide.active').html();

        $('.slide').removeClass('active');
        if(currentKey==lastKey)
            currentKey = 1;
        else
            currentKey = parseInt(currentKey)+1;
         $('.slide').each(function(i,e){
             if($(e).html() == currentKey){
                 $(e).addClass('active');
                 $('#banneroverlaylink').attr('href',$(e).attr('href'));
             }
         });
        $.moveSlider(currentKey,800);
    },5000);
}

$(document).ready(function(){
    if($.browser.msie && $.browser.version=="6.0"){        
        $('#banneroverlay').remove();
    }    
    $('.specialsphoto').click(function(e){
       window.location = root+'/product/181/+Dell+adapter+PA-3E++PA-10+90W+Slimline.html';
    });

    $('.slide').click(function(e){
        $('#banneroverlaylink').attr('href',$(this).attr('href'));        
       clearInterval(sliderInterval);
       setTimeout(function(){
           $.startSlider();
       },10000);
       e.preventDefault();
       
       $.moveSlider(parseInt($(this).html()),1200);
       $('.slide').removeClass('active');       
       $(this).addClass('active');           
    });
   $.startSlider();   
});



