function objetoAjax(){
	var xmlhttp=false;
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
		   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
  		}
	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}

//////////////////////////////////////////////////////
// --> Funciones Generales de Wajax

function ActualizarDiv(div,url){
	
	ajax=objetoAjax();

	ajax.open("GET", url, true);
	document.getElementById(div).innerHTML= '<center><img src="Wajax/anim.gif"></center>';
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			document.getElementById(div).innerHTML = ajax.responseText;
			//SetContainerHTML(div, ajax.responseText, true);
		}
	}

	ajax.send(null);
}

var xmlHttp;

function Votar (voto,nombre,user,idestrella){
	 xmlHttp=GetXmlHttpObject2();
	 if (xmlHttp==null){
		alert ("Browser does not support HTTP Request");
		return;
	 } 
	 var url="http://www.demamaypapa.com.ar/Votar.php?vot=" + voto+"&nom_id="+ nombre+"&user_id="+ user + "&idestrella=" + idestrella;
 	 xmlHttp.onreadystatechange=stateChanged;
	 xmlHttp.open("GET",url,true);
	 xmlHttp.send(null);		 
}
function stateChanged(){
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")		//NO ENTRA ACÁ
	{
		var resultado=xmlHttp.responseText;		
		var pos= resultado.indexOf("*");
		
		var contenido= resultado.substr(0,pos);
		var idEstrella= resultado.substr(pos+1,resultado.length);
		document.getElementById("estrellas" + idEstrella).innerHTML=contenido;
// alert("Gracias por su voto");		
	}
}


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;
}

function GetXmlHttpObject2(){ 
 var objXMLHttp=null;
 if (window.XMLHttpRequest)
  {
  objXMLHttp=new XMLHttpRequest();
  }
 else if (window.ActiveXObject)
  {
  objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 return objXMLHttp;
 }
 
function removeWho(who) {
    if(typeof who== 'string') who=document.getElementById(who);
    if(who && who.parentNode)who.parentNode.removeChild(who);
}
function ventanaSecundaria (URL){
   window.open(URL,"ventana1","width=230,height=115,scrollbars=NO, top=200, left=400")
}
function ventanaSecundaria2 (URL){
   window.open(URL,"ventana1","width=400,height=350,scrollbars=NO, top=100, left=300")
}


