function facebookFetch(){
	//Pagina
	//var url = "https://graph.facebook.com/123520137682767/";
	//Metadata
	var url = "https://graph.facebook.com/123520137682767?metadata=1&callback=?";
	//Messaggi	
	//var url = "http://graph.facebook.com/123520137682767/feed?limit=1&jsoncallback=?";
	//var url = "/json/facebook.metadata.json";
	
	
	
	$.getJSON(url,function(json){
	var html = "";
			$.each(json,function(i,fb){
	      		if ( i == 'likes') {
	      		html += "Piace a " + fb + " persone"; 
	      		}
	    	});

			$('#facebook-feed').html(html);

		});
}


function twitterFetch(){
	//Pagina
	var url = "http://api.twitter.com/1/users/show.json?user_id=206107974&callback=?";
	
	$.getJSON(url,function(json){
	var html = "";
	var followers = "";
	var tweets = "";
			$.each(json,function(i,tw){
				if ( i == 'followers_count') {
	      		followers =  tw + " Followers"; 
	    	}
				if ( i == 'statuses_count') {
	      		tweets =  tw + " Tweets"; 
	    	}	    	
	    	});
	    html = followers + " <br /> "  + tweets
			$('#twitter-feed').html(html);
		});
}

function youtubeFetch(){
	var url = "http://gdata.youtube.com/feeds/api/users/HaivistomaiFestival?v=2";
	var url = "/json/youtube.user.xml";
  $.ajax({
    type: "GET",
    url: url,
    dataType: "xml",
    success: parseXml
  });
}


function youtubeFetchJson(){
	//Pagina
	var url = "http://gdata.youtube.com/feeds/api/users/HaivistomaiFestival?v=2&alt=json&callback=?";
	
	$.getJSON(url,function(json){
		parseJSON
	alert("JSON Data: " + json);

	var html = "";

			$.each(json,function(i,yt){
	   		html +=  i + " " + yt + "<br />"; 
    	});
			$('#debug').html(html);
		});
}

;
function parseXml(xml)
{
  $(xml).find("entry").each(function()
  {
  	if ($(this).find("yt\\:statistics") ) {
		$("#youtube-feed").append("Visualizzazioni canale " + $(this).find("yt\\:statistics").attr("viewCount") + "<br />");
		$("#youtube-feed").append("Visualizzazioni totali " + $(this).find("yt\\:statistics").attr("totalUploadViews") + " ");
  	} else {
  		alert("Accedi al canale youtube");
  	}
  });
}

