<!--

   function create_form(w,h,mio,page) {
	 window.open(page,'newest', 'scrollbars=yes,status=yes,resizable=yes,width='+w+',height='+h+'')
      
   }

   function create_form_nores(w,h,mio,page) {
	 window.open(page,'newest', 'scrollbars=yes,status=yes,width='+w+',height='+h+'')
      
   }
   
/******************************************************   
  Funzioni di controllo e calcolo coordinate bancarie      
*******************************************************/
function checkNotNull_IBAN(abi_field, cab_field, cc_field, cin_field, iban_field)
{
	    if(abi_field.value.search(/^[0-9]{5}$/)==-1)
			{
			  abi_field.focus();
			  alert("ABI non valido. Inserire 5 cifre."); 
			  return(0);
			}
			   
			//verifica CAB:
			if(cab_field.value.search(/^[0-9]{5}$/)==-1)
			{
			  cab_field.focus();
			  alert("CAB non valido. Inserire 5 cifre."); 
			  return(0);
			}
			
			//Domanda se Numero Conto Corrente, CIN e IBAN VUOTI:
			if ((iban_field.value == "") && (cc_field.value == "") && (cin_field.value == "")) 
			{
				 var answer = confirm ("Conto Corrente, Cin e IBAN non validi!\nConfermi?")
		     if (answer)
			     return ( 1 );
			   else
			   {
			   	 cc_field.focus();
			   	 return(0); 
			   }	    
			}
			else
			{	
				if(cc_field.value.search(/^[a-zA-Z0-9]{12}$/)==-1)
				{
				   cc_field.focus();
				   alert("Numero di C/C non valido!\nInserire 12 caratteri alfanumerici."); 
				   return(0);
				}
				
				
				//verifica Numero Conto Corrente:
				if(cc_field.value.search(/^[a-zA-Z0-9]{12}$/)==-1)
				{
				   cc_field.focus();
				   alert("Numero di C/C non valido!\nInserire 12 caratteri alfanumerici."); 
				   return(0);
				}
				
				
		
		
				if (iban_field.value != "")
				{		 
					  //verifica Iban:
						if(iban_field.value.search(/^[a-zA-Z0-9]{27}$/)==-1)
						{
						   iban_field.focus();
						   alert("Iban non valido!\nInserire 27 caratteri alfanumerici."); 
						   return(0);
						}
						else
						{	
					    //if (chk_iban(false) == 0) 
					    if (chk_iban(false,abi_field, cab_field, cc_field, cin_field, iban_field) == 0)  
					      return ( 0 );
					    else
					 	    return ( 1 );
					 	}
				}
				else
				{
					if (clc_ciniban(abi_field, cab_field, cc_field, cin_field, iban_field) == 0)  
					   return ( 0 );
					else
						 return ( 1 );
				}	
		}	
}



function chk_iban(messaggio_se_corretto, abi_field, cab_field, cc_field, cin_field, iban_field)
{
	
	var b = iban_field.value.toUpperCase();
	if (b.length < 27) 
	{ 
		 alert("La lunghezza dell'IBAN è minore di 27 caratteri"); 
		 iban_field.focus();  
		 return (0); 
	}                         
      s = b.substring(4) + b.substring(0, 4); 
      for (i = 0, r = 0; i < s.length; i++ ) 
      { 
        c = s.charCodeAt(i); 
        if (48 <= c && c <= 57) 
        { 
                if (i == s.length-4 || i == s.length-3) { alert("IBAN ERRATO!\nI primi due caratteri dell'IBAN non possono contenere cifre."); iban_field.focus(); return (0); } 
                k = c - 48; 
        } 
        else if (65 <= c && c <= 90) 
        { 
                if (i == s.length-2 || i == s.length-1) { alert("IBAN ERRATO!\nTerzo e quarto carattere dell'IBAN non possono contenere lettere."); iban_field.focus(); return (0); } 
                k = c - 55; 
        }               
        if (k > 9) 
                r = (100 * r + k) % 97; 
        else 
                r = (10 * r + k) % 97; 
      } 
      if (r != 1) { alert("IBAN ERRATO!\nIl codice di controllo è errato"); iban_field.focus(); return (0); } 
      if (messaggio_se_corretto == true) 
         alert("L'IBAN risulta corretto"); 
      
      if (abi_field.value == "")
        abi_field.value = b.substring(5,10); 
      else if (abi_field.value != b.substring(5,10))
      {	alert("Codice ABI inserito NON CORRISPONDE al codice IBAN!"); abi_field.focus();	return(0); }
      
      if (cab_field.value == "")
        cab_field.value = b.substring(10,15); 
      else if (cab_field.value != b.substring(10,15))
      {	alert("Codice CAB inserito NON CORRISPONDE al codice IBAN!"); cab_field.focus();	 return(0); }
      
      if (cc_field.value == "")
        cc_field.value = b.substring(15,27).toUpperCase(); 
      else if (cc_field.value.toUpperCase() != b.substring(15,27).toUpperCase())
      {	alert("C/C inserito NON CORRISPONDE al codice IBAN!"); cc_field.focus();	return(0); }
           
      if (cin_field.value == "")
        cin_field.value = b.substring(4,5).toUpperCase(); 
      else if (cin_field.value.toUpperCase() != b.substring(4,5).toUpperCase())
      {	alert("CIN inserito NON CORRISPONDE al codice IBAN!"); cin_field.focus();	return(0); }
            
      return (1); 
}
 
function clc_ciniban(abi_field, cab_field, cc_field, cin_field, iban_field)
{
	//var form = document.form1;
	
	//verifica ABI:
//	if(abi_field.value.search(/^[0-9]{5}$/)==-1)
//	{
//	  abi_field.focus();
//	  alert("ABI non valido. Inserire 5 cifre."); 
//	  return(0);
//	}
//	   
//	//verifica CAB:
//	if(cab_field.value.search(/^[0-9]{5}$/)==-1)
//	{
//	  cab_field.focus();
//	  alert("CAB non valido. Inserire 5 cifre."); 
//	  return(0);
//	}
//	
//	//verifica Numero Conto Corrente:
//	if(cc_field.value.search(/^[a-zA-Z0-9]{12}$/)==-1)
//	{
//	   cc_field.focus();
//	   alert("Numero di C/C non valido!\nInserire 12 caratteri alfanumerici."); 
//	   return(0);
//	}
	
	var NCC=cc_field.value.toUpperCase()
  var bban=calcola_BBAN(abi_field.value,cab_field.value,NCC);
  var iban=calcola_IBAN(bban);

  cin_field.value=bban.charAt(0);
  iban_field.value=iban;
  
  return ( 1 );

}


//function checkN(o)
//{
//  o.style.borderColor=((o.value.search(/^\s*[0-9]{0,7}\s*$/)==0)?'':'#ff0000 #ff0000 #ff0000 #ff0000');
//}
//function checkA(o)
//{
//	o.style.color="";
//	o.style.borderColor="#a0a0a0 #f0f0f0 #f0f0f0 #a0a0a0";
//	if(o.value.search(/^\s*[0-9]{0,7}\s*$/)==-1)
//	if(o.value.search(/^\s*[0-9A-Z]{0,7}\s*$/i)==0)
//		o.style.color='#800000';
//	Else
//	{	o.style.color="#ff0000";
//		o.style.borderColor="#ff0000 #ff0000 #ff0000 #ff0000";
//  }
//}

function calcola_BBAN(pABI,pCAB,pNCC)
{
	var vABI=r0(pABI,5);
	var vCAB=r0(pCAB,5);
	var vNCC=r0(pNCC,12);
	if( vABI.search(/^[0-9]{5}$/)==-1
	||vCAB.search(/^[0-9]{5}$/)==-1
	||vNCC.search(/^[0-9A-Z]{12}$/)==-1
	)return("");
	chS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	odA=new Array(1,0,5,7,9,13,15,17,19,21,1,0,5,7,9,13,15,17,19,21,2,4,18,20,11,3,6,8,12,14,16,10,22,25,24,23);
	evA=new Array(0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25);
	var DAN=""+vABI+vCAB+vNCC;
	var s=0;
	var i=-1;
	while(i!==21)
	{
		 s+=odA[chS.indexOf(DAN.charAt(++i))]
	   +evA[chS.indexOf(DAN.charAt(++i))];
  }
  return(chS.charAt(10+s%26)+vABI+vCAB+vNCC);
}
function calcola_IBAN(pBBAN){
	if(pBBAN.search(/^[A-Z][0-9]{5}[0-9]{5}[A-Z0-9]{12}$/)==-1)
	return("");
	var vIBAN=pBBAN+"IT00";
	var w="";
	for(var i=0;i<27;i++)
	w+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf(vIBAN.charAt(i));
	while(w.length>2)
	w=parseInt(w.substr(0,7),10)%97+w.substr(7);
	return("IT"+r0(98-parseInt(w,10)%97,2)+pBBAN);
}

function r0(s,l)
{
	var c=""+s;while(c.length<l)c="0"+c;return(c);
}

 
   
/**************************************
	Controllo del Codice Fiscale
***************************************/
function ControllaCF(cf)
{
	
	var validi, i, set1, set2;
	if( cf == '' )  return (false);
	cf = cf.toUpperCase();
	if( cf.length != 16 ) 
	{
		alert( "La lunghezza del codice fiscale non è\n"
		+"corretta: il codice fiscale dovrebbe essere lungo\n"
		+"esattamente 16 caratteri.");
		return(false);
	}
	/*
	validi = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
	for( i = 0; i < 16; i++ ){
		if( validi.indexOf( cf.charAt(i) ) == -1 )
		{
			alert( "Il codice fiscale contiene un carattere non valido `" +
				cf.charAt(i) +
				"'.\nI caratteri validi sono le lettere e le cifre.\n");
				return(false);
		}
	}
	*/
	
	//Controllo sulla correttezza dei singoli caratteri
	if (ControllaCorrettezzaChar_CF(cf) == 0 )
	  return ( false );
	
	
	//Controllo sulla correttezza dei singoli caratteri
	if (ControllaCheckDigit(cf) == 0 )
	  return ( false );
	  
	return (true);
	
}


//Funzione che controlla se tutti i caratteri del codice fiscale sono fattibili
//Return != 0 se ok
//Return 0 se not ok
function ControllaCorrettezzaChar_CF(strCodFisc)
{	
	var bolLettera = true;
	var lettera_data = false;
	var i, intGiorno;
	
	var mesi = "ABCDEHLMPRST"
	
	var lettera = /^[A-Z]/;
	var numero = /^[0-9]/;
		
	// controllo dei primi 6 caratteri alfabetici
	for (i=0; i<6; i++)
	{			
			if (!lettera.test(strCodFisc.charAt(i)))           
			{				                                     				                                      
			     alert( "Il codice fiscale non è corretto:\n"+
			            "carattere (" + strCodFisc.charAt(i) +" nella posizione " + String(i+1) + ") non ammesso.");
			     return (0);	
			}		
	}

	//Controllo Anno
	for (i=6; i<8; i++)
	{
		if (!numero.test(strCodFisc.charAt(i)))           
			{				                                     				                                      			     
			     //Controllo omocodia
			     if (	(strCodFisc.charAt(i) != 'L') && (strCodFisc.charAt(i) != 'M') && 
								(strCodFisc.charAt(i) != 'N') && (strCodFisc.charAt(i) != 'P') && 
								(strCodFisc.charAt(i) != 'Q') && (strCodFisc.charAt(i) != 'R') &&
								(strCodFisc.charAt(i) != 'S') && (strCodFisc.charAt(i) != 'T') &&
								(strCodFisc.charAt(i) != 'U') && (strCodFisc.charAt(i) != 'V'))
								{
			            alert( "Il codice fiscale non è corretto:\n"+
			            "Anno errato!");
			            return (0);	
			          }
			    else
			    	lettera_data = true;      
			}		
	}	
	
  // controllo del mese
	if (!
			((strCodFisc.charAt(8) == 'A') || (strCodFisc.charAt(8) == 'B') || 
			(strCodFisc.charAt(8) == 'C') || (strCodFisc.charAt(8) == 'D') ||
			(strCodFisc.charAt(8) == 'E') || (strCodFisc.charAt(8) == 'H') ||
			(strCodFisc.charAt(8) == 'L') || (strCodFisc.charAt(8) == 'M') ||
			(strCodFisc.charAt(8) == 'P') || (strCodFisc.charAt(8) == 'R') ||
			(strCodFisc.charAt(8) == 'S') || (strCodFisc.charAt(8) == 'T'))
		 )
	{ 
		  alert( "Il codice fiscale non è corretto:\n"+
			            "Mese errato!");	
			return (0);	
  }
  
  //Controllo Giorno  
	for (i=9; i<11; i++) 
	{		
		if (!numero.test(strCodFisc.charAt(i)))           
			{				                                     				                                      
	         //Controllo omocodia 		
			     if (	
			           (strCodFisc.charAt(i) != 'L') && (strCodFisc.charAt(i) != 'M') && 
								(strCodFisc.charAt(i) != 'N') && (strCodFisc.charAt(i) != 'P') && 
								(strCodFisc.charAt(i) != 'Q') && (strCodFisc.charAt(i) != 'R') &&
								(strCodFisc.charAt(i) != 'S') && (strCodFisc.charAt(i) != 'T') &&
								(strCodFisc.charAt(i) != 'U') && (strCodFisc.charAt(i) != 'V'))
								{
			              alert( "Il codice fiscale non è corretto:\n"+
			                     "Giorno errato!");
			              return (0);		
			          }
			    else 
			    	lettera_data = true; 
			}
	}
	
	if (lettera_data == false)
	{
	
	//Controllo data completa	
	if (strCodFisc.substring(9,10) == "0")
	  intGiorno = parseInt(strCodFisc.substring(10,11));
	else
		intGiorno = parseInt(strCodFisc.substring(9,11));   
	
	if (intGiorno > 31)
	   intGiorno -= 40;
	if (intGiorno <1 || intGiorno > 31)
	{
			alert( "Il codice fiscale non è corretto:\n"+
			                     "Giorno errato!");
			return (0);	
  }
  
	LetteraMese = strCodFisc.substring(8,9); 
	intMese = mesi.indexOf(LetteraMese) + 1;
	intAnno = parseInt(strCodFisc.substring(6,8)); 
	
	
	if (String(intGiorno).length == 1)
	  stringaGiorno = "0"+String(intGiorno);
	else
		stringaGiorno = String(intGiorno);
	
	
	if (String(intMese).length == 1) 
	  stringaMese = "0" + String(intMese);
	else
		stringaMese = String(intMese);
		
	
	stringadata = stringaGiorno + stringaMese + String(intAnno);
	
	if (check_date(stringadata) == 0)
	  return (0);	
	  
	}
		
	// controllo del 1° carattere del codice catastale
	if ( ((strCodFisc.charAt(11) != 'A') && (strCodFisc.charAt(11) != 'B') &&
				(strCodFisc.charAt(11) != 'C') && (strCodFisc.charAt(11) != 'D') &&
				(strCodFisc.charAt(11) != 'E') && (strCodFisc.charAt(11) != 'F') &&
				(strCodFisc.charAt(11) != 'G') && (strCodFisc.charAt(11) != 'H') &&
				(strCodFisc.charAt(11) != 'I') && (strCodFisc.charAt(11) != 'L') &&
				(strCodFisc.charAt(11) != 'M') && (strCodFisc.charAt(11) != 'Z'))
		)
	{
			alert( "Il codice fiscale non è corretto:\n"+
			      "Lettera del codice catastale ("+ strCodFisc.charAt(11) +") errata!");
			return (0);
	}

	for (i=12; i<15; i++)
  {
   if (!numero.test(strCodFisc.charAt(i)))   
   {
     //Controllo omocodia
     bolLettera = true;
     if (	(strCodFisc.charAt(i) != 'L') && (strCodFisc.charAt(i) != 'M') && 
         	(strCodFisc.charAt(i) != 'N') && (strCodFisc.charAt(i) != 'P') && 
					(strCodFisc.charAt(i) != 'Q') && (strCodFisc.charAt(i) != 'R') &&
					(strCodFisc.charAt(i) != 'S') && (strCodFisc.charAt(i) != 'T') &&
					(strCodFisc.charAt(i) != 'U') && (strCodFisc.charAt(i) != 'V'))
					{
							alert( "Il codice fiscale non è corretto:\n"+
			               "Codice catastale errato!");
							return (0);
					}		
	 }
	}
	
	if (bolLettera == false)
	{
			intNumeroCodCat = parseInt(strCodFisc.substring(12,15));

			if (intNumeroCodCat == 000)
			{
							alert( "Il codice fiscale non è corretto:\n"+
			               "Codice catastale errato!");
							return (0);
			}		
      // se lettera M le 3 cifre del cod. cat. non > di 399 
			if ((strCodFisc.charAt(11) == 'M') && (intNumeroCodCat > 399)) 
			{
							alert( "Il codice fiscale non è corretto:\n"+
			               "Codice catastale errato!");
							return (0);
			}		 
	}	
}

function check_date(field){
var Datevalue;
var DateTemp = "";
var day;
var month;
var year;
var leap = 0;
var err = 0;
var i;
   err = 0;
   
   DateValue = field;
   /* Always change date to 8 digits - string*/
   /* if year is entered as 2-digit / always assume 20xx */
   if (DateValue.length == 6) {
      DateValue = DateValue.substr(0,4) + '20' + DateValue.substr(4,2); }
   if (DateValue.length != 8) {
      err = 19;}
   /* year is wrong if year = 0000 */
   year = DateValue.substr(4,4);
   if (year == 0) {
      err = 20;
   }
   
   /* Validation of month*/
   month = DateValue.substr(2,2);
   
   if ((month < 1) || (month > 12)) {
      err = 21;
   }
   /* Validation of day*/
   day = DateValue.substr(0,2);
   
   if (day < 1) {
     err = 22;
   }
   /* Validation leap-year / february / day */
   if ((year % 4 == 0) || (year % 100 == 0) || (year % 400 == 0)) {
      leap = 1;
   }
   if ((month == 2) && (leap == 1) && (day > 29)) {
      err = 23;
   }
   if ((month == 2) && (leap != 1) && (day > 28)) {
      err = 24;
   }
   /* Validation of other months */
   if ((day > 31) && ((month == "01") || (month == "03") || (month == "05") || (month == "07") || (month == "08") || (month == "10") || (month == "12"))) {
      err = 25;
   }
   
   if ((day > 30) && ((month == "04") || (month == "06") || (month == "09") || (month == "11"))) {
      err = 26;
   }
   /* if 00 ist entered, no error, deleting the entry */
   if ((day == 0) && (month == 0) && (year == 00)) {
      err = 0; day = ""; month = ""; year = ""; seperator = "";
   }     
   
   if (err == 0) {
      return ( 1 );      
   }
  
   /* Error-message if err != 0 */
   else {
      alert( "Il codice fiscale non è corretto:\n"+
			"la data ("+ String(day) + "/" + String(month) + "/" + DateValue.substr(6,2) +") non è corretta.\n");
	    return ( 0 );
   }
}


//Controllo codice di controllo
function ControllaCheckDigit(strCodFisc)
{
  var i, s, set1, set2, setpari, setdisp;	
	
	set1 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	set2 = "ABCDEFGHIJABCDEFGHIJKLMNOPQRSTUVWXYZ";
	setpari = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	setdisp = "BAKPLCQDREVOSFTGUHMINJWZYX";
	s = 0;
	for( i = 1; i <= 13; i += 2 )
		s += setpari.indexOf( set2.charAt( set1.indexOf( strCodFisc.charAt(i) )));
	for( i = 0; i <= 14; i += 2 )
		s += setdisp.indexOf( set2.charAt( set1.indexOf( strCodFisc.charAt(i) )));
	if( s%26 != strCodFisc.charCodeAt(15)-'A'.charCodeAt(0) )
	{
		alert( "Il codice fiscale non è corretto:\n"+
			"il codice di controllo non corrisponde.\n");
	  return(0);
	}	
	return (1);
	
}


/**************************************
	Controllo della Partita IVA
***************************************/
function ControllaPIVA(piva,nomecampo)
{
	if( piva == '' )  return (false);
	if( piva.length != 11 )
	{
       if (nomecampo == '')
              alert( "La lunghezza della partita IVA non è\n" +
			               "corretta: la partita IVA dovrebbe essere lunga\n" +
			               "esattamente 11 caratteri.\n");		
			 else
			 	      alert( "La lunghezza della partita IVA\n" +
			 	             "inserita nel campo " + nomecampo +"\n" +
			               "non è corretta: la partita IVA dovrebbe essere lunga\n" +
			               "esattamente 11 caratteri.\n");		
		return (false);
	}
	validi = "0123456789";
	
	for( i = 0; i < 11; i++ )
	{
		if( validi.indexOf( piva.charAt(i) ) == -1 )
		{
			  if (nomecampo == '')
			    alert( "La partita IVA contiene un carattere non valido `" +
				  piva.charAt(i) + "'.\nI caratteri validi sono le cifre.\n");
				else
					alert( "La partita IVA inserita nel campo " + nomecampo + "\n" +  
					"contiene un carattere non valido `" +
				  piva.charAt(i) + "'.\nI caratteri validi sono le cifre.\n");
			return (false);	
		}
	}
	s = 0;
	for( i = 0; i <= 9; i += 2 )
		s += piva.charCodeAt(i) - '0'.charCodeAt(0);
	for( i = 1; i <= 9; i += 2 ){
		c = 2*( piva.charCodeAt(i) - '0'.charCodeAt(0) );
		if( c > 9 )  c = c - 9;
		s += c;
	}
	if( ( 10 - s%10 )%10 != piva.charCodeAt(10) - '0'.charCodeAt(0) )
	{
		   if (nomecampo == '')
		      alert( "La partita IVA non è valida:\n" +
			    "il codice di controllo non corrisponde.\n");
			 else
			 	 alert( "La partita IVA inserita nel campo " + nomecampo + " non è valida:\n" +
			    "il codice di controllo non corrisponde.\n");
		return (false);
	}	
	return (true);
}



///----------------------------------------------------------------------------------------------
/// Chiamata Javascript: 
///
///  <a href="#" onClick="win_openlabel('foto1','550','500','20.jpg','Prova1','Questa è una prova di visualizzazione tramite javascript di una popup con immagine')">Prova </a> 
///----------------------------------------------------------------------------------------------
function win_openlabel(winname,w,h,nameimg,title,myString) {
   var size= w-5;
   var temp='';
   
   temp += '<html>\n';
   temp += '<head>\n';
   temp += ' <title>'+title+'</title>\n';
   temp += ' <script language="javascript">\n';
   temp += ' self.focus();\n';
   temp += ' </script>\n'; 
   temp += '</head>\n';
   temp += '<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" bgcolor="#FFFFFF">\n';
   
   //temp += ' <table border="0" width="'+size+'">\n';
   temp += ' <table border="0" height="100%" width="100%">\n';
   temp += '  <tr>\n';
   temp += '    <td align="center" valign="center"><img name="zomm" src='+nameimg+'></td>\n';
   temp += '  </tr>\n';
   temp += '  <tr>\n';
   temp += '    <td align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>'+myString+'</b></font></td>\n';
   temp += '  </tr>\n';
   temp += ' </table>\n';
   
   //temp +=  '       <br>\n';
   //temp +=  '        <center>\n';
   //temp +=  '<input type="button" onclick="javascript:window.close()" name="CHIUDI" value="Chiudi" size="20" style="border: 1px solid #666666;font-weight: bold">\n';
   //temp +=  '</center>\n';
   //temp +=  '<br>\n';
   temp += '<body>\n';
   temp += '</html>';
   

   msgWindow=window.open("",winname,'width='+w+',scrollbars=no,resizable=yes,height='+h+'')
   msgWindow.resizeTo(w,h);
   msgWindow.document.open();
   msgWindow.document.write(temp);
   msgWindow.document.close();
   
}

//function set_nome_nuovo_gruppo()
//{	
//	window.open('/include/set_groupname.asp','newest', 'status=yes,width=600,height=600');
//}


////Aggiunto da Andrea L. per gestione licenze
function getdatisoftware(tipo)
{
   if (tipo == 'adm')
     { window.open('/include/get_datisw.asp?type=adm','newest', 'status=yes,width=600,height=170')}
   else
     { 
     	var nome_sw = document.form1.software.value;     	
     	window.open('/include/get_datisw.asp?type=dst&name='+nome_sw,'newest', 'status=yes,width=600,height=170')
     	}  
}

//Aggiunto da Andrea L. per gestione licenze
function getdatidistributore(tipo)
{
   if (tipo == 'lic_filter')
    { window.open('/include/get_datidist.asp?type=lic_filter','newest', 'status=yes,width=600,height=170') }
   else if (tipo == 'filter')
    { window.open('/include/get_datidist.asp?type=filter','newest', 'status=yes,width=600,height=170') }
   else
   	{ window.open('/include/get_datidist.asp?type=nofilter','newest', 'status=yes,width=600,height=170') }
   
}

//Aggiunto da Andrea L. per gestione licenze
function getdati_swh(tipo)
{
   if (tipo == 'filter')
      { window.open('/include/get_datiswh.asp?type=filter', 'newest', 'status=yes,width=600,height=170')} 
   else
   	  { window.open('/include/get_datiswh.asp?type=nofilter', 'newest', 'status=yes,width=600,height=170')}    
}


//Aggiunto da Andrea L. per gestione licenze
function getdaticliente()
{
   var id_comune = document.form1.id_comune.value;
   var id_provincia = document.form1.id_provincia.value;
   var id_regione = document.form1.id_regione.value;
   var id_distributore = document.form1.id_distributore.value;
   
   window.open('/include/get_daticli.asp?id_dist='+id_distributore+'&id_com='+id_comune+'&id_prov='+id_provincia+'&id_reg='+id_regione,'newest', 'status=yes,width=600,height=140')
   
}


function getdaticlientemulti(selezionati, elenco_id)
{   
   var id_distributore = document.form1.id_distributore.value;
   
   window.open('/include/get_daticli.asp?id_dist='+id_distributore+'&type=multitar&sel='+selezionati+'&el_id='+elenco_id,'newestmulti', 'scrollbars=yes,status=yes,width=600,height=250')
   
}

   
   function getdatigeografici(tipo)
   {
	   if (tipo == 'regione')
	   {
		     window.open('/include/get_datigeo.asp?type=regione','newest', 'scrollbars=no,status=yes,width=400,height=100')
	   }
			
	   if (tipo == 'regione_news')
	   {
		     window.open('/include/get_datigeo.asp?type=regione&scopo=news','newest', 'scrollbars=no,status=yes,width=400,height=100')
	   }
	   
	   //Aggiunto da Andrea L. per gestione licenze
	   if (tipo == 'regione_lic')
	   {
		     window.open('/include/get_datigeo.asp?type=regione&scopo=lic','newest', 'scrollbars=no,status=yes,width=400,height=100')
	   }


	   if (tipo == 'provincia')
	   {
		   var id_regione = document.form1.id_regione.value;

		     window.open('/include/get_datigeo.asp?type=provincia&id_regione='+id_regione,'newest', 'scrollbars=no,status=yes,width=400,height=100')
	   }


	   if (tipo == 'provincia_news')
	   {
		   var id_regione = document.form1.id_regione.value;

		     window.open('/include/get_datigeo.asp?scopo=news&type=provincia&id_regione='+id_regione,'newest', 'scrollbars=no,status=yes,width=400,height=100')
	   }
	   
	   //Aggiunto da Andrea L. per gestione licenze
	   if (tipo == 'provincia_lic')
	   {
		   var id_regione = document.form1.id_regione.value;

		     window.open('/include/get_datigeo.asp?scopo=lic&type=provincia&id_regione='+id_regione,'newest', 'scrollbars=no,status=yes,width=400,height=100')
	   }
	   
	   if (tipo == 'comune')
	   {
		   var id_regione = document.form1.id_regione.value;
		   var id_provincia = document.form1.id_provincia.value;

		     window.open('/include/get_datigeo.asp?type=comune&id_regione='+id_regione+'&id_provincia='+id_provincia,'newest', 'scrollbars=no,status=yes,width=400,height=100')
	   }
	   
	   //Aggiunto da Andrea L. per gestione licenze
	   if (tipo == 'comune_lic')
	   {
		   var id_regione = document.form1.id_regione.value;
		   var id_provincia = document.form1.id_provincia.value;
		   window.open('/include/get_datigeo.asp?scopo=lic&type=comune&id_regione='+id_regione+'&id_provincia='+id_provincia,'newest', 'scrollbars=no,status=yes,width=400,height=100')
	   }

	   if (tipo == 'cap')
	   {
		   var id_regione = document.form1.id_regione.value;
		   var id_provincia = document.form1.id_provincia.value;

		     window.open('/include/get_datigeo.asp?type=cap&id_regione='+id_regione+'&id_provincia='+id_provincia,'newest', 'scrollbars=no,status=yes,width=400,height=100')
	   }

   }

   function changeback(form)
   {
     for (var i=0; i < form.ID_REGIONE.options.length; i++)
     {
       if (form.ID_REGIONE.options[i].selected)
       {
          return ( form.ID_REGIONE.options[i].value);
       }
     }
   }

-->