//************* Requête Ajax pour rapatrier les derniers signets Delicious
$(document).ready(function(){
	$.ajax({ 
		type: "GET",
		dataType: "jsonp",
		url: "http://feeds.delicious.com/v2/json/signets_bsa",
			success: function(data){
				var html = '';
				for(i = 0; i < 7; i++) {
					html += '<li>'
					+ '<a target="_blank" href="'
					+ data[i].u
					+ '">'
					+ data[i].d
					+ '</a>'
					+ '</li>'
				}
		$("#result").append(html+'<p style="text-align:right"><img src="images/delicious_pt.png" alt="Delicious" />&nbsp;<strong><a href="http://delicious.com/signets_bsa" target="_blank" title="Tous les signets de la BSA sur delicious.com">Voir tous les signets</a></strong></p>');
		}
	});
});

//************* Rapatrier avec getJSON les derniers billets sur Insula
$(document).ready(function(){
	
		var url ="http://bsa.biblio.univ-lille3.fr/blog/feed/?feed=json&jsonp=?"
		$.getJSON(url,
			function(data) {
				for(var j = 0; j < 7; j++){
				$('#result2').append('<li><a href="'+ data[j].permalink +'">' + data[j].title + '</a>');
				}
			}
		);

		
		/*function jsoncallback(data){
			
			alert("test");
					
			var html = '';
				for(i = 0; i < ; i++) {
					html += '<li>'
					+ '<a target="_blank" href="'
					+ data[i].permalink
					+ '">'
					+ data[i].title
					+ '</a>'
					+ '</li>'
				}
		  $("#result2").append(html);
          
			  /*$.each(data.items, function(i,item){
				$("<img/>").attr("src", item.media.m).appendTo("#images");
				if ( i == 3 ) return false;
			  });*/
			  
			 /* $('#result2').html('<p>' + data.title + '</p>');*/
			  
			// Loop throught all photos and display them
			// it uses the jquery.each method
			// doc at http://docs.jquery.com/Utilities/jQuery.each
			/*
			$.each(data.title, function(photoIdx, photo) {
			// Build the thumbnail url
			var thumb_url = ["http://farm", photo.farm, ".static.flickr.com/",
			photo.server, "/", photo.id, "_", photo.secret, "_t.jpg"].join("");

			// Build the photo url
			var photo_url = ["http://www.flickr.com/photos/",
			photo.owner, "/", photo.id].join("")

			// Build HTML
			$("#result2").append(
			$("<a>")
			.attr("href", photo_url)
			.attr("target", "_blank")
			.append(
			$("<img>").attr("src", thumb_url)
			)
			)
			});

			}
		}
);*/

});

