function getXMLHttp()
{
	var req = null; 
	if(window.XMLHttpRequest)  
		req = new XMLHttpRequest(); 
	else 
	{
		try {
			  req = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try {
				    req = new ActiveXObject("Microsoft.XMLHTTP");
					  } catch (e2) {
				    req = null;
					  }
			}
	}
	return req;
}



function score(i,id,s)
{
	var ajax=getXMLHttp();
	ajax.onreadystatechange = function()
	{ 
		if(ajax.readyState == 4)
		{
			if(ajax.status == 200)
			{
				for(k=1;k<6;k++)
					document.getElementById('score' + k).className="score-slot";
				i.className="score-slot-select";
				document.getElementById('note').innerHTML='Votre vote a été pris en compte. Merci !';
			}
			else 
			{
				//i.style.backgroundColor="red";
			}
		};   
	}; 

	var url;
	url="/ajax_score.php?id=" + id + "&s=" + s;
	ajax.open("GET", url, true); 
  	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");  
	ajax.send(null);
}

function editCell(id,i)
{
	var ajax=getXMLHttp();
	ajax.onreadystatechange = function()
	{ 
		if(ajax.readyState == 4)
		{
			if(ajax.status == 200)
			{
				i.style.backgroundColor="#AFE125";
			}
			else 
			{
				i.style.backgroundColor="red";
			}
		};   
	}; 

	var url;
	url="/ajax_cells.php?action=EDIT&id=" + id + "&v=" + i.value;
	ajax.open("GET", url, true); 
  	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");  
	ajax.send(null);		
}
