$(function() {

    var $allPhotos = $("#product_slider_widget-3 .all-photos"),
        $origPhotoSet = $allPhotos.find("a");
        numPhotos = $origPhotoSet.length,
        oneWidth = $origPhotoSet.width(),
        oneMargin = parseInt($origPhotoSet.css("margin-right")),
        blockWidth = (oneWidth * numPhotos) + (oneMargin * numPhotos);
            
    function movePhotosLeft(first) {
    
        $origPhotoSet.clone().appendTo("#product_slider_widget-3 .all-photos");
        
        $allPhotos.animate({
            right: blockWidth
        }, 72000, "linear", function() {
        
            $allPhotos.css("right", 0);
            $("#product_slider_widget-3 .all-photos a:lt("+numPhotos+")").remove();
            movePhotosLeft(); 
        
        });
    
    };
    
    movePhotosLeft(true);
    
    var $allPhotos2 = $("#product_slider_widget-4 .all-photos"),
        $origPhotoSet2 = $allPhotos2.find("a");
        numPhotos2 = $origPhotoSet2.length,
        oneWidth2 = $origPhotoSet2.width(),
        oneMargin2 = parseInt($origPhotoSet2.css("margin-right")),
        blockWidth2 = (oneWidth2 * numPhotos2) + (oneMargin2 * numPhotos2);
            
    function movePhotosLeft2(first) {
    
        $origPhotoSet2.clone().appendTo("#product_slider_widget-4 .all-photos");
        
        $allPhotos2.animate({
            right: blockWidth2
        }, 72000, "linear", function() {
        
            $allPhotos2.css("right", 0);
            $("#product_slider_widget-4 .all-photos a:lt("+numPhotos+")").remove();
            movePhotosLeft2(); 
        
        });
    
    };
    
    movePhotosLeft2(true);

});