<!--
function inputFocus(obj) {
/*	obj.style.borderStyle="solid";
	obj.style.borderWidth="thin";
	obj.style.borderColor="red"; */		
	obj.style.backgroundColor = "#FFFFCC";
	//obj.style.backgroundColor = "#E7F5F2";
}

function inputNormal(obj) {
/*	obj.style.borderStyle="";
	obj.style.borderWidth="";
	obj.style.borderColor=""; */
	obj.style.backgroundColor = "";
	lastname = obj.name;
}

function inputfocus(obj) {
/*	obj.style.borderStyle="solid";
	obj.style.borderWidth="thin";
	obj.style.borderColor="red"; */		
	obj.style.backgroundColor = "#FFFFCC";
	//obj.style.backgroundColor = "#E7F5F2";
}

function inputnormal(obj) {
/*	obj.style.borderStyle="";
	obj.style.borderWidth="";
	obj.style.borderColor=""; */
	obj.style.backgroundColor = "";
	lastname = obj.name;
}

function setCookie(NameOfCookie, value, expiredays) { 
	var ExpireDate = new Date (); 
	ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000)); 
	document.cookie = NameOfCookie + "=" + escape(value) + ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString()); 
} 

function getCookie(NameOfCookie){ 
    if (document.cookie.length > 0) {              
    begin = document.cookie.indexOf(NameOfCookie+"=");       
    if (begin != -1) {           
      begin += NameOfCookie.length+1;       
      end = document.cookie.indexOf(";", begin); 
      if (end == -1) end = document.cookie.length; 
        return unescape(document.cookie.substring(begin, end)); 
    } 
  } 
  return null; 
} 

function delCookie(NameOfCookie) { 
	if (getCookie(NameOfCookie)) { 
		document.cookie = NameOfCookie + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT"; 
	} 
} 

function Init() { 
	mensx = getCookie('MenuSxId');
//	mendx = getCookie('MenuDxId'); 
	if ((mensx!=null) && (mensx!=0)) {
		apri(mensx);
	}
//	if ((mendx!=null) && (mendx!=0)) {
//		apriDX(mendx);
//	}
} 


// Controllo della validità della data inserita
// Franco Bonanzi - franco@bonanzi.net
//
// Per eseguire il controllo aggiungere al campo della form:
// onBlur="return chkData(this)" 
function chkData(form) {
	campo = form.name;
	data = form.value;
	if (data != "") {
		var re = new RegExp("^(\\d{2})/(\\d{2})/(\\d{4})$", ""); 
		var aryMesi = new Array("Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre");  
		var dt = data.match(re);   
		if (!dt) {
			alert("La data va inserita nel formato gg/mm/aaaa !");      
			document.getElementById(campo).focus();
			return(false);    
		}  
		mese = dt[2];  
		giorno = dt[1];  
		anno = dt[3];   
		if (mese < 1 || mese > 12) {      
			alert("Specificare un mese compreso tra 1 e 12 !");
			document.getElementById(campo).focus();
			return(false);    
		}   
		// Determina il numero massimo di giorni nel mese  
		// Il calendario in uso è quello Gregoriano (introdotto da Papa Gregorio XIII nel 1582)  
		// ed ha un ciclo di 400 anni con 97 anni bisestili anziché 100.  
		// Il 1600 era bisestile, 1700, 1800 e 1900 no, il 2000 lo è, 2100, 2200, 2300 no etc.  
		if (mese == 2) maxDay = (!(anno % 4) && ((anno % 100) || !(anno % 400))) ? 29 : 28;  
		else maxDay = (mese == 4 || mese == 6 || mese == 9 || mese == 11) ? 30 : 31;   
		if (giorno < 1 || giorno > maxDay) {
			alert("Il mese di " + aryMesi[mese - 1] + " " + anno + " non ha " + giorno + " giorni\nSpecificare un giorno compreso tra 1 e " + maxDay + " !");
			document.getElementById(campo).focus();
			return(false);
		}
		return(true);
	}
}


// Controllo della validità della email inserita
// Franco Bonanzi - franco@bonanzi.net
//
// Per eseguire il controllo aggiungere al campo della form:
// onBlur="return chkMail(this)" 
function chkMail(form) {
	if (form.value != "") {
		var espressione = /^[_a-z0-9+-]+(\.[_a-z0-9+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$/;
		if (!espressione.test(form.value)) {
			alert("La mail inserita non è valida!");
			document.getElementById(form.name).focus();
			return(false);
		}
		else {
			return(true);
		}
	}
}


// Controllo della validità del numero inserito
// Franco Bonanzi - franco@bonanzi.net
//
// Per eseguire il controllo aggiungere al campo della form:
// onBlur="return chkNumero(this)" 
function chkNumero(form) {
	if (form.value != "") {
		var re = new RegExp(/^[-+]?([0-9])+((\.[0-9]+)+|(\,[0-9]+)?)$/);
		if (!re.test(form.value)) {
			alert("Formati numerici accettati:\n12345 oppure 12345 ;\n12345.67 oppure 12345,67");
			document.getElementById(form.name).focus();
			return false;
		}
		else {
			return true;
		}
	}
}


// Controllo della validità del numero di cellulare inserito
// Franco Bonanzi - franco@bonanzi.net
//
// Per eseguire il controllo aggiungere al campo della form:
// onBlur="return chkCell(this)" 
function chkCell(form) {
	if (form.value != "") {
		var re = new RegExp(/^[3]+(([0-9]{8})+|([0-9]{9}))$/);
		if (!re.test(form.value)) {
			alert("Il numero di telefono cellulare inserito non è valido");
			document.getElementById(form.name).focus();
			return false;
		}
		else {
			return true;
		}
	}
}


// Controlla se il valore inserito è numerico
// Franco Bonanzi - franco@bonanzi.net
//
// Per eseguire il controllo aggiungere al campo della form:
// onBlur="return isNumeric(this)" 
function isNumeric(form) {
	if (form.value != "") {
		var re = new RegExp(/^[0-9]/);
		if (!re.test(form.value)) {
			alert("Il campo accetta solo valori numerici.");
			document.getElementById(form.name).focus();
			return false;
		}
		else {
			return true;
		}
	}
}


function evidenzia(n) {
	document.getElementById("Riga"+n).style.backgroundColor = "#FFFFCC";
}

function normale(n) {
	document.getElementById("Riga"+n).style.backgroundColor = "";
}
//-->