function postComment(id) {

var comments = document.getElementById('the_comments').value;
var userid = document.getElementById('userid').value;
var button = document.getElementById("comment_button");

if(comments.length < 2) {
	alert('Your comment isn\'t long enough to post');
	}
	
else if(comments.length > 399) {
	alert('Your comment is too long! Please reduce it to less than 400 characters');
}
	
else {

comments =  encodeURIComponent(comments);

var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Unexpected Error, Try Again!");
				return false;
			}
		}
	}

	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 1) {
		button.value = 'Posting.....'; 
		button.disabled='disabled'; 
		document.getElementById("the_comments").disabled = true; 
		}
		
		if(ajaxRequest.readyState == 4){
		document.getElementById("the_comments").value = ajaxRequest.responseText; 
		button.style.display = 'none';	
		}
	} 
		
	var queryString = "?c=" + comments + "&userid=" + userid + "&id=" + id;
	ajaxRequest.open("GET", "../scripts/postComments.php" + queryString, true);
	ajaxRequest.send(null); 

	}
}