$(document).ready(function()
{
	$.ajax(
	{
        url: "news.xml",
        dataType: "xml",
        success: function(xml)
        {
			var count=$(xml).find("news_item").length;
			var ul=$("<ul></ul>");
			$("#news_items").append(ul);
            $(xml).find("news_item").each(function()
    		{
            	var news=$("<li></li>");
            	var readmore=$("<a href=\""+$(this).find("url").text()+"\">continua...</a>")
            	news.append($("<strong></strong>").append($(this).find("title").text()));
            	news.append($("<br/>"));
            	news.append($(this).find("summary").text())
            	news.append($("<br/>"));
            	news.append(readmore);
            	ul.append(news);
            	if (!--count)
            	{
            		$("#news_items").jCarouselLite(
            		{
            			vertical: true,
            			hoverPause:true,
            			visible: 1,
            			auto:8000,
            			speed:1000
            		});
            		$("#news_items").show();
            		var realHeight=$("#news_items").height();
        			$("#news_items").height(0);
            		$("#news_items").hide();
            		$("#news_items").delay(300).animate({height:realHeight}, { duration:1000, easing:"swing"});
            	}
    		});
        }
	});
});
