
//auto-populate name/e-mail fields
$(function() {
  var comment_name = $.cookie("comment_name");
  var comment_email = $.cookie("comment_email");
  if(comment_name != null)
    $("input[name='name'][value='']").attr("value", comment_name);
  if(comment_email != null)
    $("input[name='email'][value='']").attr("value", comment_email);
});

$(function() {
  prettyPrint();
});

function toggleComments(commentId){
	if($("#comments" + commentId).css("display") == "none"){
		showComments(commentId);
	}
	else{
		hideComments(commentId);
	}
};

function showComments(commentId){
	$("#comments" + commentId).slideDown("slow");
	$("#comments_link" + commentId).html("Hide");
};

function hideComments(commentId){
	$("#comments" + commentId).slideUp("slow");
	$("#comments_link" + commentId).html("Show");
};

function showAddComments(commentId){
	showComments(commentId);
	$("#add_comment" + commentId).slideDown("slow");
};

function hideAddComments(commentId){
	$("#add_comment" + commentId).slideUp("slow");
};

function showDiv(id){
	document.getElementById(id).style.display = 'block';
};

function hideDiv(id){
	document.getElementById(id).style.display = 'none';
};

