;
var xmlHttp ;

function GetExRateValue()
 { 
 xmlHttp=GetXmlHttpObject()
 if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
 var amount = document.getElementById("amount").value;
 var ratefrom = document.getElementById("xrate_from").value;
 var rateto = document.getElementById("xrate_to").value;
 var xxrand = Math.random();
 var url="responsexml.php?amount="+amount+"&from="+ratefrom+"&to="+rateto+"&sid="+xxrand;
 
 xmlHttp.onreadystatechange=stateChanged 
 xmlHttp.open("GET",url,true)
 xmlHttp.send(null)
 }
 
 function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
 xmlDoc=xmlHttp.responseXML;
 if (xmlDoc.getElementsByTagName("ex_amount")[0].childNodes[0].nodeValue != null) {

// when ok is pressed the form is autofilled
 document.myForm.exchanged.value = xmlDoc.getElementsByTagName("ex_amount")[0].childNodes[0].nodeValue;

return true; 

 }
 
 }
} 

function GetXmlHttpObject()
 { 
 var objXMLHttp=null
 if (window.XMLHttpRequest)
  {
  objXMLHttp=new XMLHttpRequest()
  }
 else if (window.ActiveXObject)
  {
  objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
  }
 return objXMLHttp
 }