var xml1Http;
var xml2Http;
var xml3Http;

function call_rates()
{
xml1Http=GetXmlHttpObject(xml1Http)
xml2Http=GetXmlHttpObject(xml2Http)
xml3Http=GetXmlHttpObject(xml3Http)
if (xml1Http==null)
{
alert ("Your browser does not support AJAX!");
return false;
} 
var timestamp = new Date();
var url2="../includes/ajaxRates.php?r=euro&t="+timestamp;
xml2Http.onreadystatechange=stateChanged;
xml2Http.open("GET",encodeURI(url2),true);
xml2Http.send(null);
var url1="../includes/ajaxRates.php?r=dollar&t="+timestamp;
xml1Http.onreadystatechange=stateChanged;
xml1Http.open("GET",encodeURI(url1),true);
xml1Http.send(null);
var url3="../includes/ajaxWeather.php?t="+timestamp;
xml3Http.onreadystatechange=stateChanged;
xml3Http.open("GET",encodeURI(url3),true);
xml3Http.send(null);
}

function clearForm()
{
}
function stateChanged()
{
if (xml1Http.readyState==4)
{ 
document.getElementById("dollarRate").innerHTML=xml1Http.responseText;
}
if (xml2Http.readyState==4)
{
document.getElementById("euroRate").innerHTML=xml2Http.responseText;
}
if (xml3Http.readyState==4 && document.getElementById("weather") != null )
{
document.getElementById("weather").innerHTML=xml3Http.responseText;
}
}

function GetXmlHttpObject(xmlHttp)
{
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;
}
