﻿function doScrollBanners(element, interval) {
    if (!element) {
        return;
    }
    if ($(element).find('ul.logoscroller').children('li').length < 2) {
        return;
    }
    var list = $(element).find('ul.logoscroller');
    var width = list.children('li:eq(0)').width() + 25;    
    if (interval) {        
        list.css('left', '-' + width + 'px');
        window.setTimeout(function () {
            intervalID = window.setInterval(function () {
                doScrollBanners(element)
            }, interval)
        }, Math.ceil(interval / 2));
    } else {
        list.animate({ 'left': '0px' }, 1000, function () {
            list.prepend(list.children('li:last-child'));
            list.css('left', '-' + width + 'px');
        });
    }
}
