$(function() {
	
	$('#questions .left li')
	.click(function(event) {
		event.preventDefault();
		$('.right .active').removeClass('active');
		$('.left .active').removeClass('active');
		var active = $(this).attr('class');
		$('.answer[id='+active+']').addClass('active');
		$(this).addClass('active');
		return false;
	});
	
	if(typeof feed != 'undefined') {
		$.getJSON(feed + "&format=json&jsoncallback=?", function(data){
		  $.each(data.items, function(i,item){
		  
		    var $src = item.media.m;
		    var $srcLrg = $src.replace('_m', '_z');
		    var $title = item.title;
		    var $current = i + 1;
		    
		    var html = "";
		    
		    if (i <= 2) {
		    	html += '<a class=\"show\" ';
		    } else {
		    	html += '<a class=\"hide\" ';
		    }
		    
		    html += 'href=\"'+ $srcLrg +'\" rel=\"photos\" title=\"'+ $title +'\">';
		    html += '<img src=\"'+ $src +'\" />';
		    html += '</a>';
		    
		    $(html).appendTo('.photos');
		    
		  });
		    
		  $(".photos a[rel='photos']").colorbox();
		  
		});
	}
	
});
