
function criaXMLHttpRequest()
{
var XMLHTTPREQUEST_IE = new Array(
  "Msxml2.XMLHTTP.6.0",
  "Msxml2.XMLHTTP.5.0",
  "Msxml2.XMLHTTP.4.0",
  "Msxml2.XMLHTTP.3.0",
  "Msxml2.XMLHTTP",
  "Microsoft.XMLHTTP"
);
  var oXMLhttp = null;

  // Cria o HttpRequest para o respectivo navegador.
  if (window.XMLHttpRequest != null)
    oXMLhttp = new window.XMLHttpRequest();
  else if (window.ActiveXObject != null)
  {
    // Percorre no IE a procura do objeto ActiveX na biblioteca mais recente
    var bCriado = false;
    for (var ind = 0;
         ind < XMLHTTPREQUEST_IE.length && ! bCriado; ind++)		
    {
      try
      {
        oXMLhttp = new ActiveXObject(XMLHTTPREQUEST_IE[ind]);
        bCriado = true;
      }
      catch (ex)
      {}
    }
  }

  // Tratamento de erro caso não encontre nenhum.
  if (oXMLhttp == null)
    alert("Falha no HttpRequest():\n\n"
      + "Objeto XMLHttpRequest não foi criado.");

  // Retorna o objeto instanciado ou não
  return oXMLhttp;
}



var oXMLhttp = criaXMLHttpRequest();

function trataHttpResponse(){
	
if (oXMLhttp.readyState == 4){

oRetorno = oXMLhttp.responseText.split("#");

	if (oRetorno[0] == "Erro")
	{
	var box = document.getElementById("resposta"+oRetorno[0]);
	box.innerHTML = "Erro.";
	} 
	else
	{
	var box = document.getElementById("resposta"+oRetorno[0]);
	box.innerHTML = oRetorno[1];
	
	}
	
}

}




function rateNot(nota, idNot, idRat){

var sURL = "../includes/votar_foto.asp?rating="+escape(nota)+"&imgId="+escape(idNot);

oXMLhttp.open("GET", sURL, true);
oXMLhttp.onreadystatechange = trataHttpResponse;
oXMLhttp.send(null);


nota = nota * 25;
document.getElementById(escape(idRat)).style.width = nota+'px';

}


