// JavaScript Document

 function isEmail(str) {
  var supported=0;
  
  if (window.RegExp) {
   var tempStr = "a";
   var tempReg = new RegExp(tempStr);
   if (tempReg.test(tempStr)) supported = 1;
  }
  if (!supported) 
   return (str.indexOf(".")>2) && (str.indexOf("@") > 0);
  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
  return (!r1.test(str) && r2.test(str));
 }  
   
 function decisione(ris,the_form) {
  
  if (the_form.nome.value == "")
  {
    alert("Attenzione! Inserisci il tuo nome e cognome !!!");
    the_form.nome.focus();
    return (false);
  }  
if (the_form.via.value == "")
  {
    alert("Attenzione! Inserisci la via e numero civico !!!");
    the_form.via.focus();
    return (false);
  }
if (the_form.citta.value == "")
  {
    alert("Attenzione! Inserisci la cittā !!!");
    the_form.citta.focus();
    return (false);
  }
if (the_form.stato.value == "Seleziona")
  {
    alert("Attenzione! Inserisci la nazione !!!");
    the_form.stato.focus();
    return (false);
  }
if (the_form.telefono.value == "")
  {
    alert("Attenzione! Inserisci il tuo numero di telefono !!!");
    the_form.telefono.focus();
    return (false);
  }
if (the_form.email.value == "")
  {
    alert("Attenzione! Inserisci il tuo indirizzo email !!!");
    the_form.email.focus();
    return (false);
  }
  if (the_form.email.value!=the_form.email2.value)
  {
	alert("La conferma e-mail č diversa !!!");
	the_form.email2.focus();
	return (false);
   }
   if (the_form.data_inizio.value == "")
  {
    alert("Attenzione! Inserisci la data dell'inizio del noleggio !!!");
    the_form.data_inizio.focus();
    return (false);
  }
  if (the_form.data_fine.value == "")
  {
    alert("Attenzione! Inserisci la data di fine del noleggio !!!");
    the_form.data_fine.focus();
    return (false);
  }
if (the_form.ora_inizio.value == "")
  {
    alert("Attenzione! Inserisci l'ora dell'inizio del noleggio !!!");
    the_form.ora_inizio.focus();
    return (false);
  }  
  if (the_form.ora_fine.value == "")
  {
    alert("Attenzione! Inserisci l'ora della fine del noleggio !!!");
    the_form.ora_fine.focus();
    return (false);
  } 
if (the_form.modello.value == "Seleziona")
  {
    alert("Attenzione! Inserisci il modello di biciclette da noleggiare !!!");
    the_form.modello.focus();
    return (false);
  }   
if (the_form.bike.value == "")
  {
    alert("Attenzione! Inserisci il numero di biciclette da noleggiare !!!");
    the_form.bike.focus();
    return (false);
  } 
  if (the_form.misure.value == "")
  {
    alert("Attenzione! Inserisci le misure delle biciclette da noleggiare !!!");
    the_form.misure.focus();
    return (false);
  }
  if (the_form.consegna.value == "Seleziona")
  {
    alert("Attenzione! Inserisci la localitā dove consegnare le biciclette da noleggiare !!!");
    the_form.consegna.focus();
    return (false);
  }
  if (the_form.ritiro.value == "Seleziona")
  {
    alert("Attenzione! Inserisci la localitā dove ritirare le biciclette !!!");
    the_form.ritiro.focus();
    return (false);
  }  
  if (the_form.email.value != "")
  {
   if (ris) 
    {
     return (true);
    }
   else
    {
     alert("Attenzione! Inserisci un indirizzo di email valido !!!");
     the_form.email.focus();
     return (false);
    }
  }
 return (true);
 }
