<!--

	function SubmitSearchForm(ritorna) {
		var ok = 1;
		var ucod=document.edRicerca1.searchtext.value.toLowerCase();
		ucod=TrimSpaces(ucod);
		ucodmin=MinCar();
		if (ucod.length < ucodmin) {
			window.alert("Digitare i termini della ricerca");
			ok=0;
		}
		if (ok != 0) {
			document.edRicerca2.search.value = ucod;
			document.edRicerca2.submit();
		}
		if (ritorna == 1) {
			return false;
		}
	}
	
	function TrimSpaces(testo) {
		var ammessi="abcdefghijklmnopqrstuvwxyz0123456789אטילעש";
		var sleft = ",#.*"; var sright = "";
		while(testo.charAt(0) == " ") {
			lung=testo.length;
			testo = testo.substring(1,lung);
		}
		lung=testo.length;
		while(testo.charAt(lung-1) == " ") {
			testo = testo.substring(0,lung-1);
			lung=testo.length;
		}
		var n=0;
		var wasspace=0;
		var newTesto="";
		while (n < lung) {
			carattere=testo.charAt(n);
			if (carattere==" ") {
				if (wasspace==0) {
					newcar=sright + " " + sleft;
					wasspace=1;
				}
				else {
					newcar="";
				}
			}
			else {
				wasspace=0;
				newcar=carattere;
				if (ammessi.indexOf(newcar)<0) {
					newcar="";
				}
			}
			newTesto=newTesto + newcar;
			n=n+1;
		}
		testo=sleft + newTesto + sright;
		return testo;
	}

	function MinCar() {
		var sleft = ",#.*"; var sright = "";
		searchsepcar = sright + " " + sleft;
		searchmincar = searchsepcar.length;
		return searchmincar;
	}

	function RepGoTo() {
		selrepnum = document.edReparti.edRepartiMenu.selectedIndex;
		selrep = document.edReparti.edRepartiMenu.options[selrepnum].value;
		self.location = selrep;
	}

	function PopupImage(imageName, ww, wh) { 
		
		myNewWindow = window.open('', 'Dettaglio','width=' + ww +',height=' + wh + ',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0'); 
		myNewWindow.document.write("<HTML><HEAD><\/HEAD>");
		myNewWindow.document.write("<BODY leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>");
		myNewWindow.document.write("<IMG SRC='" + imageName + "'><\/BODY><\/HTML>");
		myNewWindow.document.close();
		myNewWindow.focus();
		
	} 
//-->

