var xmlHttp;

function loadXMLDoc(dname){
  try{ //Internet Explorer
    xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    }
  catch(e){
    try{ //Firefox, Mozilla, Opera, etc.
      xmlDoc = document.implementation.createDocument("","",null);
      }
    catch(e) {alert(e.message)}
    }
  try{
    xmlDoc.async = false;
    xmlDoc.load(dname);
    return(xmlDoc);
    }
  catch(e) {alert(e.message)}
  return(null);
  } 

function getVote(vall){
  xmlHttp = GetXmlHttpObject();
  if (xmlHttp == null){
    alert ("Browser does not support HTTP Request");
    return;
    } 
  /*xmlDoc = loadXMLDoc("encuesta.xml");
  x = xmlDoc.getElementsByTagName(vall)[0];
  value = x.childNodes[0];
  value.nodeValue++;
  alert(vall+"="+value.nodeValue);*/
  xmlHttp.onreadystatechange = stateChanged;
  xmlHttp.open("GET","encuesta.php?nodo="+vall,true);
  xmlHttp.send(null);
  } 

function stateChanged(){
  if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete"){ 
    document.getElementById("form_poll").
    innerHTML = xmlHttp.responseText;
    } 
  } 

function GetXmlHttpObject(){
  var objXMLHttp = null;
  if (window.XMLHttpRequest)
    objXMLHttp = new XMLHttpRequest();
  else if (window.ActiveXObject)
    objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
  return objXMLHttp;
  }
