﻿function ultime_news_init(xml) {
  $(xml).find('news').each(function(){
    var id = $(this).attr('id');
    var ora = $(this).find('ora').text();
    var titolo = $(this).find('titolo').text();
    var url = $(this).find('url').text();
     
    $('<li></li>').html('<span>'+ora+'</span><a href="'+url+'">'+titolo+'</a>').appendTo('div.ultime-news ul');
  });

  jQuery('.ultime-news ul').jcarousel({
    vertical: true,
    scroll: 1,
    auto: 3,
    wrap: 'circular',
    buttonNextHTML: null,
    buttonPrevHTML: null,
    initCallback: mycarousel_initCallback
  });
}

function mycarousel_initCallback(carousel)
{
    // Pause autoscrolling if the user moves with the cursor over the clip.
    jQuery('a', carousel.clip).hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};


