/* <![CDATA[ */
    var images;
    var padding = 0; 
    var t_width = 106;
    
    var firstIndex = 0;
    var numberShown = 4;
    
    var marginBetween = 5;
    
    var autoscrollTimeout = 2;
    var autoscrollDirection = 1;
    var autoscrollIntervalID = null;
    
    var bigdiv;
    
    function svcThumbsInit(){
        images = $('#inlineThumbs > img');     
        bigdiv = $('#inlineThumbs');
        $(bigdiv).animate({marginLeft: 0},1000);
    }
    
    function svcThumbsNav(direction){
        var animatedTo = -1;                                              
        if(direction == -1){
            if(firstIndex > 0){ 
                // PREVIOUS  slide right
                var animatedTo = 0 - (firstIndex-1)*(t_width+marginBetween);
                firstIndex--;
            }          
        }
        else{
            if(firstIndex < images.length - numberShown){            
                // NEXT slide left <<<  
                var animatedTo = 0 - (firstIndex+1)*(t_width+marginBetween);
                firstIndex++;     
            }
        }
        if(animatedTo != -1) {$(bigdiv).animate({marginLeft: animatedTo},500);}
    }
    
    function autoscroll(){
        beforeIndex = firstIndex; 
        svcThumbsNav(autoscrollDirection);
        if(beforeIndex == firstIndex){
            autoscrollDirection = autoscrollDirection * -1;
        }                                                 
    }
    
    $(document).ready(function(){
        svcThumbsInit();
        
        autoscrollIntervalID = setInterval(autoscroll,autoscrollTimeout*1000);
        
        $('#scroller').mouseenter(function(){clearInterval(autoscrollIntervalID);});
        $('#scroller').mouseleave(function(){autoscrollIntervalID = setInterval(autoscroll,autoscrollTimeout*1000);});
    });
/* ]]> */
