function rnd() {
	ord=Math.random();
	ord=ord*10000000000000000000;
	return ord;
}

function writediv(div,texte)
{
	document.getElementById(div).innerHTML = texte;
}

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); 
	tmp = Math.random(); 
	xhr_object.open("GET", fichier, false); 
	xhr_object.send(null); 

	if(xhr_object.readyState == 4)
	 return(xhr_object.responseText);
	else 
		
	return(false);
}


function Transit(slang){
	writediv('LesTransit','<img src="front/images/pictos/loading.gif" alt="Loading" title="Loading">');
	texte = file('front/ajax/transit2.php?slang='+slang+'&rnd='+rnd());	
	writediv('LesTransit',texte);

}

function ChangerPort(port,lang){
	writediv('PortDestination','<img src="../front/images/pictos/loading.gif" alt="Loading" title="Loading">');
	 if(texte = file('../front/ajax/change_rech_destination.php?port='+ port  +'&lang='+lang+'&rnd='+ rnd()))
     {	
		  writediv('PortDestination',texte);
	  }	
}
function voter()
{
	numero = 0;
	idSon  = document.forms['sondage'].idSon.value;
	radio  = document.forms['sondage'].vote;
	
	for ( var i = 0 ; i < radio.length ; i++ )
	{
         if ( radio[i].checked ) 
		 {
             numero = radio[i].value ;
         }
    }
    if (  numero == 0 )
	 {
		 alert( "Merci de faire un choix");
		 return false;
	}
	else
	{
			writediv('etatSondage','<img src="../front/images/pictos/loading.gif" alt="Loading" title="Loading">');
	}
   if( texte = 		file('../front/ajax/voter.php?idSugg='+ numero  +'&idSon='+idSon+'&rnd='+ rnd()) )
     {	
		  writediv('etatSondage',texte);
		  document.getElementById('voireResulte').style.display = 'block' ;
	 }	
}

function seeResulte()
{
    idSon  = document.forms['sondage'].idSon.value;
  	writediv('etatSondage','<img src="../front/images/pictos/loading.gif" alt="Loading" title="Loading">');
   if( texte = 		file('../front/ajax/resultatVote.php?idSon='+idSon+'&rnd='+ rnd()) )
     {	
		  writediv('etatSondage',texte);
	}	

}

function passoublier(lang){
	writediv('passoublier','<img src="front/images/pictos/loading.gif" alt="Loading" title="Loading">');
	texte = file('../front/ajax/passoublier.php?lang='+lang+'&rnd='+rnd());	
	writediv('passoublier',texte);

}
