function getXMLHttpRequest() 
{
	var xhr = null;
	
	if (window.XMLHttpRequest || window.ActiveXObject) {
		if (window.ActiveXObject) {
			try {
				xhr = new ActiveXObject("Msxml2.XMLHTTP");
			} catch(e) {
				xhr = new ActiveXObject("Microsoft.XMLHTTP");
			}
		} else {
			xhr = new XMLHttpRequest(); 
		}
	} else {
		alert("Votre navigateur ne supporte pas l'objet XMLHTTPRequest...");
		return null;
	}
	
	return xhr;
}

function vider(id)
{
	var elt=document.getElementById(id);
	if(elt.value=='Login' || elt.value=='Mot de passe')
		elt.value='';
}
function remplir(id)
{
	var elt=document.getElementById(id);
	if(id=='login')
	{
		if(elt.value=='')
			elt.value='Login'
	}
	else
	{
		if(elt.value=='')
			elt.value='Mot de passe'		
	}
}

function voter(id)
{
	var xhr = getXMLHttpRequest();
	xhr.onreadystatechange = function() {
		if (xhr.readyState == 4 && (xhr.status == 200 || xhr.status == 0)) {
			var str=xhr.responseText;
			if(str=='err')
			{
				location.href='index.php?option=connexion';
			}
			else
			{
				window.location.reload();
			}
		}
	};
	document.getElementById(id).className='load';
	xhr.open("GET","js/traitement.php?voter="+id  , true);
	xhr.send(null);
}


/*function over(id)
{
	document.getElementById(id).className=id+'_current';
}
function out(id,id2)
{
	document.getElementById(id).className=id;
	//document.getElementById(id2).style.display='none'
}

function mouseOver(id)
{
	document.getElementById(id).style.display='block';
}*/


