function submitComment(){
	var url = "../lib/sendComment.php";
	var n = document.getElementById('dname').value;
	var c = document.getElementById('dcomments').value;
	var t = document.getElementById('tID').value;
	var params = "&n="+n+"&c="+c+"&t="+t;
	http.open("POST", url, true);

	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", params.length);
	http.setRequestHeader("Connection", "close");

	http.onreadystatechange = function() {
		if(http.readyState == 4 && http.status != 200) {
			document.getElementById('formoutput').innerHTML = 'Sending...';
		}
		if(http.readyState == 4 && http.status == 200) {
			clearCommentForm();
			document.getElementById('formoutput').innerHTML = http.responseText; 
			reloadComments();
		}                
	}
	http.send(params);
	return false;
}

function reloadComments(){
	var url = "../lib/loadComments.php";
	var t = document.getElementById('tID').value;
	var params = "&t="+t;
	http.open("POST", url, true);

	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", params.length);
	http.setRequestHeader("Connection", "close");

	http.onreadystatechange = function() {
		if(http.readyState == 4 && http.status != 200) {
			document.getElementById('tutorialcomments').innerHTML='Loading Comments...';
		}
		if(http.readyState == 4 && http.status == 200) {
			document.getElementById('tutorialcomments').innerHTML = http.responseText; 
			setTimeout('clearFormOutput()',3000);	 
		}                
	}
	http.send(params);
	return false;
}

function clearCommentForm(){
	document.getElementById('dname').value = "";
	document.getElementById('dcomments').value  = "";
}

function clearFormOutput(){
	document.getElementById('formoutput').innerHTML = '';
}