/* - - - - - - - - - - - - - - - - - - - - - - -
 JavaScript
 venerdì 6 giugno 2008 12.47.56
 - - - - - - - - - - - - - - - - - - - - - - - */

var b = 2;
var i = 2;
var u = 2;
var q = 2;
var c = 2;
var url = 2;
var img = 2;

//Function for creating non-font tags

function tag(v, tagadd, newbut, tagclose, oldbut, name) {
    if (eval(v)%2 == 0) {
        eval("window.document.form_news."+name+".value = newbut;");
        var testo = window.document.form_news.testo.value;
        window.document.form_news.testo.value = testo + tagadd;
        window.document.form_news.testo.focus();
    } else {
        eval("window.document.form_news."+name+".value = oldbut;");
        var testo = window.document.form_news.testo.value;
        window.document.form_news.testo.value = testo + tagclose;
        window.document.form_news.testo.focus();
    }
    eval(v+"++;");
}

function textarea_wrap_text(obj, str_pre, str_post) {
  if (document.selection) { // Internet Explorer
    obj.focus();
    sel = document.selection.createRange();
    sel.text = str_pre + sel.text + str_post;
  } else if (obj.selectionStart || obj.selectionStart == '0') { // Others
    var pos_1 = obj.selectionStart;
    var pos_2 = obj.selectionEnd;
    obj.value = obj.value.substring(0, pos_1)
                + str_pre
                + obj.value.substring(pos_1, pos_2)
                + str_post
                + obj.value.substring(pos_2, obj.value.length);
  } else { // Fallback
    obj.value += str_pre + str_post;
  }
}

function textarea_wrap_img(obj) {
    id_img = document.getElementById("id_img").value;
    align_sx = document.getElementById("sx").checked;
    align_dx = document.getElementById("dx").checked;
    align_is = document.getElementById("is").checked;
    if (align_sx) align = "s";
    else if (align_dx) align = "d";
    else if (align_is) align = "i";
    if (id_img != "") {
  if (document.selection) { // Internet Explorer
    obj.focus();
    sel = document.selection.createRange();
    sel.text = "[img="+id_img+align+"]";
    show('ins_img');
    show('view_img');

  } else if (obj.selectionStart || obj.selectionStart == '0') { // Others
    var pos_1 = obj.selectionStart;
    var pos_2 = obj.selectionEnd;
    obj.value = obj.value.substring(0, pos_1)
                + "[img="+id_img+align+"]"
                + obj.value.substring(pos_1, pos_2)
                + obj.value.substring(pos_2, obj.value.length);
    document.getElementById("id_img").value = "";
    show('ins_img');
    show('view_img');
  } else { // Fallback
    obj.value += "[img=]";
  }
}
}
function textarea_wrap_doc(obj) {
    id_img = document.getElementById("id_doc").value;
    if (id_img != "") {
  if (document.selection) { // Internet Explorer
    obj.focus();
    sel = document.selection.createRange();
    sel.text = "[doc="+id_img+"]";
    show('ins_doc');
  } else if (obj.selectionStart || obj.selectionStart == '0') { // Others
    var pos_1 = obj.selectionStart;
    var pos_2 = obj.selectionEnd;
    obj.value = obj.value.substring(0, pos_1)
                + "[doc="+id_img+"]"
                + obj.value.substring(pos_1, pos_2)
                + obj.value.substring(pos_2, obj.value.length);
    document.getElementById("id_doc").value = "";
    show('ins_doc');
  } else { // Fallback
    obj.value += "[doc=]";
  }
}
}
function textarea_wrap_url(obj) {
    url = document.getElementById("url").value;
    url_text = document.getElementById("url_text").value;
    if (url != "" && url_text != "") {
  if (document.selection) { // Internet Explorer
    obj.focus();
    sel = document.selection.createRange();
    sel.text = "[url="+url+"]"+url_text+"[/url]";
    show('ins_url');
  } else if (obj.selectionStart || obj.selectionStart == '0') { // Others
    var pos_1 = obj.selectionStart;
    var pos_2 = obj.selectionEnd;
    obj.value = obj.value.substring(0, pos_1)
                + "[url="+url+"]"+url_text+"[/url]"
                + obj.value.substring(pos_1, pos_2)
                + obj.value.substring(pos_2, obj.value.length);
    document.getElementById("url").value = "";
    document.getElementById("url_text").value = "";
    show('ins_url');
  } else { // Fallback
    obj.value += "[doc=]";
  }
}
}


function controllaNews() {
        var oTitolo = document.getElementById("titoloNotizia");
        var oTesto = document.getElementById("testoNotizia");

        var oErrore = document.getElementById("erroreNews");

        if (oTitolo.value == ""){
            oTitolo.style.backgroundColor = "#FF7C7C";
            oErrore.innerHTML = "I Campi In Rosso Sono Obbligatori!";
            oErrore.style.color = "#ffffff";
            oErrore.style.backgroundColor = "#FF0000";
            oErrore.style.padding = "5px";
           return null;
        }
        else{
        oTitolo.style.backgroundColor = "";
        oErrore.innerHTML = "";
        }
        if (oTesto.value == ""){
            oTesto.style.backgroundColor = "#FF7C7C";
            oErrore.innerHTML = "I Campi In Rosso Sono Obbligatori!";
            oErrore.style.color = "#ffffff";
            oErrore.style.backgroundColor = "#FF0000";
            oErrore.style.padding = "5px";
           return null;
        }
        else{
        oTesto.style.backgroundColor = "";
        oErrore.innerHTML = "";
        }

document.form_news.action = "index.php?sel=news_admin&sel_2=up_news";
document.form_news.submit();

}
function controllaPescaturismo() {
        var oTitolo = document.getElementById("titoloNotizia");

        var oErrore = document.getElementById("erroreNews");

        if (oTitolo.value == ""){
            oTitolo.style.backgroundColor = "#FF7C7C";
            oErrore.innerHTML = "Devi inserire una località!";
            oErrore.style.color = "#ffffff";
            oErrore.style.backgroundColor = "#FF0000";
            oErrore.style.padding = "5px";
           return null;
        }
        else{
        oTitolo.style.backgroundColor = "";
        oErrore.innerHTML = "";
        }

document.form_news.submit();

}

function controllaIntranet() {
        var oTitolo = document.getElementById("titoloNotizia");
        var oTesto = document.getElementById("testoNotizia");

        var oErrore = document.getElementById("erroreNews");

        if (oTitolo.value == ""){
            oTitolo.style.backgroundColor = "#FF7C7C";
            oErrore.innerHTML = "I Campi In Rosso Sono Obbligatori!";
            oErrore.style.color = "#ffffff";
            oErrore.style.backgroundColor = "#FF0000";
            oErrore.style.padding = "5px";
           return null;
        }
        else{
        oTitolo.style.backgroundColor = "";
        oErrore.innerHTML = "";
        }
        if (oTesto.value == ""){
            oTesto.style.backgroundColor = "#FF7C7C";
            oErrore.innerHTML = "I Campi In Rosso Sono Obbligatori!";
            oErrore.style.color = "#ffffff";
            oErrore.style.backgroundColor = "#FF0000";
            oErrore.style.padding = "5px";
           return null;
        }
        else{
        oTesto.style.backgroundColor = "";
        oErrore.innerHTML = "";
        }

document.form_intranet.action = "index.php?sel=intranet_admin&sel_2=up_intranet";
document.form_intranet.submit();

}

function controllaNormativa() {
        var oTitolo = document.getElementById("titoloNotizia");
        var file = document.form_normative.allegato;

        var oErrore = document.getElementById("erroreNews");

        if (oTitolo.value == ""){
            oTitolo.style.backgroundColor = "#FF7C7C";
            oErrore.innerHTML = "I Campi In Rosso Sono Obbligatori!";
            oErrore.style.color = "#ffffff";
            oErrore.style.backgroundColor = "#FF0000";
            oErrore.style.padding = "5px";
           return null;
        }
        else{
        oTitolo.style.backgroundColor = "";
        oErrore.innerHTML = "";
        }

        if (file.value == ""){
            oErrore.innerHTML = "Devi inserire un allegato!";
            oErrore.style.color = "#ffffff";
            oErrore.style.backgroundColor = "#FF0000";
            oErrore.style.padding = "5px";
           return null;
        }
        else{
        oErrore.innerHTML = "";
        }

document.form_normative.action = "index.php?sel=normative_admin&sel_2=up_normative";
document.form_normative.submit();

}

function controllaNormativaMod() {
        var oTitolo = document.getElementById("titoloNotizia");

        var oErrore = document.getElementById("erroreNews");

        if (oTitolo.value == ""){
            oTitolo.style.backgroundColor = "#FF7C7C";
            oErrore.innerHTML = "I Campi In Rosso Sono Obbligatori!";
            oErrore.style.color = "#ffffff";
            oErrore.style.backgroundColor = "#FF0000";
            oErrore.style.padding = "5px";
           return null;
        }
        else{
        oTitolo.style.backgroundColor = "";
        oErrore.innerHTML = "";
        }

document.form_normative.action = "index.php?sel=normative_admin&sel_2=up_normative";
document.form_normative.submit();

}

function show(id) {
    
    if (document.getElementById) { // DOM3 = IE5+, NS6+, FF
        if (document.getElementById(id).style.display == 'block') {
        document.getElementById(id).style.display = 'none';
    } else {
        document.getElementById(id).style.display = 'block';
    }

    } else {
        if (document.layers) { // NS4.7  
                document.id.display = 'block';
        } else { //IE 4
                document.all.id.style.display = 'block';
        }
    }
}


function controllaLink() {
        var oTitolo = document.getElementById("titoloNotizia");
        var oTesto = document.getElementById("urlNotizia");

        var oErrore = document.getElementById("erroreNews");

        if (oTitolo.value == ""){
            oTitolo.style.backgroundColor = "#FF7C7C";
            oErrore.innerHTML = "I Campi In Rosso Sono Obbligatori!";
            oErrore.style.color = "#ffffff";
            oErrore.style.backgroundColor = "#FF0000";
            oErrore.style.padding = "5px";
           return null;
        }
        else{
        oTitolo.style.backgroundColor = "";
        oErrore.innerHTML = "";
        }
        if (oTesto.value == ""){
            oTesto.style.backgroundColor = "#FF7C7C";
            oErrore.innerHTML = "I Campi In Rosso Sono Obbligatori!";
            oErrore.style.color = "#ffffff";
            oErrore.style.backgroundColor = "#FF0000";
            oErrore.style.padding = "5px";
           return null;
        }
        else{
        oTesto.style.backgroundColor = "";
        oErrore.innerHTML = "";
        }

document.form_link.action = "index.php?sel=link_admin&sel_2=up_link";
document.form_link.submit();

}

function controllaAggiornamento() {
        var oTitolo = document.getElementById("titoloNotizia");
        var oTesto = document.getElementById("testoNotizia");

        var oErrore = document.getElementById("erroreNews");

        if (oTitolo.value == ""){
            oTitolo.style.backgroundColor = "#FF7C7C";
            oErrore.innerHTML = "I Campi In Rosso Sono Obbligatori!";
            oErrore.style.color = "#ffffff";
            oErrore.style.backgroundColor = "#FF0000";
            oErrore.style.padding = "5px";
           return null;
        }
        else{
        oTitolo.style.backgroundColor = "";
        oErrore.innerHTML = "";
        }
        if (oTesto.value == ""){
            oTesto.style.backgroundColor = "#FF7C7C";
            oErrore.innerHTML = "I Campi In Rosso Sono Obbligatori!";
            oErrore.style.color = "#ffffff";
            oErrore.style.backgroundColor = "#FF0000";
            oErrore.style.padding = "5px";
           return null;
        }
        else{
        oTesto.style.backgroundColor = "";
        oErrore.innerHTML = "";
        }

document.form_contenuti.action = "index.php?sel=aggiornamento_admin&sel_2=up_aggiornamento";
document.form_contenuti.submit();

}

function controllaUserAdmin () {
        var oNome = document.getElementById("nome");
        var oCognome = document.getElementById("cognome");
        var oUser = document.getElementById("user");
        var oPass = document.getElementById("pass");
        var oEmail = document.getElementById("email");

        var oErroreNome = document.getElementById("erroreNome");
        var oErroreUser = document.getElementById("erroreUser");

        if (oNome.value == ""){
            oNome.style.backgroundColor = "#FF7C7C";
            oErroreNome.innerHTML = "Devi inserire il nome!";
            oErroreNome.style.color = "#ffffff";
            oErroreNome.style.backgroundColor = "#FF0000";
            oErroreNome.style.padding = "5px";
            return null;

        }
        else{
        oNome.style.backgroundColor = "";
        oErroreNome.innerHTML = "";
        oErroreNome.style.backgroundColor = "#FFffff";
        }

        if (oCognome.value == ""){
              oCognome.style.backgroundColor = "#FF7C7C";
              oErroreNome.innerHTML = "I Campi In Rosso Sono Obbligatori!";
              oErroreNome.style.color = "#ffffff";
              oErroreNome.style.backgroundColor = "#FF0000";
              oErroreNome.style.padding = "5px";
           return null;
        }else{
        oCognome.style.backgroundColor = "";
        oErroreNome.innerHTML = "";
        oErroreNome.style.backgroundColor = "#FFffff";
        }


        if (oUser.value == ""){
            oUser.style.backgroundColor = "#FF7C7C";
            oErroreUser.innerHTML = "I Campi In Rosso Sono Obbligatori!";
            oErroreUser.style.color = "#ffffff";
            oErroreUser.style.backgroundColor = "#FF0000";
            oErroreUser.style.padding = "5px";
           return null;
        }
        else { if (oUser.value.length < 6){
                  oUser.style.backgroundColor = "#FF7C7C";
                  oErroreUser.innerHTML = "Il nome utente deve contenere almeno 6 caratteri alfanumerici, senza spazi!";
                  oErroreUser.style.color = "#ffffff";
                  oErroreUser.style.backgroundColor = "#FF0000";
                  oErroreUser.style.padding = "5px";
                  return null;
                  } else {
                         if ( /^[a-z0-9]+$/.test(oUser.value) ) {
                         oUser.style.backgroundColor = "";
                         oErroreUser.innerHTML = "";
                         oErroreUser.style.backgroundColor = "#FFffff";
                         } else {
                         oUser.style.backgroundColor = "#FF7C7C";
                         oErroreUser.innerHTML = "Il nome utente non è valido. Utilizza solo lettere minuscole e numeri senza spazi!";
                         oErroreUser.style.color = "#ffffff";
                         oErroreUser.style.backgroundColor = "#FF0000";
                         oErroreUser.style.padding = "5px";
                         return null;
                         }
                  }
        }

        if (oPass.value == ""){
            oPass.style.backgroundColor = "#FF7C7C";
            oErroreUser.innerHTML = "I Campi In Rosso Sono Obbligatori!";
            oErroreUser.style.color = "#ffffff";
            oErroreUser.style.backgroundColor = "#FF0000";
            oErroreUser.style.padding = "5px";
           return null;
        }
        else { if (oPass.value.length < 6){
                  oPass.style.backgroundColor = "#FF7C7C";
                  oErroreUser.innerHTML = "La password deve contenere almeno 6 caratteri alfanumerici!";
                  oErroreUser.style.color = "#ffffff";
                  oErroreUser.style.backgroundColor = "#FF0000";
                  oErroreUser.style.padding = "5px";
                  return null;
                  } else {
                         if ( /^[a-z0-9]+$/.test(oPass.value) ) {
                         oPass.style.backgroundColor = "";
                         oErroreUser.innerHTML = "";
                         oErroreUser.style.backgroundColor = "#FFffff";
                         } else {
                         oPass.style.backgroundColor = "#FF7C7C";
                         oErroreUser.innerHTML = "La password non è valida. Utilizza solo lettere minuscole e numeri!";
                         oErroreUser.style.color = "#ffffff";
                         oErroreUser.style.backgroundColor = "#FF0000";
                         oErroreUser.style.padding = "5px";
                         return null;
                         }
                  }
        }

        if (oEmail.value == ""){
            oEmail.style.backgroundColor = "#FF7C7C";
            oErroreUser.innerHTML = "I Campi In Rosso Sono Obbligatori!";
            oErroreUser.style.color = "#ffffff";
            oErroreUser.style.backgroundColor = "#FF0000";
            oErroreUser.style.padding = "5px";
           return null;
        } else {
          var strEmail = oEmail.value;
          if ( /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(strEmail) )  {
              oEmail.style.backgroundColor = "";
              oErroreUser.innerHTML = "";
              oErroreUser.style.backgroundColor = "#FFffff";
          } else {
            oEmail.style.backgroundColor = "#FF7C7C";
            oErroreUser.innerHTML = "Inserire un indirizzo e-mail valido!";
            oErroreUser.style.color = "#ffffff";
            oErroreUser.style.backgroundColor = "#FF0000";
            oErroreUser.style.padding = "5px";
           return null;
          }
        }



document.form_utenti.action = "index.php?sel=users_admin&sel_2=up_users";
document.form_utenti.submit();

}

function controllaUser () {
        var oNome = document.getElementById("nome");
        var oCognome = document.getElementById("cognome");
        var oUser = document.getElementById("user");
        var oPass = document.getElementById("pass");
        var oEmail = document.getElementById("email");
        var oCellulare = document.getElementById("cellulare");

        var oErroreNome = document.getElementById("erroreNome");
        var oErroreUser = document.getElementById("erroreUser");
        var oErrore2 = document.getElementById("errore2");


        if (oNome.value == ""){
            oNome.style.backgroundColor = "#FF7C7C";
            oErroreNome.innerHTML = "I Campi In Rosso Sono Obbligatori!";
            oErroreNome.style.color = "#ffffff";
            oErroreNome.style.backgroundColor = "#FF0000";
            oErroreNome.style.padding = "5px";
            return null;

        }
        else{
        oNome.style.backgroundColor = "";
        oErroreNome.innerHTML = "";
        oErroreNome.style.backgroundColor = "#FFffff";
        }

        if (oCognome.value == ""){
              oCognome.style.backgroundColor = "#FF7C7C";
              oErroreNome.innerHTML = "I Campi In Rosso Sono Obbligatori!";
              oErroreNome.style.color = "#ffffff";
              oErroreNome.style.backgroundColor = "#FF0000";
              oErroreNome.style.padding = "5px";
           return null;
        }else{
        oCognome.style.backgroundColor = "";
        oErroreNome.innerHTML = "";
        oErroreNome.style.backgroundColor = "#FFffff";
        }


        if (oCellulare.value != ""){
          var strCellulare = oCellulare.value;
          if ( /[3]{1}[0-9]{8,10}/.test(strCellulare) )  {
              oCellulare.style.backgroundColor = "";
              oErroreNome.innerHTML = "";
              oErroreNome.style.backgroundColor = "#FFffff";
          } else {
            oCellulare.style.backgroundColor = "#FF7C7C";
            oErroreNome.innerHTML = "Inserire soltanto il numero, senza altri caratteri (/, -)!";
            oErroreNome.style.color = "#ffffff";
            oErroreNome.style.backgroundColor = "#FF0000";
            oErroreNome.style.padding = "5px";
           return null;
          }
        }else{
        oCellulare.style.backgroundColor = "";
        oErroreNome.innerHTML = "";
        oErroreNome.style.backgroundColor = "#FFffff";
        }


        if (oUser.value == ""){
            oUser.style.backgroundColor = "#FF7C7C";
            oErroreUser.innerHTML = "I Campi In Rosso Sono Obbligatori!";
            oErroreUser.style.color = "#ffffff";
            oErroreUser.style.backgroundColor = "#FF0000";
            oErroreUser.style.padding = "5px";
           return null;
        }
        else { if (oUser.value.length < 6){
                  oUser.style.backgroundColor = "#FF7C7C";
                  oErroreUser.innerHTML = "Il nome utente deve contenere almeno 6 caratteri alfanumerici, senza spazi!";
                  oErroreUser.style.color = "#ffffff";
                  oErroreUser.style.backgroundColor = "#FF0000";
                  oErroreUser.style.padding = "5px";
                  return null;
                  } else {
                         if ( /^[a-z0-9]+$/.test(oUser.value) ) {
                         oUser.style.backgroundColor = "";
                         oErroreUser.innerHTML = "";
                         oErroreUser.style.backgroundColor = "#FFffff";
                         } else {
                         oUser.style.backgroundColor = "#FF7C7C";
                         oErroreUser.innerHTML = "Il nome utente non è valido. Utilizza solo lettere minuscole e numeri senza spazi!";
                         oErroreUser.style.color = "#ffffff";
                         oErroreUser.style.backgroundColor = "#FF0000";
                         oErroreUser.style.padding = "5px";
                         return null;
                         }
                  }
        }

        if (oPass.value == ""){
            oPass.style.backgroundColor = "#FF7C7C";
            oErroreUser.innerHTML = "I Campi In Rosso Sono Obbligatori!";
            oErroreUser.style.color = "#ffffff";
            oErroreUser.style.backgroundColor = "#FF0000";
            oErroreUser.style.padding = "5px";
           return null;
        }
        else { if (oPass.value.length < 6){
                  oPass.style.backgroundColor = "#FF7C7C";
                  oErroreUser.innerHTML = "La password deve contenere almeno 6 caratteri alfanumerici!";
                  oErroreUser.style.color = "#ffffff";
                  oErroreUser.style.backgroundColor = "#FF0000";
                  oErroreUser.style.padding = "5px";
                  return null;
                  } else {
                         if ( /^[a-z0-9]+$/.test(oPass.value) ) {
                         oPass.style.backgroundColor = "";
                         oErroreUser.innerHTML = "";
                         oErroreUser.style.backgroundColor = "#FFffff";
                         } else {
                         oPass.style.backgroundColor = "#FF7C7C";
                         oErroreUser.innerHTML = "La password non è valida. Utilizza solo lettere minuscole e numeri!";
                         oErroreUser.style.color = "#ffffff";
                         oErroreUser.style.backgroundColor = "#FF0000";
                         oErroreUser.style.padding = "5px";
                         return null;
                         }
                  }
        }

        if (oEmail.value == ""){
            oEmail.style.backgroundColor = "#FF7C7C";
            oErroreUser.innerHTML = "I Campi In Rosso Sono Obbligatori!";
            oErroreUser.style.color = "#ffffff";
            oErroreUser.style.backgroundColor = "#FF0000";
            oErroreUser.style.padding = "5px";
           return null;
        } else {
          var strEmail = oEmail.value;
          if ( /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(strEmail) )  {
              oEmail.style.backgroundColor = "";
              oErroreUser.innerHTML = "";
              oErroreUser.style.backgroundColor = "#FFffff";
          } else {
            oEmail.style.backgroundColor = "#FF7C7C";
            oErroreUser.innerHTML = "Inserire un indirizzo e-mail valido!";
            oErroreUser.style.color = "#ffffff";
            oErroreUser.style.backgroundColor = "#FF0000";
            oErroreUser.style.padding = "5px";
           return null;
          }
        }

        if (document.form_reg.inform[1].checked) {
            oErrore2.innerHTML = "E' Obbligatorio Il Consenso Al Trattamento Dei Dati";
            oErrore2.style.fontSize = "12px";
            oErrore2.style.textDecoration = "blink";
            oErrore2.style.backgroundColor = "#FF0000";
            oErrore2.style.color = "#000000";
            oErrore2ore.style.padding = "5px";
           return null;
        }
        else {
        oErrore2.innerHTML = "";
        oErrore2.style.backgroundColor = "#FFffff";
        }



document.form_reg.action = "index.php?sel=user_up";
document.form_reg.submit();

}
function controllaUserMod () {
        var oNome = document.getElementById("nome");
        var oCognome = document.getElementById("cognome");
        var oPass = document.getElementById("pass");
        var oCellulare = document.getElementById("cellulare");

        var oErroreNome = document.getElementById("erroreNome");
        var oErroreUser = document.getElementById("erroreUser");
        var oErrore2 = document.getElementById("errore2");


        if (oNome.value == ""){
            oNome.style.backgroundColor = "#FF7C7C";
            oErroreNome.innerHTML = "I Campi In Rosso Sono Obbligatori!";
            oErroreNome.style.color = "#ffffff";
            oErroreNome.style.backgroundColor = "#FF0000";
            oErroreNome.style.padding = "5px";
            return null;

        }
        else{
        oNome.style.backgroundColor = "";
        oErroreNome.innerHTML = "";
        oErroreNome.style.backgroundColor = "#FFffff";
        }

        if (oCognome.value == ""){
              oCognome.style.backgroundColor = "#FF7C7C";
              oErroreNome.innerHTML = "I Campi In Rosso Sono Obbligatori!";
              oErroreNome.style.color = "#ffffff";
              oErroreNome.style.backgroundColor = "#FF0000";
              oErroreNome.style.padding = "5px";
           return null;
        }else{
        oCognome.style.backgroundColor = "";
        oErroreNome.innerHTML = "";
        oErroreNome.style.backgroundColor = "#FFffff";
        }


        if (oCellulare) {
        if (oCellulare.value != ""){
          var strCellulare = oCellulare.value;
          if ( /[3]{1}[0-9]{8,10}/.test(strCellulare) )  {
              oCellulare.style.backgroundColor = "";
              oErroreNome.innerHTML = "";
              oErroreNome.style.backgroundColor = "#FFffff";
          } else {
            oCellulare.style.backgroundColor = "#FF7C7C";
            oErroreNome.innerHTML = "Inserire soltanto il numero, senza altri caratteri (/, -)!";
            oErroreNome.style.color = "#ffffff";
            oErroreNome.style.backgroundColor = "#FF0000";
            oErroreNome.style.padding = "5px";
           return null;
          }
        }else{
        oCellulare.style.backgroundColor = "";
        oErroreNome.innerHTML = "";
        oErroreNome.style.backgroundColor = "#FFffff";
        }
        }


        if (oPass.value == ""){
            oPass.style.backgroundColor = "#FF7C7C";
            oErroreUser.innerHTML = "I Campi In Rosso Sono Obbligatori!";
            oErroreUser.style.color = "#ffffff";
            oErroreUser.style.backgroundColor = "#FF0000";
            oErroreUser.style.padding = "5px";
           return null;
        }
        else { if (oPass.value.length < 6){
                  oPass.style.backgroundColor = "#FF7C7C";
                  oErroreUser.innerHTML = "La password deve contenere almeno 6 caratteri alfanumerici!";
                  oErroreUser.style.color = "#ffffff";
                  oErroreUser.style.backgroundColor = "#FF0000";
                  oErroreUser.style.padding = "5px";
                  return null;
                  } else {
                         if ( /^[a-z0-9]+$/.test(oPass.value) ) {
                         oPass.style.backgroundColor = "";
                         oErroreUser.innerHTML = "";
                         oErroreUser.style.backgroundColor = "#FFffff";
                         } else {
                         oPass.style.backgroundColor = "#FF7C7C";
                         oErroreUser.innerHTML = "La password non è valida. Utilizza solo lettere minuscole e numeri!";
                         oErroreUser.style.color = "#ffffff";
                         oErroreUser.style.backgroundColor = "#FF0000";
                         oErroreUser.style.padding = "5px";
                         return null;
                         }
                  }
        }


document.form_utente.action = "index.php?sel=dati_user&op=mod";
document.form_utente.submit();

}

function sendPass () {
        var oEmail = document.getElementById("email");

        var oErroreUser = document.getElementById("erroreUser");

        if (oEmail.value == ""){
            oEmail.style.backgroundColor = "#FF7C7C";
            oErroreUser.innerHTML = "Devi inserire l'indirizzo e-mail!";
            oErroreUser.style.color = "#ffffff";
            oErroreUser.style.backgroundColor = "#FF0000";
            oErroreUser.style.padding = "5px";
           return null;
        } else {
          var strEmail = oEmail.value;
          if ( /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(strEmail) )  {
              oEmail.style.backgroundColor = "";
              oErroreUser.innerHTML = "";
              oErroreUser.style.backgroundColor = "#FFffff";
          } else {
            oEmail.style.backgroundColor = "#FF7C7C";
            oErroreUser.innerHTML = "Inserire un indirizzo e-mail valido!";
            oErroreUser.style.color = "#ffffff";
            oErroreUser.style.backgroundColor = "#FF0000";
            oErroreUser.style.padding = "5px";
           return null;
          }
        }


document.get_pass.action = "index.php?sel=get_pass&op=send";
document.get_pass.submit();

}

