var duration = [];
jQuery( document ).ready(function(){
    jQuery('.banneri').cycle({
        timeout : 0,
        speed : 1000, 
        next : '#next'
    });
    
    jQuery.each(jQuery('.banneri').children('div'), function(i, item)
    {
        var divClass = jQuery(item).attr('class');
        duration[i] = divClass.split('-')[1].replace(',', '.') * 1000;
        // we need ms, but input is in s - so multiplying with 1000
    });
    
    timeout(-1);
});

var timeout = function(i)
{
    i = i + 1;
    if (typeof duration[i] == 'undefined')
    {
        i = 0;
    }
    setTimeout('next(' + i + ')', duration[i]);
    // call function next() with current duration
}

var next = function(i)
{
    jQuery('#next').trigger('click');
    timeout(i);
    // set timeout for next banner with its duration
}

