/*
Realizzato da Bzzz
Requisiti: jQuery
uno o pił div con classe rss_reader e title contenente l'indirizzo da cui prelevare il feed RSS
*/
$(document).ready(function(){
	$(".rss_reader").each(function (){
		var frame=$(this);
		var xml_url=frame.attr('title');
		$.ajax({
		  url: "/wget.asp?url=" + xml_url,
		  dataType: "xml",
		  success:function(xml){
			var out;
			out = "";
			$("rss channel title:eq(0)",xml).each(function(){
				var titolo;
				titolo = $(this).text();
				out += ("<h1>" + titolo + "</h1>");
			});
			out += "<ol>";
			$("rss channel item",xml).each(function(){
				var title, description, rss_link, author;
				title = $("title", this).text();
				description = $("description", this).text().replace("<br /><br />","<br />");
				rss_link = $("link", this).text();
				author = $("author", this).text();
				out += "<li class='rss_entry'>";
				out += "<a href='" + rss_link + "' target='_blank' ><h2>" + title + "</h2></a>";
				out += "<div class='rss_content'>" + description + " Autore: " + author + "</div>";
				out += "</li>\n";
			});
			out += "</ol>";
			frame.html(out);
		  }
		});
	});
});

