
var xmlhttp;

function getaccount(str, WEBPATH)
{
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
var url=WEBPATH +"content/salesforce/getaccount.php";
url=url+"?txtCompany="+str;

document.getElementById("showAccounts").style.display = "block";
// url=url+"&qsrchtp="+category;
xmlhttp.onreadystatechange=stateAccountChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function stateAccountChanged()
{
if (xmlhttp.readyState==1)
	{
		document.getElementById("showAccounts").setAttribute("class", "searching");
				 document.getElementById("showAccounts").innerHTML = "searching...";
	 
	} else if (xmlhttp.readyState==4)
	{
		 var matcharray = xmlhttp.responseText.split("<br>");  
		 var myarray = matcharray[0].split("*");
		
		
             	if(myarray[0]=='None'){  
                //alert('no data was returned');  
                 document.getElementById("showCompanyStatus").setAttribute("class", "donotenter");
				 document.getElementById("showAccounts").setAttribute("class", "");
              		document.getElementById("showAccounts").innerHTML = "Not a corporate member. Community access will be granted.";
					document.getElementById("txtAccount").value = '';
            }else{  
                  document.getElementById("txtAccount").value = myarray[0];  
                document.getElementById("txtCompany").value = myarray[1];       
				 document.getElementById("showCompanyStatus").setAttribute("class", "checkmark");
				 document.getElementById("showAccounts").setAttribute("class", "");
				 document.getElementById("showAccounts").innerHTML = xmlhttp.responseText;
            }  
             
			
   // alert(myarray[0] + " -- "  + myarray[1]);

	
	} 
}

function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}



