// Elimina gli spazi a dx e sx nelle variabili
function Strip(string) {
   var s_str = string.length
   for (var i=0; i<string.length; i++) {
      if (" " != string.substring(i,i+1)) {
         s_str = i;
         break;
      }
   }
   if (s_str == string.length) {
      return "";
   }
   for (i=string.length-1; i>=0; i--) {
      if (" " != string.substring(i,i+1)) {
         var s_end = i;
         break;
      }
   }
   return string.substring(s_str,s_end+1);
}
function IsNumeric(input)
{
   return (input - 0) == input && input.length > 0;
}

// Funzione che rimanda all' URL specificato
function go(sel) {
	s_valore=sel.value
	//if (s_valore != "" && (s_valore.substring(0,4) == "form" || s_valore.substring(0,6) == "elenco")) { }
	document.location.href=sel[sel.selectedIndex].value
}


// Funzione che disabilita il pulsante passato come parametro per evitare che l'utente clicchi ripetutamente
function fDisabilitaPulsante(NumeroForm, NumeroCampo, Messaggio) {
	document.forms[NumeroForm].elements[NumeroCampo].disabled=true
	document.forms[NumeroForm].elements[NumeroCampo].value=Messaggio
}


// Funzione che apre una nuova finestra personalizzata
function popup(nomefile, larghezza, altezza, x, y) {
	var rand_no = Math.round(Math.random()*10000000)
   	win_popup = window.open(nomefile,rand_no,"toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=0,copyhistory=0,width=" + larghezza + ",height=" + altezza); 
   	if(x && y); {
    	x = parseInt(x);
     	y = parseInt(y);
     	win_popup.moveTo(x, y);
  	}
}

