		var testoEliminazione = "Confermi l'eliminazione?";
		
		// Da associare a onkeyup negli input text di numeri decimali
		function digitDe(oText,nrSig,nrDec) {
			// nrSig numero di cifre significative
			// nrDec numero di cifre decimali
			var keyCode = this.event.keyCode;
			if ((keyCode == 0x0D) || (keyCode == 0x08) ||
					((keyCode >= 37) && (keyCode <= 40)) ||
					(keyCode == 0x09)) {
			// Invio o BackSpace
			// frecce
			// Tab
			// uscire senza ulteriori controlli
				return;
			}
			
			ris = oText.value;		
			
			// Controllo del numero di decimali
			if (((keyCode >= 0x30) && (keyCode <= 0x39)) ||
					((keyCode >= 96) && (keyCode <= 105)) || // numeri da tastiera numerica
					(keyCode == 0x2E) || (keyCode == 190) ||
					(keyCode == 0x2C) || (keyCode == 188)) {
			// Cifra
			// Punto
			// Virgola
				j = 0;
				i = ris.lastIndexOf(".");
				if (i==-1) 
					i = ris.lastIndexOf(",");
				if (i >= 0) {
					j = ris.length-1-i;
					if (j>nrDec) {
						ris = ris.substring(0,i+nrDec+1);			
					}
				}
			}
			
			// Controllo del numero di cifre significative
			if (((keyCode >= 0x30) && (keyCode <= 0x39)) ||		// numeri da tastiera
					((keyCode >= 96) && (keyCode <= 105)) ||	// numeri da tastiera numerica
					(keyCode == 0x2E) || (keyCode == 190) ||
					(keyCode == 0x2C) || (keyCode == 188)) {
			// Cifra
			// Punto
			// Virgola
				i = ris.lastIndexOf(".");
				if (i==-1) 
					i = ris.lastIndexOf(",");
				j=ris.length;
				if (i!=-1)
				{
					j--;
					if(i==1&&ris[i]=="0")
					{
						j--;
						for(i=2; i<ris.length; i++)
						{
							if(ris[i]==0)
							{
								j--;
							}
							else
							{
								i=ris.length;
							}
						}
					}
				}
				
				if (j>nrSig) {
					ris=ris.substring(0,nrSig);			
				}
			}

			// Traduco l'eventuale virgola in punto
			// Modifica 30/12/2002 luca ho tradotto eventuale punto in virgola!!!
			i = ris.indexOf(".");
			if (i >= 0) {
				ris = ris.substring(0,i)+","+ris.substring(i+1,ris.length);
			}
			// se ho modificato ris devo aggiornare
			// il campo di input
			if (ris != oText.value) 
				oText.value=ris;

		}
		
		// Da associare a onkeydown negli input text di numeri decimali
		function digitNr(oText,nrSig,nrDec) {
			// nrSig numero di cifre significative
			// nrDec numero di cifre decimali
			var keyCode=this.event.keyCode;
			if ((keyCode == 0x0D) || (keyCode == 0x08) ||
					((keyCode >= 0x30) && (keyCode <= 0x39)) ||
					(keyCode == 46)||						// tasto Canc
					((keyCode >= 37) && (keyCode <= 40)) ||
					((keyCode >= 96) && (keyCode <= 105)) || // numeri da tastiera numerica
					(keyCode == 0x09))
			{
			// Invio o BackSpace
			// Numero
			// frecce
			// Tab
			// uscire senza uleriori controlli
				return;
			}
			
			if(nrDec > 0)
			{
				if ((keyCode == 0x2C) || (keyCode == 188) ||
						(keyCode == 110) ||					// . da tastera numerica
						(keyCode == 0x2E) || (keyCode == 190)) {
				// Punto oppure Virgola
					if ((oText.value.indexOf(",")) >= 0) {
						// E' gia' presente il punto
						// setto a false il returnValue dell'evento
						this.event.cancelBubble=true;
						this.event.returnValue=false;
					}
					return;
				}
			}
			
			// Se non siamo gia' usciti
			// con return siamo in un caso
			// di carattere non consentito
			this.event.cancelBubble = true;
			this.event.returnValue = false;
		}
		
		function digitUm(oText,nrSig,nrDec)
		{
			digitDe(oText,nrSig,nrDec)
			updateUm(oText);
		}

		function updateUm(oText)
		{
			A = new String();
			B = new String();
			A = document.forms[0].PrezzoHidden.value;
			B = document.forms[0].TextRate.value;
			AA = A.replace (",",".");
			BB = B.replace (",",".");
			SchedaPrezzo.TextCambio1.value=AA*BB;		 
		}
		
		function apriLink(url, name, wantReturn)
		{
			url = url.replace("&amp;", "&");
			var win1;
			var features = '';
			if(name=='_self')
			{
				features = '';
			}
			else
			{
				if(name=='_blank')
				{
					features = 'links=yes, menubar=yes, toolbar=yes, scrollbars=yes, resizable=yes, status=yes, location=yes';
				}
				else
				{
					features = 'scrollbars=yes, resizable=yes, width=800, height=600, top=20, left=20';
				}
			}
			win1 = window.open(url, name, features)
			win1.focus();
			if(name=='_blank')
			{
				win1.moveTo(0,0);
				win1.resizeTo(window.screen.availWidth, window.screen.availHeight);		
			}
			if(wantReturn)
			{
				return false;
			}
		}	
		
		function clonaIndex()
		{
			var win1 = self.open('Index.aspx', '_self');
		}
		
		function clonaPagina()
		{
			var win1 = self.open(self.location, '_blank');
			win1.focus();
			win1.moveTo(0,0);
			win1.resizeTo(window.screen.availWidth, window.screen.availHeight);
		}
		
		
		
		function confermaEliminazione()
		{
			return self.confirm(testoEliminazione);
		}
		
		
		function confermaEliminazioneDG()
		{
			if (window.navigator.appName=="Netscape")
			{
				return confirm(testoEliminazione);
			}
			else
			{
				var TRinDelete= this.event.srcElement.parentElement.parentElement.parentElement.parentElement;
				TRinDelete.style.backgroundColor="#CC2222";
				var C = confirm(testoEliminazione);
				TRinDelete.style.backgroundColor="#FFFFFF";
				return C;
			}
		}
		
		function confermaSospensione()
		{
			return self.confirm("Confermi il passaggio allo stato sospeso?");
		}
				
		function catturaEnter(nomePulsante, e)
		{
			if(navigator.userAgent.indexOf("MSIE")!=-1)
			{
				if(event.keyCode==13)
				{
					document.forms[0].item(nomePulsante).click();
					this.event.returnValue = false;			
				}
			}
			else
			{
				if(e.which==13)
				{
					var v1 = self.document.forms[0].elements[nomePulsante];
					v1.click();
					return false;
				}
				return true;
			}
		}
		
		function catturaEnterValidato(nomePulsante, e)
		{
			if(navigator.userAgent.indexOf("MSIE")!=-1)
			{
				if(event.keyCode==13)
				{	
					__doPostBack(nomePulsante,'');						
					//document.forms[0].item().click();
					this.event.returnValue = false;			
				}
			}
			else
			{
				if(e.which==13)
				{
					__doPostBack(nomePulsante,'');						
					var v1 = self.document.forms[0].elements[nomePulsante];
					v1.click();
					return false;
				}
				return true;
			}
		}
		
		function setFocus(nomeControllo)
		{
			document.forms[0].item(nomeControllo).focus();			
		}
		
		function checkTextArea(idElement, maxLength)
		{
			var stringa = document.forms[0].item(idElement,0).value;
			if(stringa.length >= maxLength)
			{
				stringa = stringa.substr(0,maxLength-1);
				document.forms[0].item(idElement,0).value = stringa;
				return false;
			}			
			return true;
		}
		
		function chiudiPagina()
		{
			var win1 = self.opener;			
			self.close();
			if (win1 != null)
			{
				win1.focus();
			}
		}
		
		function backPagina()
		{
			if (history.length>0)
			{
				history.back();
			}
		}
		
		function ricaricaParent()
		{
			var win1 = self.opener;
			if (win1 != null)
			{
				win1.document.forms[0].submit();
			}
		}
		
		function chiudiRicaricaParent()
		{
			var win1 = self.opener;
			self.close();
			if (win1 != null)
			{
				win1.document.forms[0].submit();			
				win1.focus();
			}
		}
		
		
		function digitato(e)
		{		
			if(navigator.userAgent.indexOf("MSIE")!=-1)
			{
				if(event.keyCode==13)
				{
					event.returnValue = false;	
					document.forms[0].ButtonSearch.click();			
				}
			}
			else
			{
				if(e.which==13)
				{
					return false;
					document.forms[0].ButtonSearch.click();
				}
			}				
		}
		
		function apriPagina(url, name, features)
		{
		//alert(url+' '+name+' '+features);
		//name='';
		//features='menubar=no,width=800,height=600';
			url = url.replace("&amp;", "&");
			var win1;
			if(name=='_blank')
			{
				features = 'links=yes, menubar=yes, toolbar=yes, scrollbars=yes, resizable=yes, status=yes, location=yes';
			}
			win1 = window.open(url, name, features)
			win1.focus();
			if(name=='_blank')
			{
				win1.moveTo(0,0);
				win1.resizeTo(window.screen.availWidth, window.screen.availHeight);		
			}
		}
		
				
