function GetXmlHttpObject()
{
var xmlHttp;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  return xmlHttp;
  }



var xmlHttp;

function sendMessage(str)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request");
 return;
 }
var url="scripts/sendMessage.php";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=sendMessage_stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function sendMessage_stateChanged() 
{ 

	if(xmlHttp.readyState==4)
	{
		
		email=document.getElementById("frm_fields_email").value;
		fname=document.getElementById("frm_fields_fname").value;
		phone=document.getElementById("frm_fields_phone").value;
		city=document.getElementById("frm_fields_city").value;
		
		if(xmlHttp.responseText=="Ben")
		{
		
			document.getElementById("from").value=email;
			document.getElementById("name").value=fname;
			document.getElementById("custom Phone number").value=phone;
			document.getElementById("custom Country").value=city;

			document.forms[1].submit();
		}
		if(xmlHttp.responseText=="Brian")
		{
			document.getElementById("GRCategory3").value=email;
			document.getElementById("GRCategory2").value=fname;
			document.getElementById("GrCustom0").value=phone;
			document.getElementById("GrCustom1").value=city;
			document.forms[2].submit();
		}
	}

}


