function displayHiddenComments(postID)
{
	//show the block of hidden comments by changing the class
	document.getElementById("hiddenCommentsBlock"+postID).className = "showHiddenCommentsBlock";
	
	//Hide the View All # Comments block
	document.getElementById("viewAllBlock"+postID).style.visibility = "hidden";
	document.getElementById("viewAllBlock"+postID).style.display = "none";
}

function expandComment(postID)
{
	document.getElementById("commentButton" + postID).className = "showCommentButton";
	document.getElementById(("commentTextArea"+postID)).value = "";
	document.getElementById("commentTextArea" + postID).className = "commentTextAreaActive";
}

function contractComment(postID)
{
	document.getElementById("commentButton" + postID).className = "hideCommentButton";
	document.getElementById("commentTextArea"+postID).value = "Write a comment...";
	document.getElementById("commentTextArea" + postID).className = "commentTextArea";
}

function postComment(postID,userID)
{
	comment = document.getElementById(("commentTextArea"+postID)).value;
	if(comment != "")
	{
		//Initalize the xmlHttp object
			var xmlHttp;
			try 
			{
				// Firefox, Opera 8.0+, Safari
				xmlHttp=new XMLHttpRequest();
			}
			catch (e)
			{
				// Internet Explorer
				try 
				{
					xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch (e)
				{
					try 
					{
						xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
					}
					catch (e)
					{
						alert("Your browser does not support AJAX!");
						return false;
					}
				}
			}
			command = "./BLOG/blog.inc.php?command=doPostComment&amp;postingID=" + postID + "&amp;comment=" + comment + "&amp;userID="+userID+"&amp;pageFrom="+document.getElementById("blogCurrentPage").innerHTML;
			command = command.replace(/amp;/g,"");
			xmlHttp.open("GET",command,false);
			xmlHttp.send(null);
			
			document.getElementById("commentContainer"+postID).innerHTML += xmlHttp.responseText;
			contractComment(postID);
		}
	
}


function trackCommentVote(commentID,upDown)
{
	//Initalize the xmlHttp object
	var xmlHttp;
	try 
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try 
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try 
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	
	
	command = "./BLOG/blog.inc.php?command=trackCommentVote&amp;commentID=" + commentID;
	
	if(upDown == "up")
	{
		command += "&amp;voteUp=Y";
		document.getElementById(commentID+"thumbsdown").src = "/images/thumbsdown-inactive.png";
		document.getElementById(commentID+"thumbsup").src = "/images/thumbsup-over.png";
	}
	else
	{
		command += "&amp;voteDown=Y";
		document.getElementById(commentID+"thumbsup").src = "/images/thumbsup-inactive.png";
		document.getElementById(commentID+"thumbsdown").src = "/images/thumbsdown-over.png";
	}
	
	command = command.replace(/amp;/g,"");
	xmlHttp.open("GET",command,false);
	xmlHttp.send(null);
	
	var newRating = xmlHttp.responseText;
	
	if(newRating.substr(0,1) == "+")
	{
		document.getElementById(commentID+"rating").className = "commentRating commentRatingPositive";
	}
	else if(newRating.substr(0,1) == "-")
	{
		document.getElementById(commentID+"rating").className = "commentRating commentRatingNegative";
	}
	else
	{
		document.getElementById(commentID+"rating").className = "commentRating";
	}
	document.getElementById(commentID+"rating").innerHTML = newRating;
	
	document.getElementById(commentID+"thumbsdown").onmouseover = "";
	document.getElementById(commentID+"thumbsdown").onmouseout = "";
	document.getElementById(commentID+"thumbsdown").onclick = "";
	
	document.getElementById(commentID+"thumbsup").onmouseover = "";
	document.getElementById(commentID+"thumbsup").onmouseout = "";
	document.getElementById(commentID+"thumbsup").onclick = "";
	
	
	
}


