function openComment()
{
	document.getElementById("blog-comment").style.display = "block";
}
function createXMLObj()//pass in varName for the variable reference you want to use for this instance of the object
{
	varName = false;
	try
	{
		varName = new ActiveXObject("MSXML2.XMLHTTP");
	}
	catch(exception1)
	{
		try
		{
			varName = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(exception2)
		{
			varName = false
		}
	}

	if(!varName && window.XMLHttpRequest)
	{
		varName = new XMLHttpRequest();
	}
	return varName;
}
function postComment(postParams)
{
	var xmlObj = createXMLObj();
	var dataSource = "/process_comment.php";
	var divID = "post-response";
	
	if(xmlObj)//this checks to make sure that the xmlhttp object has been instanciated properly before carrying out the rest of the function
	{
		var obj = document.getElementById(divID);
		dataSource +="?t=" + new Date().getTime();

		//alert(dataSource);
		xmlObj.open("POST", dataSource, true);
		xmlObj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
        
		xmlObj.onreadystatechange = function()
		{
			if(xmlObj.readyState == 4 && xmlObj.status == 200)
			{
				//alert("readystatereached");
				var output = xmlObj.responseText;
								
				if(output == "success")
				{
					output = "<b>THANK YOU.</b><br />Your message has been sent.  If you have prompted me for a response I will try to get back to you shortly.<br /><br /><br />";
					
					document.getElementById("u_name").value = "";
					document.getElementById("email").value = "";
					document.getElementById("comment").value = "";
				}
				else
				{
					output = "<div class='validation'>" + output + "</div>";
				}				
				obj.innerHTML = output;
				//alert(txt);
				//this line works on the first page load, but not when I try to refresh the calendar
			}
			else
			{
				//alert(xmlObj.readyState + "  " + xmlObj.status);
			}
		}
		xmlObj.send(postParams);
	}
	else
	{
		alert("Your browser does not support AJAX.");
	}
}

function setPostParams()
{
	var email = document.getElementById("email").value;
	var comment = document.getElementById("comment").value;
	var name = document.getElementById("u_name").value;
	var str = "name=" + encodeURIComponent(name) + "&email=" + encodeURIComponent(email) + "&comment=" + encodeURIComponent(comment);
	postComment(str);
}
