jQuery(document).ready(function($){
	//$('.post center').css({width : '690px' , 'background-color' : 'white' , 'padding-top' : '10px' , 'padding-bottom' : '10px'}); //Fix post image background width //Lame layout hack
	
	// External links - add target blank
	$(".external_link a").attr("target", "_blank");
	
	// Recent nav
	
		//Recent posts
		$("#recentTab").click(function(){
			$(".recentNav").removeClass("active");
			$(".recentContent").removeClass("activeRecentContent");
			$(this).addClass("active"); 
			$("#recentPosts").addClass("activeRecentContent");
			return false;
		});
		//Recent comments
		$("#commentsTab").click(function(){
			$(".recentNav").removeClass("active");
			$(".recentContent").removeClass("activeRecentContent");
			$(this).addClass("active"); 
			$("#recentComments").addClass("activeRecentContent"); 
			return false;
		});
		//Recent tags
		$("#tagsTab").click(function(){
			$(".recentNav").removeClass("active");
			$(".recentContent").removeClass("activeRecentContent");
			$(this).addClass("active"); 
			$("#recentTags").addClass("activeRecentContent"); 
			return false;
		});
	
	//Jump links
	$(".post").each(function(intIndex){
	
		// Page numbah
		var pageAddrRaw = $("span.current").html();
		var pageAddr = parseInt(pageAddrRaw);
		var pageAddrPrevious = (pageAddr - 1);
		var pageAddrNext = (pageAddr + 1);
		
		//Add jump link anchors 
        $(this).prepend("<a name=\""+intIndex+"\" href=\"\"></a>"); 
		
        if(intIndex == 0 && pageAddrPrevious >= 1) { 
            $(this).find(".previousLink").children().attr("href" , "/page/"+pageAddrPrevious);	
            $(this).find(".nextLink").children().attr("href" , "#"+(intIndex + 1));		
        }else if(intIndex == 0 && pageAddrPrevious == 0) { 
            $(this).find(".previousLink").css("display" , "none");
			$(this).find(".prevNextDiv").css("display" , "none");	
            $(this).find(".nextLink").children().attr("href" , "#"+(intIndex + 1));		
        } else if (intIndex == ($(".post").length - 1)) { 
            $(this).find(".nextLink").children().attr("href" , "/page/"+pageAddrNext);	
            $(this).find(".previousLink").children().attr("href" , "#"+(intIndex - 1));
        } else { 
            $(this).find(".nextLink").children().attr("href" , "#"+(intIndex + 1)); 
            $(this).find(".previousLink").children().attr("href" , "#"+(intIndex - 1));              
        }
	});
	
});