function controllo_solo_numeri(b){
    var campo=document.getElementById(b);
    var len=campo.value.length;
		if (!(campo.value.match(/^[0-9]+$/))){
		  campo.value=campo.value.substring(0,campo.value.length-1);
		}
}

function rollover(a){
    document.getElementById(a).src="img/"+a+"_over.gif";
}

function rollout(b){
    document.getElementById(b).src="img/"+b+"_out.gif";
}

function aprisottomenu(){
    document.getElementById("vocine").style.display="inline";
}

function sparisci(i){
	  document.getElementById(i).style.display="none";
}
    
function nuovo_db(f){
      document.getElementById("inviare").disabled=true;
      if(f.email.value=="" || f.password.value=="" || f.nome.value=="" || f.cognome.value==""){
      document.getElementById("inviare").disabled=false;
      return false;
      }
      f.submit();
      return true;
}

function logins(j){
    document.getElementById("inviare").disabled=true;
      if(j.email.value=="" || j.psw.value==""){
      document.getElementById("inviare").disabled=false;
      return false;
      
      }
      j.submit();
      return true;
}

function codicesconto(p){
    document.getElementById("bottone_sconto").disabled=true;
      if(p.sconto.value==""){
      document.getElementById("bottone_sconto").disabled=false;
      return false;
      }
      p.submit();
      return true;
}
  
  
function imposta(tipo){
  if (tipo == "p"){
	    document.getElementById("div_azienda").className = "nascondi";
	    document.getElementById("label_azienda").className = "nascondi";
	    document.getElementById("div_partitaiva").className = "nascondi";
	    document.getElementById("label_partitaiva").className = "nascondi";
	    document.getElementById("div_codicefiscale").className = "nascondi";
	    document.getElementById("label_codicefiscale").className = "nascondi";
	} else if(tipo=="a"){
	    document.getElementById("div_azienda").className = "campo appari";
	    document.getElementById("label_azienda").className = "nome_campo appari";
	    document.getElementById("div_partitaiva").className = "campo appari";
	    document.getElementById("label_partitaiva").className = "nome_campo appari";
	    document.getElementById("div_codicefiscale").className = "campo appari";
	    document.getElementById("label_codicefiscale").className = "nome_campo appari";
	}
}

function imposta_destinatario(dati){
  if (dati == "u"){
	    document.getElementById("altri_dati").className = "nascondi";
	    document.getElementById("gesti_avanti").className="appari";
	} else if(dati=="d"){
	    document.getElementById("altri_dati").className = "appari";
	    document.getElementById("gesti_avanti").className="nascondi";
	}
}

 function popup(){
    lar=530;
    alt=400;
    alto=(screen.height-lar)/2;
    sinistra=(screen.width-alt)/2;
      fin = window.open('rivenditori.php','pagina','width='+lar+',height='+alt+',top='+alto+',left='+sinistra+',noresize=yes,toolbars=no,scrollbars=yes');
    }

function ingra(fil,alt,lar){
	alto = (screen.height -alt)/2;
	sinistra =(screen.width-lar)/2;
	fin = window.open(fil,'fotografia','width='+lar+',height='+alt+',top='+alto+',left='+sinistra+',noresize=yes,toolbars=no,scrollbars=no');
}

