function checkemail(str)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="commons.php"
	params="str="+str+"&type=checkEmail"
	xmlHttp.onreadystatechange=function () 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			$('message').innerHTML=xmlHttp.responseText
			if(xmlHttp.responseText=="Already Registered")
			{
				document.getElementById('email').value = "";
				document.getElementById('email').focus();
			}
		}
	}
	xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", params.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.send(params)
}

function postComment(uid, text)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	
	if(text == "")
	{
		alert("Please provide comments");
		return false;
	}
alert("here");
	var url="post_comments.php"
	params="uid="+uid+"&text="+text+"&post=enter"
	xmlHttp.onreadystatechange=function () 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 	{ 
			window.location = "view_comments.php?blogEnrty="+ uid +"&msg=COMMENT_POSTED";
			//document.getElementById("postComm").innerHTML="Your comment was successfully added <br> <a href='view_comments.php?blogEnrty="+ uid +"'>Click here</a> to go back to comments"; 
	  	}
		else
		{
			document.getElementById("postComm").innerHTML="<img src='images/myLoader.gif'>";
		}
	}
	
	xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", params.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.send(params)
}

function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	{
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	 }
	return xmlHttp;
}
