<!--
//var pattern=\(\d{0,3})+\.(\d{3})+\,(\d{2})\;

function chk_PIVA(campo,v)
{
  pi=campo.value;
  if( pi == '' ){
     alert(v)
 	return false;}
   if( pi.length != 11 ){

     campo.focus();
     return false;

   }
   validi = "0123456789";
   for( i = 0; i < 11; i++ ){
     if( validi.indexOf( pi.charAt(i) ) == -1 ){
           alert(v)
     campo.focus();
     return false;

     }

   }
   s = 0;
   for( i = 0; i <= 9; i += 2 )
     s += pi.charCodeAt(i) - '0'.charCodeAt(0);
   for( i = 1; i <= 9; i += 2 ){
     c = 2*( pi.charCodeAt(i) - '0'.charCodeAt(0) );
     if( c > 9 ) c = c - 9;
     s += c;
   }
   if( ( 10 - s%10 )%10 != pi.charCodeAt(10) - '0'.charCodeAt(0) ){
{
           alert(v)
     campo.focus();
     return false;

     }
   }
   return true;
}




function chk_codice_fiscale(campo,v){
   caratteri= new Array ("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z")
   pari= 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)
   dispari=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)
   cod=campo.value.toLowerCase();
   check=true;
   if (cod.length!=16){
      check=false
      }
     else
      {
      lettere=cod.substr(0,6)+cod.substr(8,1)+cod.substr(11,1)+cod.substr(15);
      numeri=cod.substr(6,2)+cod.substr(9,2)+cod.substr(12,3);
      for (i=0;i<10;i++){
         if (lettere.charCodeAt(i)<97 || lettere.charCodeAt(i)>122){
            check=false;}
      }
      for (i=0;i<8;i++){
         if (numeri.charCodeAt(i)<48 || numeri.charCodeAt(i)>57){
            check=false;
         }
      }
     }
   //checksum del codice fiscale
   test=cod.substr(15,1);
   var somma=0
   for (i=0;i<16;i=i+2){ //dispari
       carattere=cod.substr(i,1)
       for (k=0;k<36;k++){
          if (carattere==caratteri[k]){
             somma=somma+dispari[k]
             break
          }
       }
    }
    for (i=1;i<15;i=i+2){ //pari
       carattere=cod.substr(i,1)
       for (k=0;k<36;k++){
          if (carattere==caratteri[k]){
             somma=somma+pari[k]
             break
          }
       }
    }
   resto=somma % 26;
   var lettera=String.fromCharCode(97+resto);
   if (test != lettera){
          check=false;
      }
   if (check==false){
	alert(v);
	campo.focus();
	return false;
      }
      else
      {
      return true;
      }
   return true;
}


function chk_codice_fiscale_contract(campo,v){
   if(campo.value.search('[^0-9]+\.[^0-9]') != -1){
   caratteri= new Array ("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z")
   pari= 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)
   dispari=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)
   cod=campo.value.toLowerCase();
   check=true;
   if (cod.length!=16){
      check=false
      }
     else
      {
      lettere=cod.substr(0,6)+cod.substr(8,1)+cod.substr(11,1)+cod.substr(15);
      numeri=cod.substr(6,2)+cod.substr(9,2)+cod.substr(12,3);
      for (i=0;i<10;i++){
         if (lettere.charCodeAt(i)<97 || lettere.charCodeAt(i)>122){
            check=false;}
      }
      for (i=0;i<8;i++){
         if (numeri.charCodeAt(i)<48 || numeri.charCodeAt(i)>57){
            check=false;
         }
      }
     }
   //checksum del codice fiscale
   test=cod.substr(15,1);
   var somma=0
   for (i=0;i<16;i=i+2){ //dispari
       carattere=cod.substr(i,1)
       for (k=0;k<36;k++){
          if (carattere==caratteri[k]){
             somma=somma+dispari[k]
             break
          }
       }
    }
    for (i=1;i<15;i=i+2){ //pari
       carattere=cod.substr(i,1)
       for (k=0;k<36;k++){
          if (carattere==caratteri[k]){
             somma=somma+pari[k]
             break
          }
       }
    }
   resto=somma % 26;
   var lettera=String.fromCharCode(97+resto);
   if (test != lettera){
          check=false;
      }
   if (check==false){
	alert(v);
	campo.focus();
	return false;
      }
      else
      {
      return true;
      }
   return true;
   }else if(!campo.value   || campo.value.length != 11){
  	//alert("altro " + campo.value.length)
		if(arguments.length==1) alert('Campo ' + campo.name + ' errato');
		else if(arguments.length==2) alert(v);
		campo.focus();
		return false;
	}
	return true;


}

function conferma(messaggio, url){
	if(confirm(messaggio))
		window.location.href = url;
}

function chk_checkbox(o,v){
	//alert (o.checked);
	if(o.checked != true){
		if(arguments.length==1) alert('Campo ' + o.name + ' errato');
		else if(arguments.length==2) alert(v);
		o.focus();
		return false;
	}
	return true;
}

function chk_equal(o,o2,v){
     if(o2.value!=o.value){
      alert (v);
      o.focus;
      return false;
     }
     return true;
}


function chk_registra(o,o2,o3,v){
	//alert (o.checked);
	if(o.checked == true){

if(chk_txt(o2,v) && chk_txt(o3,v)){
        return true;
	}else{
	 return false
	}
        return true;
}
return true;
 }

function chk_fatturazione(o,n,m,v,v2){
	if(o.checked == true){
		if((n.value == "")&&(m.value=="")){
		alert(v);
		n.focus();
		return false;
		}
	}else{
	   if((m.value == "")){
		alert(v2);
		m.focus();
		return false;
		}
	}
	return true;
}

function chk_tot(o,m){
 if(!o.value ||  parseFloat(o.value) == "0.00"  ||  parseFloat(o.value) < 75){
		if(arguments.length==1) alert('Campo ' + o.name + ' errato');
		else if(arguments.length==2) alert(m);
		//o.focus();
		return false;
	}
	return true;
}

function chk_PIVA_contract(o,o2,m){
       if(o.value ==""  &&  o2.value =="" ){
          alert(m);
		o.focus();
		return false;
       }
       	return true;
}


function chk_txt(o,v){
	if(o.value.search('[a-zA-Z0-9]') == -1){
		if(arguments.length==1) alert('Campo ' + o.name + ' errato');
		else if(arguments.length==2) alert(v);
		o.focus();
		return false;
	}
	return true;
}

function chk_float(o,m){
 if(!o.value ||  parseFloat(o.value) == "0.00" ){
		if(arguments.length==1) alert('Campo ' + o.name + ' errato');
		else if(arguments.length==2) alert(m);
		o.focus();
		return false;
	}
	return true;
}

function chk_int(o,m){
	if(!o.value  || o.value=="0" || o.value.search('[^0-9]+\.[^0-9]') != -1){
		if(arguments.length==1) alert('Campo ' + o.name + ' errato');
		else if(arguments.length==2) alert(m);	
		o.focus();
		return false;
	}
	return true;
}

//togliere http!!!
function chk_url(o){
	if(o.value.search('[a-z]+://[a-zA-Z0-9]+\.[a-zA-Z0-9]+') == -1){
		alert('Campo ' + o.name + ' errato');
		o.focus();
		return false;
	}
	return true;
}

function chk_url1(o,m){
	if(o.value.search('[a-zA-Z0-9]+\.[a-zA-Z0-9]+') == -1){
		if(arguments.length==2){
			alert(m);
			o.focus();
		}
		return false;
	}
	return true;
}

function chk_len(o,m,len){
	var len = parseInt(len);
	var strlen = parseInt(o.value.length);
	
	if( strlen !== len ){
	
		if( arguments.length == 3 ){
			alert(m);
			o.focus();
		}
		return false;
	}
	return true;
}

function azzera(url){
	window.location.href = url;
}

function chk_email(o,d){
	if(o.value.search("^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-.]?[0-9a-zA-Z])*\\.[a-zA-Z]{2,4}$") == -1){
		alert(d);
		o.focus();
		return false;
	}
	return true;
}

function chk_select(o,d){
	if(!o[o.selectedIndex].value  ){
		alert(d);
		o.focus();
		return false;
	}
	return true;
}

function chk_select_valid(o,d){
	if(o[o.selectedIndex].value ==13  || o[o.selectedIndex].value ==14){
		alert(d);
		o.focus();
		return false;
	}
	return true;
}

function chk_date_form(o,v){
	var l = o.value.length;

	var f1 = o.value.slice(2,3);
	var f2 = o.value.slice(5,6);
	if( f1=='/' && f2=='/' && l==10 ){
		return true;
	}else{
		if(arguments.length==2){
			alert(v);
		}else{
			alert("il formato deve essere gg/mm/aaaa");
		}
		o.focus();
		return false;
	} 

}

function block_virgola(o){
	var regexp=/\,/;
	if(o.value.search(regexp)>0){
		alert("il valore  "+o.value+"  inserito non è consentito ");
		o.focus();
		return false;
	}
	else return true;
}
-->

