









	function isNull(stringa) {
		if (String(stringa).replace(/\x20/gi,"")!="" && String(stringa).replace(/\x20/gi,"")!="null" && String(stringa).replace(/\x20/gi,"")!="undefined") {
			return false;
		} else {
			return true;
		}
	}

	function keyControlTEL() {
	/*
		tasti abilitati:
		  da 48 a 57 -> da '0' a '9'
	*/
		if ( !( (event.keyCode>=48) && (event.keyCode<=57) ) && !( event.keyCode==47 || event.keyCode==45 || event.keyCode==32) ) {
			elem = event.srcElement.name;
			eval("str = document.all." + elem + ".value");
			eval("document.all." + elem + ".value = str");
			event.returnValue = false;
		}
	}
	
	function keyControlEscludiApice(){
		if ( event.keyCode==34)  {
			elem = event.srcElement.name;
			eval("str = document.all." + elem + ".value");
			eval("document.all." + elem + ".value = str");
			event.returnValue = false;
		}
	
	}
	
	
	function keyControlNUM(punto) {
	/*
		tasti abilitati:
		  da 48 a 57 -> da '0' a '9'
	*/
		if ( !( (event.keyCode>=48) && (event.keyCode<=57) ) && !( punto && event.keyCode==46) ) {
			elem = event.srcElement.name;
			eval("str = document.all." + elem + ".value");
			eval("document.all." + elem + ".value = str");
			event.returnValue = false;
		}
	}
	
	function keyControlLET() {
	/*
		tasti abilitati:
		  da 48 a 57 -> da '0' a '9'
	*/
		if ( !( ( (event.keyCode>=65) && (event.keyCode<=90) ) || ( (event.keyCode>=97) && (event.keyCode<=122) ))   ) {
			elem = event.srcElement.name;
			eval("str = document.all." + elem + ".value");
			eval("document.all." + elem + ".value = str");
			event.returnValue = false;
		}
	}	
	
	function keyControlNUM_LET() {
	/*
		tasti abilitati:
		  da 48 a 57 -> da '0' a '9'
	*/
		if ( !( ( (event.keyCode>=48) && (event.keyCode<=57) ) || ( (event.keyCode>=65) && (event.keyCode<=90) ) || ( (event.keyCode>=97) && (event.keyCode<=122) ))   ) {
			elem = event.srcElement.name;
			eval("str = document.all." + elem + ".value");
			eval("document.all." + elem + ".value = str");
			event.returnValue = false;
		}
	}	

	function keyControlSubmit(comandoSubmit) {
		if ( event.keyCode==13 ) {
			eval(comandoSubmit);
		}
	}
	
	function keyToUpper() {
		event.keyCode = String(String.fromCharCode(event.keyCode).toUpperCase()).charCodeAt(0);
	}
	
	function trasformaNumeroInStringa(Numero, Cifre, CifreDecimali) {
		if ( Number(Numero) < 0 ) {
			var NumeroNegativo = true;
			Numero = Math.abs(Numero);
		} else {
			var NumeroNegativo = false;
		}
		if ( CifreDecimali==0 || isNull(CifreDecimali) ) {
			var NumeroStr = String(Math.round(Numero));
			if ( NumeroStr.length < Cifre ) {
				var Ncifre = Cifre-NumeroStr.length;
				for (var i=1;i<=Ncifre;i++) {
					NumeroStr = "0" + NumeroStr;
				}
			} else {
				NumeroStr = NumeroStr.substr(0,Cifre);
			}
			return ( ((NumeroNegativo)?"-":"") + NumeroStr );
		} else {
			var NumeroStr = String(Numero);
			var ParteIntera = NumeroStr.substr(0,NumeroStr.indexOf("."));
			if ( isNull(ParteIntera) ) {
				ParteIntera = NumeroStr;
				var ParteDecimale = "";
			} else {
				var ParteDecimale = NumeroStr.substr(NumeroStr.lastIndexOf(".")+1);
				if ( Number(ParteDecimale) == 0 )
					ParteDecimale = "0";
			}
			if ( ParteIntera.length < Cifre ) {
				var Ncifre = Cifre-ParteIntera.length;
				for (var i=1;i<=Ncifre;i++) {
					ParteIntera = "0" + ParteIntera;
				}
			} else {
				ParteIntera = ParteIntera.substr(0,Cifre);
			}
			if ( ParteDecimale.length < CifreDecimali ) {
				Ncifre = CifreDecimali-ParteDecimale.length;
				for (i=1;i<=Ncifre;i++) {
					ParteDecimale = ParteDecimale + "0";
				}
			} else if ( ParteDecimale.length > CifreDecimali ) {
				var ZeroPrima = false;
				if ( ParteDecimale.substr(0,1) == "0" && ParteDecimale.substr( (CifreDecimali-1), 1 ) <= "5" ) {
					ZeroPrima = true;
				}
				ParteDecimale = Math.round( Number(ParteDecimale) / Math.pow( 10, ( ParteDecimale.length - CifreDecimali ) ) );
				if ( ZeroPrima ) {
					ParteDecimale = "0" + ParteDecimale;
				}
			}
			return ( ((NumeroNegativo)?"-":"") + ParteIntera + "." + String(ParteDecimale).substr(0,CifreDecimali) );
		}
	}
	
//Funzione richiamata al caricamento delle pagine centrali
//per caricare la testa ed il piede
function f_carica2(img_titolo, listaBottoni)
{
	parent.UpMain.location.replace("VisualizzaTitolo2.asp?IMG="+img_titolo);

	if(listaBottoni == "")
	{
		parent.SubMain.location.replace("about:blank");
	}
	else
	{
		parent.SubMain.location.replace("../contents/FolderAcsiPiede.asp?"+listaBottoni);
	}
	return;
}

//Funzione richiamata al caricamento delle pagine centrali
//per caricare la testa ed il piede vuoto
function f_carica(img_titolo)
{
	parent.UpMain.location.replace("VisualizzaTitolo2.asp?IMG="+img_titolo);
	parent.SubMain.location.replace("about:blank");
	return;
}

//Generazione dei bottoni
function f_creaBottone(nome)
{
	var azione = "parent.Main." + nome + "()"
	
	var button = "<INPUT class='blus' type='button' name='cmd" + nome + "' "
				+ "onMouseOver=\"style.color='#ffffff'; style.cursor='hand'\" "
				+ "onMouseOut=\"style.color='#99ccff';\" "
				+ "value=' " + nome + " ' onClick='" + azione + ";'> ";
	
	document.writeln(button);

	return;
}


	


function Stilebody()
	{
		document.write('<style>BODY{scrollbar-face-color: #306898;scrollbar-shadow-color: #ffffff;scrollbar-highlight-color: #ffffff;scrollbar-3dlight-color: #306898;scrollbar-darkshadow-color: #000000;scrollbar-track-color: #ffffff;scrollbar-arrow-color: #ffffff}</style>')
	}