<!--
// Written by Dexter Zafra at www.ex-designz.net
//Handle Check Username Availability Using Ajax
 var http = createRequestObject();
 function createRequestObject() 
     {
           var xmlhttp;
	 try 
                 { 
                    xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
                 }
	  catch(e) 
                 {
	    try { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
	    catch(f) { xmlhttp=null; }
	    }
	        if(!xmlhttp&&typeof XMLHttpRequest!="undefined") 
                        {
	  	   xmlhttp=new XMLHttpRequest();
	           }
		   return  xmlhttp;
 }
function sndRating(id_pregunta,nota) 
  {
	  
	var dvelement = document.getElementById('dv'+id_pregunta);
             dvelement.innerHTML = "<img src='/conspiracioncopano/img/estrellas/cargando.gif'>";
            try
              {
                 http.open('GET', '/conspiracioncopano/inc/graba_nota.cfm?id_pregunta='+id_pregunta+'&nota='+nota+'&num_voto=true');
                 http.onreadystatechange = handleResponseText;
	    http.send(null);
	 }
	    catch(e){}
	    finally{}
 }
function handleResponseText() 
  {
     try
         {
             if((http.readyState == 4)&& (http.status == 200))
                {
					var response = http.responseText;
				  	var update = new Array();
					
					if(response.indexOf('|') != -1) 
                       {
                          update = response.split('|');
                          var drelement = document.getElementById('dv'+update[0]);
                          /*var totalvote = document.getElementById('vot'+update[0]);
                          var voteres = document.getElementById('tv'+update[0]);*/
                          var starimg = document.getElementById('star'+update[0]);
                          drelement.style.display ='none';
                          /*voteres.innerHTML = update[2];
                          totalvote.innerHTML = update[3];*/
                          starimg.innerHTML = update[4].toString();
             }
	        }
        }
	catch(e){alert("Ocurrio un error");}
	finally{}
}
