	function aggiornaPagina()
	{
		this.document.forms[0].submit();
	}
	
	function apriPop(url, nome, width, height)
	{
		var winFeat = 'top=15, left=15, width='+width+', height='+height+', resizable=no, toolbars=no, resizable=no, scrollbars=yes, menubar=no, location=no, status=no';
		var win1 = self.open(url, nome, winFeat);
		win1.focus();
	}
	
	function apriPopNoScrollBars(url, nome, width, height)
	{
		var winFeat = 'top=15, left=15, width='+width+', height='+height+', resizable=no, toolbars=no, resizable=no, scrollbars=no, menubar=no, location=no, status=no';
		var win1 = self.open(url, nome, winFeat);
		win1.focus();
	}
	
	function apriPopButton(url, nome, width, height)
	{
		var winFeat = 'top=15, left=15, width='+width+', height='+height+', resizable=no, toolbars=no, resizable=no, scrollbars=yes, menubar=no, location=no, status=no';
		var win1 = self.open(url, nome, winFeat);
		win1.focus();
		return false;
	}
	
	// funzione da associare all'icona di editing
	function linkOver(o)
	{
		o.style.background="#ffcc00";	
		o.style.cursor="hand";
	}
	
	// funzione da associare all'icona di editing
	function linkOut(o)
	{
		o.style.textDecoration="none";
		o.style.background="transparent";
	}
	
	function goTo(url)
	{
		self.open(url, '_self');
	}
	
	function chiudiPop()
	{
		var win1 = self.opener;
		self.close();
		win1.focus();
	}
	
	function chiudiPopRicaricaParent()
	{
		var win1 = self.opener;
		self.close();
		win1.document.forms[0].submit();
		win1.focus();
	}
	
	function ricaricaParent()
	{
		var win1 = self.opener;
		if(win1!=null)
		{
			win1.document.forms[0].submit();
		}
	}
	
	function confermaEliminaOperazione()
	{
		var mex = 'Confermi l\'eliminazione dell\'operazione?\n';
		return confirm(mex);
	}
	
	function confermaEliminazione()
	{
		var mex = 'Confermi l\'eliminazione?'
		return confirm(mex);
	}
	
	function confermaEliminazioneConTesto(mex)
	{
		return confirm(mex);
	}
	
		
	// Massimizza la finestra
	function maximize(oWindow)
	{
		oWindow.moveTo(0,0);
		oWindow.resizeTo(screen.availWidth,screen.availHeight);
		oWindow.focus();
	}
	
	function showtip(current, text)
	{
		var thetitle = text.split("<BR>");
		if (thetitle.length>1)
		{
			var thetitles = "";
			for (i=0; i<thetitle.length; i++)
			{
				if(i>0)
				{
					thetitles += "\r\n";
				}
				thetitles += thetitle[i];
			}
			current.title = thetitles;		
		}
		else 
		{
			current.title = text;
		}
	}
	
	function avviaRicerca(nomePulsante, e)
	{	
		if(!e)
		{
			e = this.event;
		}
		
		var kCode = e.keyCode;
		if(kCode==0x0D)
		{
			var listElement = self.document.getElementsByName("__EVENTTARGET");
			if(listElement!=null && listElement.length>0)
			{
				listElement[0].setAttribute("value", nomePulsante);				
				self.document.forms[0].submit();
			}
			else
			{
				var listElement2 = self.document.getElementsByName(nomePulsante);
				listElement2[0].click();
			}
			return false;
		}
		
		return true;
	}	
	
	function controllaLunghezzaMin(oLoginName)
	{	
		var obj = document.getElementsByName(oLoginName);
		var l = obj[0].value.length;
		
		if(l > 0 && l < 6)
		{
			alert("La login deve contenere almeno 6 caratteri.");
			
			return false;
		}		
		
		return true;
	}
	
	function controllaProfilo(oProfilo1, oProfilo2)
	{	
		var obj1 = document.getElementsById(oProfilo1);
		var obj2 = document.getElementsById(oProfilo2);
		
		if(obj1.Checked || obj2.Checked)
		{
			return true;
		}
		else
		{
			alert("Occorre selezionare il profilo dell\'utente!");
			
			return false;
		}	
	}
	
	function Upper(textbox, val)
	{
		textbox.value = val.toUpperCase();
	}
		
	function ClientValidate(source, arguments)
	{	
		var obj1 = document.getElementsByName("Sezione7");
		var obj2 = document.getElementsByName("tbPercentuale");
		
		if(obj1[0].checked || obj1[1].checked || obj1[2].checked) 
		{	
			if(obj1[2].checked && obj2[0].value.length == 0)
			{
				arguments.IsValid = false;
			}
			else
			{
				arguments.IsValid = true;
			}
		}
		else
		{		
			arguments.IsValid = false;
		}
	}
	
	function textCounter( field, maxlimit, errmessMaxLenght )
	{	
		if ( field.value.length > maxlimit )
		{
			field.value = field.value.substring( 0, maxlimit );
			alert( errmessMaxLenght +' '+ maxlimit );
			return false;
		}
		else 
		{
			return true;
		}
	}
	
	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;
		}
	}	
