$(document).ready(function() {
 
    //Assign a timer, so it will run periodically
    var nto = setTimeout('newsslider3()', speed3); 
     
    $('#gallery3 li:first').addClass('selected');
 
});
 
 
function newsslider3() {
 
    //Get the current selected item (with selected class), if none was found, get the first item
    var current_image3 = $('#gallery3 li.selected').length ? $('#gallery3 li.selected') : $('#gallery3 li:first');
 
    //Get next sibling
    var next_image3 = (current_image3.next().length) ? current_image3.next() : $('#gallery3 li:first');
    var animSpeed3 = (current_image3.next().length) ? 500 : 100;
        
    //clear the selected class
    $('#gallery3 li').removeClass('selected');
     
    //reassign the selected class to current items
    next_image3.addClass('selected');
 
    //Scroll the items
    $('#mask-gallery3').scrollTo(next_image3, animSpeed3, {
        'onAfter' : setNto()
    });      
    
}

function setNto() {
    nto = setTimeout('newsslider3()', speed3); 
}

