// JavaScript Document
function toggleCommentArea(postId)
{
	
	comment_action_label = document.getElementById('commentaction-'+postId);
	if (comment_action_label)
	{
		
		if (comment_action_label.innerHTML == 'Add a Comment')
		{
			// show comment form, switch text
			
			showCommentsForm(postId);
			comment_action_label.innerHTML = "View Comments";
		}
		else
		{	
			
			showComments(postId);
			comment_action_label.innerHTML = "Add a Comment";
		}
	}
}
function showComments(postId)
{
	
	comments_container = document.getElementById('commentscontainer-'+postId);
    if (comments_container) 
	{
		comments_container.style.display='';
	}
	comments_form = document.getElementById('commentsform-'+postId);
    if (comments_form) 
	{
		comments_form.style.display='none';
	}	
}

function showCommentsForm(postId)
{
	
	comments_container = document.getElementById('commentscontainer-'+postId);
    if (comments_container) 
	{
		comments_container.style.display='none';
	}
	comments_form = document.getElementById('commentsform-'+postId);
    if (comments_form) 
	{
		comments_form.style.display='';
	}	
	
}
/* check comment form */
function checkForm(obj) {
	if(obj.author.value == "" || obj.author.value == 'Your Name: *') {
		alert("Please enter your name.");
		obj.author.focus();
		return false;
	}
	if(obj.email.value == "" || obj.email.value == 'Your Email Address: *') {
		alert("Please enter your email address.");
		obj.email.focus();
		return false;
	}	
	if(obj.comment.value == "" || obj.comment.value == 'Your Message Here: *') {
		alert("Please enter some comments.");
		obj.comment.focus();
		return false;
	}
	return true;
}

