var xmlHttp

function fill(str, str2)
{





xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
  
//mysql lekérdezés meghívása


var url="getuser.php"
url=url+"?q="+str
url=url+"&m="+str2
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)

}

function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
var egybe=xmlHttp.responseText;
//feldarabolni a kapott url-t
var darab=egybe.split(":");
//10 szóköz karakter levágása és form változtatása
var szam=darab[0].substr(10);


//1=appraiser
if (szam==1) {



document.getElementById("Appr_Phone").value=darab[1];
document.getElementById("Appr_Email").value=darab[2];


}

//2=request
if (szam==2) {
//feldarabolni a kapott url-t


document.getElementById("Company").value=darab[1];
document.getElementById("Address").value=darab[2];
document.getElementById("Telephone").value=darab[3];
document.getElementById("Fax").value=darab[4];
}



//3=applicant
if (szam==3) {
//feldarabolni a kapott url-t



document.getElementById("Applicant_Address").value=darab[1];
document.getElementById("Applicant_Zip").value=darab[2];
document.getElementById("Applicant_City").value=darab[3];
document.getElementById("Applicant_Telephone1").value=darab[4];
document.getElementById("Applicant_Telephone2").value=darab[5];
document.getElementById("Applicant_Telephone3").value=darab[6];
document.getElementById("Applicant_Mail").value=darab[7];


}


//4=lender
if (szam==4) {
//feldarabolni a kapott url-t




document.getElementById("L_Address").value=darab[1];
document.getElementById("L_Zip").value=darab[2];
document.getElementById("L_City").value=darab[3];
document.getElementById("L_Telephone1").value=darab[4];
document.getElementById("L_Telephone2").value=darab[5];
document.getElementById("L_Fax").value=darab[6];
document.getElementById("L_Mail").value=darab[7];
}




// others 


//5=escow company
if (szam==5) {
//feldarabolni a kapott url-t


var vegso = darab[1]+"\n"+darab[2]+"\n"+darab[3]+"\n"+darab[4]+"\n"+darab[5]+"\n";


if (darab[1]!="") {



document.getElementById("Escrow_Company").value=vegso;
}

}


//6=title company
if (szam==6) {
//feldarabolni a kapott url-t

var vegso = darab[1]+"\n"+darab[2]+"\n"+darab[3]+"\n"+darab[4]+"\n"+darab[5]+"\n";


if (darab[1]!="") {

document.getElementById("Title_Company").value=vegso;
}

}

//7=listing agent
if (szam==7) {
//feldarabolni a kapott url-t

var vegso = darab[1]+"\n"+darab[2]+"\n"+darab[3]+"\n"+darab[4]+"\n"+darab[5]+"\n";

if (darab[1]!="") {


document.getElementById("Listing_Agent").value=vegso;
}

}

//8=selling agent
if (szam==8) {
//feldarabolni a kapott url-t

var vegso = darab[1]+"\n"+darab[2]+"\n"+darab[3]+"\n"+darab[4]+"\n"+darab[5]+"\n";


if (darab[1]!="") {

document.getElementById("Selling_Agent").value=vegso;
}

}




}
}

function GetXmlHttpObject()
{
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;
}