function ajax() {
  if (window.XMLHttpRequest) { // Mozilla, Safari,...
       xmlhttp = new XMLHttpRequest();
       if (xmlhttp.overrideMimeType) {
           xmlhttp.overrideMimeType('text/html');
           // See note below about this line
       }
   } else if (window.ActiveXObject) { // IE
       try {
           xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
       } catch (e) {
           try {
               xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
               } catch (e) {}
       }
   }
  return xmlhttp;
}

function ajax_url(url, parametros, camada, spin) {

if (spin == "yes") {
document.getElementById(camada).innerHTML = "<table width='100%' height='100%' border='0' cellspacing='0' cellpadding='0' style='height: 100%;'><tr><td align='center' valign='middle'><img src='images/spin.gif' width='24'/></td></tr></table>";
}
if (spin == "bar") {
document.getElementById(camada).innerHTML = "<img src='images/bar.gif'/>";
}

  ajax();
  arquivo = url + "?" + parametros;
  xmlhttp.open('POST',arquivo,true);

  xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;');

  xmlhttp.onreadystatechange = function() {
           if (xmlhttp.readyState == 4){
            if (xmlhttp.status == 200) {
                var texto = xmlhttp.responseText;
				//texto = unescape(texto);
					passa = 0;
					if (url == "rssautorama.asp") {
						if (texto == "") {
						refaz();
						} else {
						fim();
						document.getElementById(camada).innerHTML = ""
						frase = document.getElementById("frase").value;
						frase = texto + "\n\n" + frase;
						document.getElementById("frase").value = frase;
						passa = 1;
						}}
					if (url == "rssempire.asp") {
						if (texto == "") {
						refaz();
						} else {
						fim();
						document.getElementById(camada).innerHTML = ""
						frase = document.getElementById("frase").value;
						frase = texto + "\n\n" + frase;
						document.getElementById("frase").value = frase;
						passa = 1;
						}}
					
					if (passa == 0) {
						document.getElementById(camada).innerHTML = texto;
					}
				
				} else {
				document.getElementById(camada).innerHTML = ""	
                //alert("ops! ocorreu um erro!\n\nCodeorama.com");
            }
     }
  }
  xmlhttp.send(parametros);
}
