
//var xmlHttp

function convert(amount, currency_code_from, currency_code_to)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="currency_converter/ajax_convert.php"
	url=url+"?amount="+amount+"&currency_code_from="+currency_code_from+"&currency_code_to="+currency_code_to
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=xmlHttp.onreadystatechange=function() { stateChanged_convert(xmlHttp); } 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}



function stateChanged_convert(xmlHttp) 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
		document.getElementById("result").innerHTML=xmlHttp.responseText; 
	} 

}



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;
}


