function changev(voto) {
  if(votato!=1){
	document.getElementById("cosa").innerHTML="";
	for (var x = 1; x <= voto; x++)
	   {
		document.getElementById("image"+x).src=eval("voto"+x).src;
	   }
  }
}

//AJAX
var xmlHttp;

function inviavoto(voto,idcorso) {
	//INITIALIZE AUTOCOMPLETE ARRAY ON SERVER
	createXMLHttpRequest();   
	var url = "commentiinvio.php?finito=1&voto="+escape(voto)+"&idcorso="+ escape(idcorso);
	xmlHttp.open("GET", url, true);
	xmlHttp.onreadystatechange = callbackvoto;
	xmlHttp.send(null);	
}

function callbackvoto() {
	if (xmlHttp.readyState == 4) {
		if (xmlHttp.status == 200) {
			var name = xmlHttp.responseXML.getElementsByTagName("name")[0].firstChild.data;
			document.getElementById("cosa").innerHTML=name;
			//setNames("",xmlHttp.responseXML.getElementsByTagName("name"),xmlHttp.responseXML.getElementsByTagName("length"));
		} else if (xmlHttp.status == 204){
			clearNames();
		}
	}
}
