	//funzione per controllare la lunghezza di una textarea
	function maxChars(ogg,maxchars)
	{
		if (ogg.value.length > maxchars){
		  ogg.value=ogg.value.substr(0,maxchars);
		}
	}
	
	//funzione per controllare il valore con una regexp
	function campoRegExp(campo,exp,messaggio)
	{
		var reg = exp
		if(!reg.test(campo.value)){
			alert(messaggio);
			campo.focus();
			return (0);
		}
	}
	
	//funzione per il redirect temporizzato
	function redirect(url,secondi)
	{
		if(url!=''){
			if(secondi==''||isNaN(secondi)) secondi = 5;
			window.setTimeout("window.location='"+url+"'",secondi*1000);}
	}
	
	function getIFrameDocument(aID){
	  // if contentDocument exists, W3C compliant (Mozilla)
	  if (document.getElementById(aID).contentDocument){
	    return document.getElementById(aID).contentDocument;
	  } else {
	    // IE
	    return document.frames[aID].document;
	  }
	}
	
	function popupComunicazione(param) {
		/*NewWin = open(pagename, winname, 'width='+w+',height='+h+',left=10,top=10,resizable='+res+',scrollbars='+scr);*/
		if (param == 'nuovo') 
			pagina = 'newComunicazione.asp';
		else
			pagina = 'index.asp';
		var width = 640
		var height = 560
		var winl = (screen.width - width) / 2;
		var wint = (screen.height - height) / 2;
		newWin = window.open('/comunicazioniInterne/'+pagina, 'popupComunicazioni', 'top='+wint+',left='+winl+',height='+height+',width='+width+',resizable=no,scrollbars=yes');
		newWin.focus();
	}
