$(function(){
    jQuery('#specials-content').jScrollPane({scrollbarWidth:14,dragMinHeight:46,dragMaxHeight:46});
    jQuery('#product-content').jScrollPane({scrollbarWidth:14,dragMinHeight:46,dragMaxHeight:46});    
    jQuery('#content-subtekst').jScrollPane({scrollbarWidth:14,dragMinHeight:46,dragMaxHeight:46});
    jQuery('#content-type1').jScrollPane({scrollbarWidth:14,dragMinHeight:46,dragMaxHeight:46});
    
    jQuery("#nieuws-scrollcontainer").hover(function(){jQuery('#nieuws-scrollcontainer').stop()}, startScroll);    
    var width = 0;
    jQuery('.nieuws-link').each(function(){
        width += (jQuery(this).width()+30);
    });
    jQuery('#nieuws-scrollcontainer').css('width',width+'px');
    startScroll();
});

function resetScroll()
{
    jQuery("#nieuws-scrollcontainer").css('left','750px');
    startScroll();
}

function startScroll()
{
    if(jQuery("#nieuws-scrollcontainer").size() > 0)
    {
        var nieuwscount = jQuery('.nieuws-link').size();
        var scrollamount = (jQuery('#nieuws-scrollcontainer').position().left) + jQuery('#nieuws-scrollcontainer').width();
        var scrolltime = (scrollamount/70)*1000;
        jQuery('#nieuws-scrollcontainer').animate({left:"-="+scrollamount+"px"},scrolltime,'linear',resetScroll);    
    }
}