/* *************************
 * nerd.of.steel main script
 * @author: Rocco Augusto
 * @url: http://www.nerdofsteel.com 
** ************************/

var sideHeight = '';

$(function(){
	//enable Fancybox
	$('div.lightbox a').fancybox({
		'hideOnContentClick': true,
		'overlayShow':	true
	});
	
	//CSS Fixes for older browsers
	$('.entry:last-child').css('border-bottom','none');
	
	//stop clicks
	$('#sidebar .right a').attr('target','_blank');	 
	
	//set sidebar heights
	$('#sidebar div').each(function(i){ 
		if($(this).height() > sideHeight) sideHeight = $(this).height();	
		if(i == $('#sidebar div').length-1) $('#sidebar div').css('height',sideHeight);
	});
	
	//remove blank UL in #article
	$('#archives ul:eq(0)').remove();
	
	//load Twitter feed
	$.getJSON('/parse.php?u=http://twitter.com/statuses/user_timeline/therocco.json', function(t)
	{
		for(i=0; i < 13; i++)
		{
		  var tweet = t[i].text;
		  var id = t[i].id;
		  //var d = new Date(t[i].created_at);
		  var a = '';
			  
		  a += '<li><a href="http://twitter.com/therocco/statuses/' + id + '" target="_blank">therocco: ' + tweet + '</a></li>';
		  //a += '<small>- posted ' + d.toUTCString() + '</small></a></li>'
			  
		  if(i==0) 
			$('.tweet ul').html(a);
		  else
			$('.tweet ul').append(a);
		}
	 });
});