<!--

function logoffCuoreazzurro(){
  alert("ciao");
  document.Mail.azione.value="3";
  alert(document.Mail.azione.value);
  document.Mail.redirectOK.value="http://www.calcionapoli.it/napolistore.jsp";
  document.Mail.associato.value="http://store.calcionapoli.it/UploadProfileServlet";
  document.Mail.action="UploadProfileServlet";
  document.Mail.submit();
}

function toStore(){
  document.toStore.azione.value="124";
  document.toStore.redirectOK.value="napolistore.jsp";
  document.toStore.submit()
}

        function check4NotNull(){
                if(document.scrivi.email_mittente.value.length==0||
                        document.scrivi.risposta.value.length==0||
                        document.scrivi.nome.value.length==0||
                        document.scrivi.cognome.value.length==0){
                        alert("compila tutti i campi");
                        return false
                }
                return true
        }

        function doInvia(action){
                if(check4NotNull()){
                        document.scrivi.action = action;
                        document.scrivi.submit();
                }
        }

        if (document.images) {
            homeon = new Image();
            homeon.src ="img/menu/home_on.gif";
            homeoff = new Image();
            homeoff.src ="img/menu/home_off.gif";
            newson = new Image();
            newson.src ="img/menu/news_on.gif";
            newsoff = new Image();
            newsoff.src ="img/menu/news_off.gif";
            squadraon = new Image();
            squadraon.src ="img/menu/squadra_on.gif";
            squadraoff = new Image();
            squadraoff.src ="img/menu/squadra_off.gif";
            giovanilion = new Image();
            giovanilion.src ="img/menu/giovanili_on.gif";
            giovanilioff = new Image();
            giovanilioff.src ="img/menu/giovanili_off.gif";
            societaon = new Image();
            societaon.src ="img/menu/societa_on.gif";
            societaoff = new Image();
            societaoff.src ="img/menu/societa_off.gif";
            storiaon = new Image();
            storiaon.src ="img/menu/storia_on.gif";
            storiaoff = new Image();
            storiaoff.src ="img/menu/storia_off.gif";
            campionatoon = new Image();
            campionatoon.src ="img/menu/campionato_on.gif";
            campionatooff = new Image();
            campionatooff.src ="img/menu/campionato_off.gif";
	    cuoreazzurroon = new Image();
	    cuoreazzurroon.src ="img/menu/cuoreazzurro_on.gif";
	    cuoreazzurrooff = new Image();
            cuoreazzurrooff.src ="img/menu/cuoreazzurro_off.gif";
	    napolistoreon = new Image();
	    napolistoreon.src ="img/menu/napolistore_on.gif";
	    napolistoreoff = new Image();
            napolistoreoff.src ="img/menu/napolistore_off.gif";
          }

function imgOn(imgName) {
        if (document.images) {
            document[imgName].src = eval(imgName + "on.src");
        }
}

function imgOff(imgName) {
        if (document.images) {
            document[imgName].src = eval(imgName + "off.src");
        }
}
function popup(img,lar,alt)
    {
    fin=window.open("popup.jsp?img="+img,"SSCN","width="+lar,"height="+alt,"scrolling=no,menubar=no,resize=no");
    fin.resizeTo (lar,alt);
    y=10;
    //x=screen.width-390;
    x=10;
    fin.moveTo(x,y);
    fin.focus();
    }
function popup_prodotto(id,id_kit,lar,alt)
{
  fin=window.open("popup_prodotto.jsp?id="+id+"&id_kit="+id_kit,"NapoliStore","width="+lar,"height="+alt,"scrolling=no,menubar=no,resize=no");
  fin.resizeTo (lar,alt);
  y=10;
  //x=screen.width-390;
  x=10;
  fin.moveTo(x,y);
  fin.focus();
}

function popuppage(page,lar,alt)
{
  fin=window.open(page,"SSCN","width="+lar,"height="+alt,"scrolling=no,menubar=no,resize=no");
  fin.resizeTo (lar,alt);
  y=10;
  //x=screen.width-390;
  x=10;
  fin.moveTo(x,y);
  fin.focus();
}

function popuppagescroll(page,lar,alt)
 {
   fin=window.open(page,"SSCN");
   fin.resizeTo (lar,alt);
   y=10;
   //x=screen.width-390;
   x=10;
   fin.moveTo(x,y);
   fin.focus();
   fin.creator=self;
 }

function loadurl(url){
  window.creator.location=url
  window.close()
}

function popup_campionato(img,lar,alt)
    {
    fin=window.open("popup_campionato.jsp?img="+img,"sscnapoli","width="+lar,"height="+alt,"scrolling=no,menubar=no,resize=no");
    fin.resizeTo (lar,alt);
    y=10;
    //x=screen.width-390;
    x=10;
    fin.moveTo(x,y);
    fin.focus();
    fin.creator=self;
    }

// Javascritp Registrazione utente

var check=0;
var preferenze=3;

function setCheck(field){
  if(field.checked) check++;
  else check--;
}

function setData(){
  datadb=document.registrazioneForm.datadinascita.value
  if(datadb.length > 0){
    document.registrazioneForm.anno.value= datadb.substring(0,4);
    document.registrazioneForm.mese.value= datadb.substring(5,7);
    document.registrazioneForm.giorno.value= datadb.substring(8,10);
    document.registrazioneForm.datadinascita.value= document.registrazioneForm.anno.value+"-"+document.registrazioneForm.mese.value+"-"+document.registrazioneForm.giorno.value
  }
}

function changeData(){
  indday   =   document.registrazioneForm.giorno.value
  indmonth =   document.registrazioneForm.mese.value
  indyear  =   document.registrazioneForm.anno.value
  document.registrazioneForm.datadinascita.value= document.registrazioneForm.anno.value+"-"+document.registrazioneForm.mese.value+"-"+document.registrazioneForm.giorno.value
}

function validateEmail(field) {
  if ((field.value.indexOf("@") == -1) || (field.value.indexOf(".") == -1) || (field.value.length < 7)) {
      alert("Indirizzo e-mail non valido")
      field.select()
      return false
  }
  return true
}

function checkcampi(){
  var ret = true;
  if (document.registrazioneForm.userid.value.length==0){
    alert ("Attenzione, il campo Nome Utente è obbligatorio");
 return false;
  }else  if (document.registrazioneForm.userid.value.length<5){
    alert ("Attenzione, il campo Nome Utente deve contenere almeno 5 caratteri");
 return false;
  }
  if (document.registrazioneForm.password.value.length==0){
     alert ("Attenzione, il campo Password è obbligatorio");
 return false;
  }else  if (document.registrazioneForm.password.value.length<5){
    alert ("Attenzione, il campo Password deve contenere almeno 5 caratteri");
 return false;
  }else if (document.registrazioneForm.password.value!=document.registrazioneForm.cfpassword.value){
     alert ("Attenzione, il campo Password e il Campo Conferma password non coincidono");
 return false;
  }
  if (document.registrazioneForm.nome.value.length==0){
     alert ("Attenzione, il campo Nome è obbligatorio");
 return false;
  }
  if (document.registrazioneForm.cognome.value.length==0){
     alert ("Attenzione, il campo Cognome è obbligatorio");
 return false;
  }
  if (document.registrazioneForm.indirizzo.value.length==0){
     alert ("Attenzione, il campo Indirizzo è obbligatorio");
 return false;
  }
  if (document.registrazioneForm.citta.value.length==0){
     alert ("Attenzione, il campo Città è obbligatorio");
 return false;
  }
  if (document.registrazioneForm.provincia.value.length==0){
     alert ("Attenzione, il campo Provincia è obbligatorio");
 return false;
  }
  if (document.registrazioneForm.cap.value.length==0){
     alert ("Attenzione, il campo Cap è obbligatorio");
 return false;
  }
  if (document.registrazioneForm.domanda.value.length==0){
     alert ("Attenzione, il campo Domanda è obbligatorio");
 return false;
  }
  if (document.registrazioneForm.risposta.value.length==0){
     alert ("Attenzione, il campo Risposta è obbligatorio");
 return false;
  }
  return true;
}

function richiestaPassword(check){
    if (check||(document.registrazioneForm.email.value.length>0&&validateEmail(document.registrazioneForm.email))){
        document.registrazioneForm.submit();
    } else alert ("Inserire un email a cui inviare la password");
}

function registraUtente(){
  if(check<3) alert("Seleziona almeno 3 preferenze");
  else
  if(document.registrazioneForm.datiPersonali.checked){
    if(document.registrazioneForm.condizioni.checked){
      //if(document.registrazioneForm.consenso2.checked){
        if (checkcampi()&&validateEmail(document.registrazioneForm.email)){
          changeData()
	  if(document.registrazioneForm.estendi_profilo!=null&&document.registrazioneForm.estendi_profilo.checked)
             document.registrazioneForm.action="registrazionePosta.jsp?regUt=&estendi=";
	  else
             document.registrazioneForm.action="registrazionePosta.jsp?regUt=";
          document.registrazioneForm.submit();
        }
      //} else alert ("Necessario Consenso2");
    } else alert ("E' richiesta l'accettazione delle Condizioni generali");
  } else alert ("E' richiesta il consenso al Trattamento dei dati personali");
}

function submitRequest(azione){
   document.registrazioneForm.action="UploadProfileServlet";
   document.registrazioneForm.azione.value=azione;
   document.registrazioneForm.submit();
}

function setLower(test){
  var low =test.value;
  low = low.toLowerCase();
  document.registrazioneForm.userid.value = low;
}

// Fine Javascript Registrazione Utente

function setHomePage() {
    document.body.style.behavior='url(#default#homepage)';
    document.body.setHomePage('http://www.calcionapoli.it/');
}

// -->
