<!--
	function TargetBlank() {
		for (var i=0; i<document.links.length; i++)
			if (document.links[i].className=="blank") {
				document.links[i].target="_blank";
		}
	}
	window.onload = TargetBlank;
	
	function InputChange(casella, classe) {
		casella.className = classe;
	}
	function GeneraPassword(plength) {
		var keylist = "abcdefghijklmnopqrstuvwxyz1234567890";
		temp = '';
		for (i=0; i<plength; i++)
			temp += keylist.charAt(Math.floor(Math.random() * keylist.length));
		return temp;
	}
	
	function CheckFormSearch() {
		return true;
		
		form = document.getElementById('frmSearch')
		re = /\s+$|^\s+/g;
		
		// Elimino gli spazi vuoti inseriti nelle caselle di testo del form
		form.cerca.value = form.cerca.value.replace(re, '');
		
		// Controlli specifici sui campi del form
		if (form.cerca.value.length < 3) {
			window.alert('E\' necessario inserire almeno tre caratteri');
			form.cerca.focus();
			return false;
		}
	}
	function CheckFormPrivate() {
		return true;
		
		form = document.getElementById('frmPrivate')
		re = /\s+$|^\s+/g;
		
		// Elimino gli spazi vuoti inseriti nelle caselle di testo del form
		form.usr.value = form.usr.value.replace(re, '');
		form.pwd.value = form.pwd.value.replace(re, '');
		
		// Controlli specifici sui campi del form
		if (form.usr.value == '') {
			window.alert('E\' necessario inserire un Nome Utente');
			form.usr.focus();
			return false;
		}
		if (form.pwd.value == '') {
			window.alert('E\' necessario inserire una Password');
			form.pwd.focus();
			return false;
		}
	}
	
	function FormatDate(DateToFormat,FormatAs) {
		if (DateToFormat == "") { return""; }
		if (!FormatAs) { FormatAs="dd/mm/yyyy"; }
		
		var strReturnDate;
		FormatAs = FormatAs.toLowerCase();
		DateToFormat = DateToFormat.toLowerCase();
		var arrDate
		var arrMonths = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
		var strMONTH;
		var Separator;
		
		while (DateToFormat.indexOf("st") > -1) {
			DateToFormat = DateToFormat.replace("st","");
		}
		while (DateToFormat.indexOf("nd") > -1) {
			DateToFormat = DateToFormat.replace("nd","");
		}
		while (DateToFormat.indexOf("rd") > -1) {
			DateToFormat = DateToFormat.replace("rd","");
		}
		while (DateToFormat.indexOf("th") > -1) {
			DateToFormat = DateToFormat.replace("th","");
		}
		if (DateToFormat.indexOf(".") > -1) {
			Separator = ".";
		}
		if (DateToFormat.indexOf("-") > -1) {
			Separator = "-";
		}
		
		if (DateToFormat.indexOf("/") > -1) {
			Separator = "/";
		}
		if (DateToFormat.indexOf(" ") > -1) {
			Separator = " ";
		}
		
		arrDate = DateToFormat.split(Separator);
		DateToFormat = "";
			for (var iSD = 0;iSD < arrDate.length;iSD++) {
				if (arrDate[iSD] != "") {
					DateToFormat += arrDate[iSD] + Separator;
				}
			}
		DateToFormat = DateToFormat.substring(0,DateToFormat.length-1);
		arrDate = DateToFormat.split(Separator);
		
		if(arrDate.length < 3){
			return "";
		}
		
		var DAY = arrDate[0];
		var MONTH = arrDate[1];
		var YEAR = arrDate[2];
		
		if (parseFloat(arrDate[1]) > 12) {
			DAY = arrDate[1];
			MONTH = arrDate[0];
		}
		if (parseFloat(DAY) && DAY.toString().length == 4) {
			YEAR = arrDate[0];
			DAY = arrDate[2];
			MONTH = arrDate[1];
		}
		
		for (var iSD = 0;iSD < arrMonths.length;iSD++) {
			var ShortMonth = arrMonths[iSD].substring(0,3).toLowerCase();
			var MonthPosition = DateToFormat.indexOf(ShortMonth);
				if (MonthPosition > -1) {
					MONTH = iSD + 1;
					if (MonthPosition == 0) {
						DAY = arrDate[1];
						YEAR = arrDate[2];
					}
					break;
				}
		}
		
		var strTemp = YEAR.toString();
		if (strTemp.length == 2) {
			if (parseFloat(YEAR) > 40) {
				YEAR = "19" + YEAR;
			} else {
				YEAR = "20" + YEAR;
			}
		}
		
		if (parseInt(MONTH)< 10 && MONTH.toString().length < 2) {
			MONTH = "0" + MONTH;
		}
		if(parseInt(DAY)< 10 && DAY.toString().length < 2) {
			DAY = "0" + DAY;
		}
		switch (FormatAs) {
			case "dd/mm/yyyy":
				return DAY + "/" + MONTH + "/" + YEAR;
			case "mm/dd/yyyy":
				return MONTH + "/" + DAY + "/" + YEAR;
			case "dd/mmm/yyyy":
				return DAY + " " + arrMonths[MONTH -1].substring(0,3) + " " + YEAR;
			case "mmm/dd/yyyy":
				return arrMonths[MONTH -1].substring(0,3) + " " + DAY + " " + YEAR;
			case "dd/mmmm/yyyy":
				return DAY + " " + arrMonths[MONTH -1] + " " + YEAR;	
			case "mmmm/dd/yyyy":
				return arrMonths[MONTH -1] + " " + DAY + " " + YEAR;
		}
		
		return DAY + "/" + strMONTH + "/" + YEAR;;
	}
	function IsDate(DateToCheck){
		if (DateToCheck == "") { return true; }
		var m_strDate = FormatDate(DateToCheck);
		if (m_strDate == "") {
			return false;
		}
		var m_arrDate = m_strDate.split("/");
		var m_DAY = m_arrDate[0];
		var m_MONTH = m_arrDate[1];
		var m_YEAR = m_arrDate[2];
		if (m_YEAR.length > 4) { return false; }
		m_strDate = m_MONTH + "/" + m_DAY + "/" + m_YEAR;
		var testDate = new Date(m_strDate);
		if (testDate.getMonth()+1 == m_MONTH) {
			return true;
		} else {
			return false;
		}
	}
	function Now() {
		var oggi    = new Date();
		
		var giorno  = oggi.getDate();
		var mese    = (oggi.getMonth() + 1);
		var anno    = oggi.getFullYear();
		var ora     = oggi.getHours();
		var minuti  = oggi.getMinutes();
		var secondi = oggi.getSeconds();
		
		return giorno + "/" + mese + "/" + anno + " " + ora + ":" + minuti + ":" + secondi;
	}
	function _Date() {
		var oggi   = new Date();
		
		var giorno = oggi.getDate();
		var mese   = (oggi.getMonth() + 1);
		var anno   = oggi.getFullYear();
		
		return giorno + "/" + mese + "/" + anno;
	}
	function Time() {
		var oggi    = new Date();
		
		var ora     = oggi.getHours();
		var minuti  = oggi.getMinutes();
		var secondi = oggi.getSeconds();
		
		return ora + ":" + minuti + ":" + secondi;
	}
	function IsNumeric(sText) {
		var ValidChars = "0123456789.";
		var IsNumber = true;
		var Char;
		
		for (i = 0; i < sText.length && IsNumber == true; i++)  {
			Char = sText.charAt(i);
			if (ValidChars.indexOf(Char) == -1) {
				IsNumber = false;
			}
		}
		return IsNumber;
	}
	
	function CheckCF(campo) {
		caratteri = new Array ("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z")
		pari = new Array (0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25)
		dispari = new Array (1,0,5,7,9,13,15,17,19,21,1,0,5,7,9,13,15,17,19,21,2,4,18,20,11,3,6,8,12,14,16,10,22,25,24,23)
		cod = campo.value.toLowerCase();
		check = true;
		
		if (cod.length != 16) {
			check = false
		} else {
			lettere = cod.substr(0,6) + cod.substr(8,1) + cod.substr(11,1) + cod.substr(15);
			numeri = cod.substr(6,2) + cod.substr(9,2) + cod.substr(12,3);
			
			for (i=0; i<10; i++) {
				if (lettere.charCodeAt(i)<97 || lettere.charCodeAt(i)>122) {
					check = false;
				}
			}
			for (i=0; i<8; i++) {
				if (numeri.charCodeAt(i)<48 || numeri.charCodeAt(i)>57) {
					check = false;
				}
			}
		}
		
		//checksum del codice fiscale
		test = cod.substr(15,1);
		var somma = 0
		for (i=0; i<16; i=i+2) { //dispari
			carattere = cod.substr(i,1)
			for (k=0; k<36; k++) {
				if (carattere == caratteri[k]) {
					somma = somma + dispari[k]
					break
				}
			}
		}
		for (i=1;i<15;i=i+2) { //pari
			carattere = cod.substr(i,1)
			for (k=0; k<36; k++){
				if (carattere == caratteri[k]) {
					somma = somma + pari[k]
					break
				}
			}
		}
		resto = somma % 26;
		var lettera = String.fromCharCode(97+resto);            
		if (test != lettera) {
			check = false;
		}
		return check;
	}
	function CheckIVA(sz_Codice) {
		var n_Val, n_Som1 = 0, n_Som2 = 0, lcv;
		
		if (sz_Codice.length!=11 || isNaN(parseFloat(sz_Codice)) || parseFloat(sz_Codice)<parseFloat(0))
			return false;
		
		for (lcv=0; lcv<9; lcv+=2) {
			n_Val = parseInt(sz_Codice.charAt(lcv));
			n_Som1 += n_Val;
			n_Val = parseInt(sz_Codice.charAt(lcv + 1));
			n_Som1 += Math.floor(n_Val / 5) + (n_Val<<1) % 10;
		}
		n_Som2 = 10 - (n_Som1 % 10);
		n_Val = parseInt(sz_Codice.charAt(10));
		if (n_Som2 == n_Val)
			return true;
		return false;
	}
//-->