function apri(param) {
window.open('',param,'name=Info, toolbar=no, scrollbars=yes,top=120, left=200, dependent=no, resizable=yes, width=700, height=390');
}

// funzione per assegnare l'oggetto XMLHttpRequest
// compatibile con i browsers più recenti e diffusi
function assegnaXMLHttpRequest() {
var XHR = null, browserUtente = navigator.userAgent.toUpperCase();

 // browser standard con supporto nativo
 // non importa il tipo di browser
 if(typeof(XMLHttpRequest) === "function" || typeof(XMLHttpRequest) === "object")
  XHR = new XMLHttpRequest();

 // browser Internet Explorer
 // è necessario filtrare la versione 4
 else if(
  window.ActiveXObject &&
  browserUtente.indexOf("MSIE 4") < 0
 ) {
 
  // la versione 6 di IE ha un nome differente
  // per il tipo di oggetto ActiveX
  if(browserUtente.indexOf("MSIE 5") < 0)
   XHR = new ActiveXObject("Msxml2.XMLHTTP");

  // le versioni 5 e 5.5 invece sfruttano lo stesso nome
  else
   XHR = new ActiveXObject("Microsoft.XMLHTTP");
 }

 return XHR;
} 


function isIE(){
  if(document.all){
    return true;
  }else{
    return false;
  }
}




function f(id,letta) {
	if (letta=="no") {
		var ajax = assegnaXMLHttpRequest();
		ajax.open("get", "script/aggiorna_notifiche.php?id="+id, false);
		ajax.send(null);

		var dive = document.getElementById(id);
		//div.style.font-weight='normal';
		dive.setAttribute("style","font-weight: normal;");
		if(isIE()){
			dive.style.fontWeight='normal';
		}
	}
}

function leggi(id) {
	var ajax = assegnaXMLHttpRequest();
	ajax.open("get", "script/leggi_notif.php?id="+id, false);
	ajax.send(null);	
	var div = document.getElementById("leggi");
	div.innerHTML = ajax.responseText;	
}


function elimina(id,letta) {
	/*if (letta=="no") { 	aggiorna_not(1,1);
	} else {
		aggiorna_not(0,1); }*/
		var aj = assegnaXMLHttpRequest();
		aj.open("get", "script/elimina_notifica.php?id="+id, false);
		aj.send(null);
		document.getElementById(id).style.display='none';
		//div.setAttribute("style","display: none;");	
		leggi("");
	}


function completa() {
	if(document.newMsg.group1[1].checked) {
	var div = document.getElementById('completamento');
	var L=document.newMsg.dest.value.length;
	if(L >= 3) {
	var ajax = assegnaXMLHttpRequest();
	ajax.open("get", "script/complete.php?nick="+document.newMsg.dest.value, false);
	ajax.send(null);
	div.innerHTML = ajax.responseText;
	} else {
	div.innerHTML = "";
	}
}

}