var xmlHttpShowSuggestion

function showSuggestion()
{
	xmlHttpShowSuggestion=getHTTPObject2()
	if (xmlHttpShowSuggestion==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	}
	
	fname= document.getElementById("first_name").value;
	lname= document.getElementById("last_name").value;
	username = document.getElementById("username1").value;
	
	var url="php/getsuggestion.php"
	url=url+"?fname="+fname+"&lname="+lname+"&username="+username
	url=url+"&sid="+Math.random()
	xmlHttpShowSuggestion.onreadystatechange=stateChangedShowSuggestion
	xmlHttpShowSuggestion.open("GET",url,true)
	xmlHttpShowSuggestion.send(null)
} 

function stateChangedShowSuggestion() 
{ 
	if (xmlHttpShowSuggestion.readyState==4 || xmlHttpShowSuggestion.readyState=="complete")
	{
		document.getElementById("txtSuggestion").innerHTML=xmlHttpShowSuggestion.responseText 
	} 
}

//The function used to create a XMLHttpRequest object
function getHTTPObject2()	{
	var xmlHttp=null;
	try	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try	{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)	{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}