var xmlHttp

function agregaComentario()
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Tu navegador no soporta AJAX!");
  return;
  } 
var valor = escape(document.getElementById("id").value);
var valor2 = escape(document.getElementById("comen").value);
var valor3 = escape(document.getElementById("nombre").value);
var valor4 = escape(document.getElementById("mail").value);
var valor5 = escape(document.getElementById("web").value);
var url="/comentarios.asp";
url=url+"?id="+valor+"&comentario="+valor2+"&nombre="+valor3+"&mail="+valor4+"&web="+valor5;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
	document.getElementById("comen").value="";
	document.getElementById("nombre").value="";
	document.getElementById("mail").value="";
	document.getElementById("web").value="";
	document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
	document.getElementById("preloader").innerHTML="";
}
if (xmlHttp.readyState==1)
{ 
	document.getElementById("txtHint").innerHTML="";
	document.getElementById("preloader").innerHTML="<img src=/imagenes/ajax-loader.gif width=16 height=16 /> Aguarde por favor";
}
}

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;
}