function Dados_voto(cod_art,id) 
{
  
  //verifica se o browser tem suporte a ajax
  try 
  {
     ajax = new ActiveXObject("Microsoft.XMLHTTP");
  } 
  catch(e) 
  {
     try 
	 {
        ajax = new ActiveXObject("Msxml2.XMLHTTP");
     }
     catch(ex) 
	 {
        try 
		{
           ajax = new XMLHttpRequest();
        }
        catch(exc) 
		{
           alert("Esse browser nao tem recursos para uso do Ajax");
           ajax = null;
        }
     }
  }
  
  //se tiver suporte ajax
  if(ajax) 
  {
   if(document.getElementById(id) == document.getElementById("a"))
	{
		document.getElementById("votacao").value = 10;
	}
	if(document.getElementById(id) == document.getElementById("b"))
	{
		document.getElementById("votacao").value = 8;
	}
	if(document.getElementById(id) == document.getElementById("c"))
	{
		document.getElementById("votacao").value = 6;
	}
	if(document.getElementById(id) == document.getElementById("d"))
	{
		document.getElementById("votacao").value = 4;
	}
	if(document.getElementById(id) == document.getElementById("e"))
	{
		document.getElementById("votacao").value = 2;
	}
	 var voto =document.getElementById("votacao").value;
	 idOpcao  = document.getElementById("legenda");
	 
     ajax.open("POST", "../include/votacao.php", true);
	 ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	 
	 ajax.onreadystatechange = function() 
	 {
        //enquanto estiver processando...emite a msg de carregando
		idOpcao.innerHTML = "Carregando...!";
	   
	    if(ajax.readyState == 4) {
			if (ajax.responseXML) 
			   processo(ajax.responseXML);
		}
     }
	 
	 //passa o c?digo do estado escolhido
     var params = "votacao="+cod_art+"---"+voto;
	 ajax.send(params);
  }
}


function processo(obj)
{
  //pega a tag conf_voto
  var dataArray   = obj.getElementsByTagName("conf_voto");
  if(dataArray.length > 0) 
  {
	 //percorre o arquivo XML para extrair os dados
     for(var i = 0 ; i < dataArray.length ; i++) 
		idOpcao.innerHTML = "Voto cadastrado!";
  }
  else 
  {
     //caso o XML volte vazio, printa a mensagem abaixo
	//idOpcao.style.color = '#009900';
	idOpcao.innerHTML = "Voto cadastrado!";
	
  }	  
}
