<!--
var http_revoke_auth = getHTTPObject();
var url_revoke_auth = "revoke_comment_auth.php?";

function handleHttpResponse_revoke_auth(i,tot) {
	if (http_revoke_auth.readyState == 4) {
		clearTimeout(timeout_revoke_auth);
		if(http_revoke_auth.status == 200 || http_revoke_auth.status == 304 || http_revoke_auth.status == 307){
			if(http_revoke_auth.responseText.indexOf('NO') == -1) {
				document.getElementById('div_area_info1').style.display = 'none';
				document.getElementById('riga_'+i).style.display = 'none';

				if(document.getElementById('riga_'+i).className == 'riga_dispari') k = 0;
				else k = 1;
				//imposta la classe corretta per le varie righe in modo da mantenere l'alternanza tra i colori
				for(j=i;j<=tot;j++) {
					if(document.getElementById('riga_'+j).style.display != 'none') {
						if(++k%2) document.getElementById('riga_'+j).className = 'riga_dispari';
						else document.getElementById('riga_'+j).className = 'riga_pari';
					}
				}
				
				//controlla se ci sono ancora righe visibili nella tabella, altrimenti la nasconde
				for(n=1;n<=tot;n++) {
					if(document.getElementById('riga_'+n).style.display != 'none')
						break;
				}
				if(n == tot+1) {
					document.getElementById('td_area_info1').innerHTML = 'Non ci sono pi&ugrave richieste di aggiunta commenti.';
					document.getElementById('div_area_info1').style.display = 'block';
					document.getElementById('div_area_info').style.display = 'none';
				}
			}
			else {
				document.getElementById('td_area_info1').innerHTML = "<table style='border: 0;'><tr style='background:#fff'><td>" + "Si sono verificati dei problemi. Si prega di ripetere l'operazione." + "</td></tr></table>";
			}
			occupato_revoke_auth = false;
			document.body.style.cursor = "auto";
		}
		else {
			document.getElementById('td_area_info1').innerHTML = "<table style='border: 0;'><tr style='background:#fff'><td>" + "Si sono verificati dei problemi. Si prega di ripetere l'operazione." + "</td></tr></table>";
			occupato_revoke_auth = false;
			document.body.style.cursor = "auto";
		}
	}
	else if(max_wait < 1000) {
		max_wait *= 1000;
		check = check_elapsed_time_revoke_auth(); 
	}
}


var occupato_revoke_auth = false;
function revoke_auth_xmlhttprequest(i,tot,class_name,comment) {
	if (!occupato_revoke_auth && http_revoke_auth) { 
		document.getElementById('td_area_info1').innerHTML = "<table style='border: 0;'><tr style=''><td valign='middle' style='width:50px;'>" + "<img src='./immagini/attesa.gif' width='42' height='42' alt='' /></td><td valign='middle'> Attendere prego..." + "</td></tr></table>";
		
		new_date = new Date();
		initial_time = new_date.getTime(); // tempo in millisecondi dell'inizio
		max_wait = 5; //tempo di attesa massima espresso in secondi
		
		document.body.style.cursor = "wait";
		var url_completo = url_revoke_auth+"classe="+encodeURIComponent(class_name)+"&commento="+encodeURIComponent(comment);
		http_revoke_auth.open("GET", url_completo, true);
		http_revoke_auth.onreadystatechange = function() {handleHttpResponse_revoke_auth(i,tot);}
		occupato_revoke_auth = true;
		http_revoke_auth.send(null);
	}
}

function check_elapsed_time_revoke_auth () {
	new_date = new Date();
	if((new_date.getTime() - initial_time) > max_wait) {
		http_revoke_auth.onreadystatechange = function(){return;};
		http_revoke_auth.abort();
		document.getElementById('td_area_info1').innerHTML = "<table style='border: 0;'><tr style='background:#fff'><td>" + "Spiacente, richiesta fallita. Si prega di ritentare tra qualche istante." + "</td></tr></table>";
		occupato_revoke_auth = false;
		document.body.style.cursor = "auto";
	}
	else {
		timeout_revoke_auth = setTimeout(check_elapsed_time_revoke_auth, 500);
	}
}

//-->
