function submitComment()
{
	var xmlHttp = ajaxFunction();
	
	if(xmlHttp == false)
	{
		return xmlHttp;
	}
	
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			if(xmlHttp.responseText == "NO_SCREEN_NAME")
			{
				document.getElementById("error").innerHtml = "You must supply a name";
			}
			else if(xmlHttp.responseText == "NO_EMAIL")
			{
				document.getElementById("error").innerHtml = "You must supply an email address";
			}
			else if(xmlHttp.responseText == "SCREEN_NAME_TAKEN")
			{
				document.getElementById("error").innerHtml = "The name you supplied has already been taken";
			}
			else if(xmlHttp.responseText == "NO_CAPTCHA")
			{
				document.getElementById("error").innerHtml = "You must provide a security code";
			}
			else if(xmlHttp.responseText.indexOf("INVALID_CAPTCHA") != -1)
			{
				document.getElementById("error").innerHtml = "The security code you provided was invalid";
			}
			else if(xmlHttp.responseText == "NO_CAPTCHA_SEC_CODE")
			{
				document.getElementById("error").innerHtml = "The security code is not being saved in the session";	
			}
			else
			{
				document.getElementById("submittedState").innerHTML = xmlHttp.responseText;
				document.getElementById("commentTextBox").value = "";
			}
		}
	};
	
	var url = "../comments/comment.php?";
	url += "comment="+ escape(document.getElementById("commentTextBox").value);
	url += "&screenName="+ document.getElementById("screenName").value;
	url += "&email="+ document.getElementById("email").value;
	url += "&security_code="+ document.getElementById("security_code").value;
	url += "&event_id="+ document.getElementById("event_id").value;
	
	xmlHttp.open("GET",url,true);
	
	xmlHttp.send(null);
	
}
window.onload=function(){
	this.get = function()
	{
		var xmlHttp = ajaxFunction();
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				document.getElementById("submittedState").innerHTML = xmlHttp.responseText;
			}
		};
		xmlHttp.open("GET","../comments/getAllComments.php?event_id="+document.getElementById("event_id").value, true);
	
		xmlHttp.send(null);
	}
	var timerId = setInterval("this.get()", (60*1000));
}
