// JavaScript Document


$(document).ready(function(){
	$(".blog .post").each(function(){
		var post_id = $(this).attr('id');
		// see if content exists, add "read more" link based on correct permalink
		var post_excerpt = $("#"+post_id+" .post-excerpt").html();
		if (post_excerpt != false) {
			// Get permalink
			var permalink = $("#"+post_id+" h2 a").attr("href");
			//alert(permalink);
			$("#"+post_id+" .post-excerpt p").append(' <a href="'+permalink+'">read more</a>');
		}
	});
	
	$(".show_hide_b").click(function(){
		var content_id = $(this).attr("id").replace(/_b/,'');
		if ($(this).text() == "Show Older Items") {
			$(this).text("Hide Older Items");
		} else {
			$(this).text("Show Older Items");
		}
		$("#"+content_id).slideToggle('medium', function() {
			// Animation complete.
		});

	});
});
