jQuery(document).ready(function($) {
	
	$("#topsidebar > ul").tabs({ 
	    fx: { 
	        opacity: "toggle"
	    }
	});

	var sidebarHeight = $("#topsidebar").height();
	$("#topsidebar").css("height", sidebarHeight + "px");
	var entryNum = $(".entry").size();
	if (entryNum == 1) {
		$(".entry").css("min-height", sidebarHeight - 20 + "px");
	}

	//$('.post-info').hide();
		
	$('.open-post-info').click(function() {
		var id = $(this).attr('id');
        $('.post-info-' + id).slideToggle("medium", function() {
            $(this).prev().toggleClass("toggled");
        }); 
		return false;
	});

	matchHeight();
	
	$(window).resize(matchHeight);
	
	function matchHeight() {
		
		var winHeight = $(window).height();
		var wrapHeight = $("#wrapper").height();
		
		var mainHeight = $(window).height() - $("#header").height() - $("#footer").height();
		var mainHeight2 = mainHeight + 91;
		
		if (wrapHeight < winHeight) {
			$('#wrapper').height(mainHeight2);
			
		}
	}
	
	$(".wp-caption a").fancybox({ 
 		'zoomSpeedIn': 0, 
 		'zoomSpeedOut': 0,
 		'overlayOpacity': .1,
 		'overlayShow': true 
	}); 
	
	$(".services").append('<a rel="me" href="http://www.twitter.com/chrispoteet"><img class="icon" alt="Twitter" src="http://friendfeed.com/static/images/icons/twitter.png"/></a>');

	$('input:text').hint();

/*
    $(window).resize(function() {
		stickyFooter();
	});
*/

	var commentsHeight = $("#comments-list").height();
	var entryHeight = $(".single .entry").height();
	var contentHeight = $("#content").height();
	var newEntryHeight = commentsHeight + entryHeight - 220;
	
	if (commentsHeight < 100) {
		$(".single .entry").height(contentHeight);
	}
	else {
		$(".single .entry").height(newEntryHeight);
	}
		
});