// JavaScript Document
function writediv(texte,box)
{
     document.getElementById(box).innerHTML = texte;
}

function sendField(){

var pollid=document.votePoll.pollid.value;

var radioGrp = document.votePoll.Sondage;
var sondage="";
for (var i = 0; i< radioGrp.length; i++) {
    if (radioGrp[i].checked) {
        sondage=radioGrp [i].value ;
    }
} 
 if(texte=file("poll/vote.php?Sondage="+escape(sondage)+"&pollid="+escape(pollid))){
	 
	texte=replaceCharacters(texte,"&amp;eacute;","é");
	texte=replaceCharacters(texte,"&amp;agrave;","à");
	 
  writediv(texte,"voteContainer");
 
 }

}

function sendData(url){
	
	if(texte=file(url)){
	 
  writediv(texte,"voteContainer");
 
 }
}

function file(fichier)
{
     if(window.XMLHttpRequest) // FIREFOX
          xhr_object = new XMLHttpRequest(); 
     else if(window.ActiveXObject) // IE
          xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); 
     else 
          return(false); 
     xhr_object.open("GET", fichier, false); 
     xhr_object.send(null); 
     if(xhr_object.readyState == 4) return(xhr_object.responseText);
     else return(false);
}

function replaceCharacters(conversionString,inChar,outChar)
{ 
  var convertedString = conversionString.split(inChar);
  convertedString = convertedString.join(outChar);
  return convertedString;
}


