var xmlHttp

function convert()
{
	if (window.XMLHttpRequest){ // if Mozilla, Safari etc
		xmlHttp = new XMLHttpRequest();
	}else if (window.ActiveXObject){ // if IE
		try {
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP")
		}catch (e){
			try{
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP")
			}
			catch (e){}
		}
	}else {
		alert("Browser does not support HTTP Request")
		return;
	}
	//show_loading();
	var amount = document.getElementById("amount").value;
	var from   = document.getElementById("from").value;
	var to     = document.getElementById("to").value;
	var url = "templates/connect.php" ; 
	url=url+"?amount=" + amount + "&from=" + from + "&to=" + to ;
	xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.open("POST",url,true)
	xmlHttp.send()
} 

function stateChanged() 
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		document.getElementById("result").innerHTML = xmlHttp.responseText ;
		//hide_loading();
	} 
}

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;
}


//SHOW LOADING
function show_loading()
{
	document.getElementById('loading').style.visibility = "visible";
}

//HIDE LOADING

function hide_loading()
{
	document.getElementById('loading').style.visibility = "hidden";
}
