var xmlhttp = false ;


if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
{
try {
xmlhttp = new XMLHttpRequest ();
}
catch (e) {
xmlhttp = false}
}



function myXMLHttpRequest ()
{
var xmlhttplocal;
try {
xmlhttplocal = new ActiveXObject ("Msxml2.XMLHTTP")}
catch (e) {
try {
xmlhttplocal = new ActiveXObject ("Microsoft.XMLHTTP")}
catch (E) {
xmlhttplocal = false;
}
}

if (!xmlhttplocal && typeof XMLHttpRequest != 'undefined') {
try {
var xmlhttplocal = new XMLHttpRequest ();
}
catch (e) {
var xmlhttplocal = false;
}
}
return (xmlhttplocal);
}

var mnmxmlhttp = Array ();
var mnmString = Array ();
var mnmPrevColor = Array ();
var responsestring = Array ();
var myxmlhttp = Array ();
var responseString = new String;

var i=0;
var ii = 0;





function ajax_update()
{
url = "cambio/cotacoes_home.asp";
url1 = "cambio/cotacoes_central.asp";
url2 = "cambio/cotacoes_comercial.asp";
target2 = document.getElementById ('n1');
target2x = document.getElementById ('n2');
target2y = document.getElementById ('n3');
ii = i++;

var content = "i=" + ii ;

mnmxmlhttp = new myXMLHttpRequest ();
mnmxmlhttp1 = new myXMLHttpRequest ();
mnmxmlhttp2 = new myXMLHttpRequest ();


if (mnmxmlhttp) {
mnmxmlhttp.open ("POST", url, true);
mnmxmlhttp.setRequestHeader ('Content-Type','application/x-www-form-urlencoded');
mnmxmlhttp.send (content);
errormatch = new RegExp ("^ERROR:");
target2 = document.getElementById ('n1');

mnmxmlhttp.onreadystatechange = function () {
if (mnmxmlhttp.readyState == 4) {
mnmString = mnmxmlhttp.responseText;
if (mnmString.match (errormatch)) {
mnmString = mnmString.substring (6, mnmString.length);
target = document.getElementById ('n1');
target2.innerHTML = mnmString;
} else {
target = document.getElementById ('n1');
target2.innerHTML = mnmString;
}
}
}
}



if (mnmxmlhttp1) {
mnmxmlhttp1.open ("POST", url1, true);
mnmxmlhttp1.setRequestHeader ('Content-Type','application/x-www-form-urlencoded');
mnmxmlhttp1.send (content);
errormatch = new RegExp ("^ERROR:");
target2x = document.getElementById ('n2');

mnmxmlhttp1.onreadystatechange = function () {
if (mnmxmlhttp1.readyState == 4) {
mnmString1 = mnmxmlhttp1.responseText;
if (mnmString1.match (errormatch)) {
mnmString1 = mnmString1.substring (6, mnmString1.length);
targetx = document.getElementById ('n2');
target2x.innerHTML = mnmString1;
} else {
targetx = document.getElementById ('n2');
target2x.innerHTML = mnmString1;
}
}
}
}



if (mnmxmlhttp2) {
mnmxmlhttp2.open ("POST", url2, true);
mnmxmlhttp2.setRequestHeader ('Content-Type','application/x-www-form-urlencoded');
mnmxmlhttp2.send (content);
errormatch = new RegExp ("^ERROR:");
target2y = document.getElementById ('n3');

mnmxmlhttp2.onreadystatechange = function () {
if (mnmxmlhttp2.readyState == 4) {
mnmString2 = mnmxmlhttp2.responseText;
if (mnmString2.match (errormatch)) {
mnmString2 = mnmString2.substring (6, mnmString2.length);
targety = document.getElementById ('n3');
target2y.innerHTML = mnmString2;
} else {
targety = document.getElementById ('n3');
target2y.innerHTML = mnmString2;
}
}
}
}


setTimeout('ajax_update()', 60000);
}




