$(document).ready(function() {
	$('a.gallery').lightBox();
	loadYoutubeLastVideo();
});
$(window).load(function() {
	var rh = $('#right_column').height();
	var lh = $('#left_column').height();
	var ch = $('#center_column').height();
	if(ch < rh || ch < lh) {
		if(rh < lh) {
			$('#center_column').height(lh);
		} else {
			$('#center_column').height(rh);
		}
	}
});
function loadYoutubeLastVideo()
{
    var address = "http://gdata.youtube.com/feeds/base/users/raffaelemarciellotv/uploads?orderby=published&v=2";
    var feedLimit = 1;   

    $.jGFeed(address, function(feeds){

        if(!feeds){
          return false;
        }
        // do whatever you want with feeds here
        /*for(var i=0; i < feeds.entries.length; i++){
          var rssentry = feeds.entries[i];
          $("#feed").append("<h2>" + rssentry.title + "</h2>" + rssentry.content + "<hr/>");
        }*/
		
		if(feeds.entries.length > 0) {
			var video = feeds.entries[0];
			/*for(a in feeds.entries[0])
				alert(a + ' - ' + feeds.entries[0][a]);*/
			var video_id = video.link.substring(video.link.indexOf('?v=') + 3);
			video_id = video_id.substring(0, video_id.indexOf('&'));
			$('#youtube_last_video').append('<span>' + video.title + '</span>').append('<a href="' + video.link + '" title="' + video.title + '" target="_blank"><img src="http://i.ytimg.com/vi/' + video_id + '/default.jpg" alt="" /></a>');
		}

    }, feedLimit);
}
