﻿// File JScript

/* Funzione cambia immagine menù home */

function changeImgMenu(imageUrl,cont){
    var nomeImg = "imgMenuPrinc" + cont;
    document.getElementById(nomeImg).src=imageUrl;
}

/* Funzione cambia immagine testata home */

function changeImageTestata(imageUrl){
    var urlImg = "url(" + imageUrl +")";
    document.getElementById("img_menu_home").style.backgroundImage = urlImg;
}

/* Funzione nascondi/visualizza menù pagine secondarie */

function azioneSuDiv(nomeDiv){

	if(document.getElementById(nomeDiv).style.display == 'none'){
		document.getElementById(nomeDiv).style.display = '';
	}else{
		document.getElementById(nomeDiv).style.display = 'none';
	}
	
}

/* Funzione cambia classe voce menù secondo livello (menù pag.secondarie) */

function changeClassDiv(nomeDivIILiv,nomeBloccoIIILiv,divIIILivSel,divIILivSel){

    if(document.getElementById(nomeBloccoIIILiv).style.display == 'none'){
        document.getElementById(nomeDivIILiv).className = "menu_box_2liv";
    }else{
        document.getElementById(nomeDivIILiv).className = "menu_box_2liv_ev";
    }         
    
    /*if(parseInt(divIIILivSel) > 0){
        document.getElementById(divIIILivSel).className = "menu_box_3liv";
    }*/
    
    if(parseInt(divIILivSel) > 0){
        document.getElementById(divIILivSel).className = "menu_box_2liv";
    }
    
}   

/* Funzione che esegue il redirect della pagina */

function goToMenu(url){

    location.href = url;

}

/*Funzione che controlla i paramentri di ricerca delle news*/

function controlloParamRicercaNews(DaDataGG,DaDataMM,DaDataYYYY,ADataGG,ADataMM,ADataYYYY,DaScadenzaGG,DaScadenzaMM,DaScadenzaYYYY,AScadenzaGG,AScadenzaMM,AScadenzaYYYY){
      
     /*Controllo se valore numerico ai campi data*/ 
     if(isNaN(document.getElementById(DaDataGG).value)){
        alert('Inserire un valore numerico per il giorno nel campo "Da data news"');
        return false;
     }
     if(isNaN(document.getElementById(ADataGG).value)){
        alert('Inserire un valore numerico per il giorno nel campo "A data news"');
        return false;
     }
     if(isNaN(document.getElementById(DaScadenzaGG).value)){
        alert('Inserire un valore numerico per il giorno nel campo "Da data scadenza"');
        return false;
     }
     if(isNaN(document.getElementById(AScadenzaGG).value)){
        alert('Inserire un valore numerico per il giorno nel campo "A data scadenza"');
        return false;
     }
     
     if(isNaN(document.getElementById(DaDataMM).value)){
        alert('Inserire un valore numerico per il mese nel campo "Da data news"');
        return false;
     }
     if(isNaN(document.getElementById(ADataMM).value)){
        alert('Inserire un valore numerico per il mese nel campo "A data news"');
        return false;
     }
     if(isNaN(document.getElementById(DaScadenzaMM).value)){
        alert('Inserire un valore numerico per il mese nel campo "Da data scadenza"');
        return false;
     }
     if(isNaN(document.getElementById(AScadenzaMM).value)){
        alert('Inserire un valore numerico per il mese nel campo "A data scadenza"');
        return false;
     }
     
     if(isNaN(document.getElementById(DaDataYYYY).value)){
        alert('Inserire un valore numerico per l\'anno nel campo "Da data news"');
        return false;
     }
     if(isNaN(document.getElementById(ADataYYYY).value)){
        alert('Inserire un valore numerico per l\'anno nel campo "A data news"');
        return false;
     }
     if(isNaN(document.getElementById(DaScadenzaYYYY).value)){
        alert('Inserire un valore numerico per l\'anno nel campo "Da data scadenza"');
        return false;
     }
     if(isNaN(document.getElementById(AScadenzaYYYY).value)){
        alert('Inserire un valore numerico per l\'anno nel campo "A data scadenza"');
        return false;
     } 
      
      
     /*Controllo campo DA DATA GG*/ 
     if(parseInt(document.getElementById(DaDataGG).value,10) < 1 || parseInt(document.getElementById(DaDataGG).value,10) > 31){
        alert('Inserire un valore compreso tra 1 e 31 per il giorno nel campo "Da data news"');
        return false;
     }
     if(parseInt(document.getElementById(DaDataMM).value,10) < 1 || parseInt(document.getElementById(DaDataMM).value,10) > 12){
        alert('Inserire un valore compreso tra 1 e 12 per il mese nel campo "Da data news"');
        return false;
     }
     if(parseInt(document.getElementById(DaDataYYYY).value,10) < 1901 || parseInt(document.getElementById(DaDataYYYY).value,10) > 2078){
        alert('Inserire un valore valido per l\'anno nel campo "Da data news"');
        return false;
     }
     
     if((document.getElementById(DaDataGG).value != "" || document.getElementById(DaDataYYYY).value != "") && document.getElementById(DaDataMM).value == "" ){
        alert('Valorizzare mese nel campo "Da data news"');
        return false;
     }
     if((document.getElementById(DaDataGG).value != "" || document.getElementById(DaDataMM).value != "" ) && document.getElementById(DaDataYYYY).value == "" ){
        alert('Valorizzare anno nel campo "Da data news"');
        return false;
     }
     if((document.getElementById(DaDataMM).value != "" || document.getElementById(DaDataYYYY).value != "") && document.getElementById(DaDataGG).value == "" ){
        alert('Valorizzare giorno nel campo "Da data news"');
        return false;
     }
     
     if((parseInt(document.getElementById(DaDataMM).value,10) == 11 || parseInt(document.getElementById(DaDataMM).value,10) == 4 || parseInt(document.getElementById(DaDataMM).value,10) == 6 || parseInt(document.getElementById(DaDataMM).value,10) == 9) && parseInt(document.getElementById(DaDataGG).value,10) > 30){
        alert('Il numero del giorno non può essere più grande di 30 per il mese selezionato nel campo "Da data news"');
        return false;
     }
     if((parseInt(document.getElementById(DaDataMM).value,10) == 2) && parseInt(document.getElementById(DaDataGG).value,10) > 28){
        alert('Il numero del giorno non può essere più grande di 28 per il mese selezionato nel campo "Da data news"');
        return false;
     }
     
     
     /*Controllo campo A DATA GG*/ 
     if(parseInt(document.getElementById(ADataGG).value,10) < 1 || parseInt(document.getElementById(ADataGG).value,10) > 31){
        alert('Inserire un valore compreso tra 1 e 31 per il giorno nel campo "A data news"');
        return false;
     }
     if(parseInt(document.getElementById(ADataMM).value,10) < 1 || parseInt(document.getElementById(ADataMM).value,10) > 12){
        alert('Inserire un valore compreso tra 1 e 12 per il mese nel campo "A data news"');
        return false;
     }
     if(parseInt(document.getElementById(ADataYYYY).value,10) < 1901 || parseInt(document.getElementById(ADataYYYY).value,10) > 2078){
        alert('Inserire un valore valido per l\'anno nel campo "A data news"');
        return false;
     }
     
     if((document.getElementById(ADataGG).value != "" || document.getElementById(ADataYYYY).value != "") && document.getElementById(ADataMM).value == "" ){
        alert('Valorizzare mese nel campo "A data news"');
        return false;
     }
     if((document.getElementById(ADataGG).value != "" || document.getElementById(ADataMM).value != "" ) && document.getElementById(ADataYYYY).value == "" ){
        alert('Valorizzare anno nel campo "A data news"');
        return false;
     }
     if((document.getElementById(ADataMM).value != "" || document.getElementById(ADataYYYY).value != "") && document.getElementById(ADataGG).value == "" ){
        alert('Valorizzare giorno nel campo "A data news"');
        return false;
     }
     
     if((parseInt(document.getElementById(ADataMM).value,10) == 11 || parseInt(document.getElementById(ADataMM).value,10) == 4 || parseInt(document.getElementById(ADataMM).value,10) == 6 || parseInt(document.getElementById(ADataMM).value,10) == 9) && parseInt(document.getElementById(ADataGG).value,10) > 30){
        alert('Il numero del giorno non può essere più grande di 30 per il mese selezionato nel campo "A data news"');
        return false;
     }
     if((parseInt(document.getElementById(ADataMM).value,10) == 2) && parseInt(document.getElementById(ADataGG).value,10) > 28){
        alert('Il numero del giorno non può essere più grande di 28 per il mese selezionato nel campo "A data news"');
        return false;
     }
     

     /*Controllo campo DA DATA SCADENZA GG*/ 
     if(parseInt(document.getElementById(DaScadenzaGG).value,10) < 1 || parseInt(document.getElementById(DaScadenzaGG).value,10) > 31){
        alert('Inserire un valore compreso tra 1 e 31 per il giorno nel campo "Da data scadenza"');
        return false;
     }
     if(parseInt(document.getElementById(DaScadenzaMM).value,10) < 1 || parseInt(document.getElementById(DaScadenzaMM).value,10) > 12){
        alert('Inserire un valore compreso tra 1 e 12 per il mese nel campo "Da data scadenza"');
        return false;
     }
     if(parseInt(document.getElementById(DaScadenzaYYYY).value,10) < 1901 || parseInt(document.getElementById(DaScadenzaYYYY).value,10) > 2078){
        alert('Inserire un valore valido per l\'anno nel campo "Da data scadenza"');
        return false;
     }
     
     if((document.getElementById(DaScadenzaGG).value != "" || document.getElementById(DaScadenzaYYYY).value != "") && document.getElementById(DaScadenzaMM).value == "" ){
        alert('Valorizzare mese nel campo "Da data scadenza"');
        return false;
     }
     if((document.getElementById(DaScadenzaGG).value != "" || document.getElementById(DaScadenzaMM).value != "" ) && document.getElementById(DaScadenzaYYYY).value == "" ){
        alert('Valorizzare anno nel campo "Da data scadenza"');
        return false;
     }
     if((document.getElementById(DaScadenzaMM).value != "" || document.getElementById(DaScadenzaYYYY).value != "") && document.getElementById(DaScadenzaGG).value == "" ){
        alert('Valorizzare giorno nel campo "Da data scadenza"');
        return false;
     }
     
     if((parseInt(document.getElementById(DaScadenzaMM).value,10) == 11 || parseInt(document.getElementById(DaScadenzaMM).value,10) == 4 || parseInt(document.getElementById(DaScadenzaMM).value,10) == 6 || parseInt(document.getElementById(DaScadenzaMM).value,10) == 9) && parseInt(document.getElementById(DaScadenzaGG).value,10) > 30){
        alert('Il numero del giorno non può essere più grande di 30 per il mese selezionato nel campo "Da data scadenza"');
        return false;
     }
     if((parseInt(document.getElementById(DaScadenzaMM).value,10) == 2) && parseInt(document.getElementById(DaScadenzaGG).value,10) > 28){
        alert('Il numero del giorno non può essere più grande di 28 per il mese selezionato nel campo "Da data scadenza"');
        return false;
     }

     /*Controllo campo A DATA SCADENZA GG*/ 
     if(parseInt(document.getElementById(AScadenzaGG).value,10) < 1 || parseInt(document.getElementById(AScadenzaGG).value,10) > 31){
        alert('Inserire un valore compreso tra 1 e 31 per il giorno nel campo "A data scadenza"');
        return false;
     }
     if(parseInt(document.getElementById(AScadenzaMM).value,10) < 1 || parseInt(document.getElementById(AScadenzaMM).value,10) > 12){
        alert('Inserire un valore compreso tra 1 e 12 per il mese nel campo "A data scadenza"');
        return false;
     }
     if(parseInt(document.getElementById(AScadenzaYYYY).value,10) < 1901 || parseInt(document.getElementById(AScadenzaYYYY).value,10) > 2078){
        alert('Inserire un valore valido per l\'anno nel campo "A data scadenza"');
        return false;
     }
     
     if((document.getElementById(AScadenzaGG).value != "" || document.getElementById(AScadenzaYYYY).value != "") && document.getElementById(AScadenzaMM).value == "" ){
        alert('Valorizzare mese nel campo "A data scadenza"');
        return false;
     }
     if((document.getElementById(AScadenzaGG).value != "" || document.getElementById(AScadenzaMM).value != "" ) && document.getElementById(AScadenzaYYYY).value == "" ){
        alert('Valorizzare anno nel campo "A data scadenza"');
        return false;
     }
     if((document.getElementById(AScadenzaMM).value != "" || document.getElementById(AScadenzaYYYY).value != "") && document.getElementById(AScadenzaGG).value == "" ){
        alert('Valorizzare giorno nel campo "A data scadenza"');
        return false;
     }
     
     if((parseInt(document.getElementById(AScadenzaMM).value,10) == 11 || parseInt(document.getElementById(AScadenzaMM).value,10) == 4 || parseInt(document.getElementById(AScadenzaMM).value,10) == 6 || parseInt(document.getElementById(AScadenzaMM).value,10) == 9) && parseInt(document.getElementById(AScadenzaGG).value,10) > 30){
        alert('Il numero del giorno non può essere più grande di 30 per il mese selezionato nel campo "A data scadenza"');
        return false;
     }
     if((parseInt(document.getElementById(AScadenzaMM).value,10) == 2) && parseInt(document.getElementById(AScadenzaGG).value,10) > 28){
        alert('Il numero del giorno non può essere più grande di 28 per il mese selezionato nel campo "A data scadenza"');
        return false;
     }
      return true;
}

/*Funzione che controlla data*/

function controlloData(CampoGG,CampoMM,CampoYYYY){
      
     /*Controllo se valore numerico ai campi data*/ 
     if(isNaN(document.getElementById(CampoGG).value)){
        alert('Inserire un valore numerico per il giorno nel campo "Da data news"');
        return false;
     }
     if(isNaN(document.getElementById(CampoMM).value)){
        alert('Inserire un valore numerico per il giorno nel campo "A data news"');
        return false;
     }
     if(isNaN(document.getElementById(CampoYYYY).value)){
        alert('Inserire un valore numerico per il giorno nel campo "Da data scadenza"');
        return false;
     }
      
     /*Controllo campo*/ 
    
     if(parseInt(document.getElementById(CampoGG).value,10) < 1 || parseInt(document.getElementById(CampoGG).value,10) > 31){
        alert('Inserire un valore compreso tra 1 e 31 per il giorno nel campo "Da data news"');
        return false;
     }
     if(parseInt(document.getElementById(CampoMM).value,10) < 1 || parseInt(document.getElementById(CampoMM).value,10) > 12){
        alert('Inserire un valore compreso tra 1 e 12 per il mese nel campo "Da data news"');
        return false;
     }
     if(parseInt(document.getElementById(CampoYYYY).value,10) < 1901 || parseInt(document.getElementById(CampoYYYY).value,10) > 2078){
        alert('Inserire un valore valido per l\'anno nel campo "Da data news"');
        return false;
     }
     
     if((document.getElementById(CampoGG).value != "" || document.getElementById(CampoYYYY).value != "") && document.getElementById(CampoMM).value == "" ){
        alert('Valorizzare mese nel campo "Da data news"');
        return false;
     }
     if((document.getElementById(CampoGG).value != "" || document.getElementById(CampoMM).value != "" ) && document.getElementById(CampoYYYY).value == "" ){
        alert('Valorizzare anno nel campo "Da data news"');
        return false;
     }
     if((document.getElementById(CampoMM).value != "" || document.getElementById(CampoYYYY).value != "") && document.getElementById(CampoGG).value == "" ){
        alert('Valorizzare giorno nel campo "Da data news"');
        return false;
     }
     
     if((parseInt(document.getElementById(CampoMM).value,10) == 11 || parseInt(document.getElementById(CampoMM).value,10) == 4 || parseInt(document.getElementById(CampoMM).value,10) == 6 || parseInt(document.getElementById(CampoMM).value,10) == 9) && parseInt(document.getElementById(CampoGG).value,10) > 30){
        alert('Il numero del giorno non può essere più grande di 30 per il mese selezionato nel campo "Da data news"');
        return false;
     }
     if((parseInt(document.getElementById(CampoMM).value,10) == 2) && parseInt(document.getElementById(CampoGG).value,10) > 28){
        alert('Il numero del giorno non può essere più grande di 28 per il mese selezionato nel campo "Da data news"');
        return false;
     }
     
     
    
      return true;
}

/* Modifica la dimensione del font su un insieme di elemento
   Parametri: 
        insiemeElementi: l'insieme di elementi su cui applicare la nuova dimensione
        formato:         meno/normale/piu                   
*/

var minSize=9;
var maxSize=15;

function CambiaFontSize(formato){
	
	var size = 0;
	
	var insiemeElementi;
	
	
	if(formato == "set"){
	        
	       if(document.getElementById('Accessibilita_txtpostBack').value != "yes" && (document.getElementById('Accessibilita_sizeCarattere').value == 0 || document.getElementById('Accessibilita_sizeCarattere').value=='')){
	            formato = "normale";
	       }

	}
	
	
    for (var k = 0; k < 8; k++){
    
        if(k==0){
            insiemeElementi = document.getElementsByTagName('DIV');        
        }else if(k==1){
            insiemeElementi = document.getElementsByTagName('A');
        }else if(k==2){
            insiemeElementi = document.getElementsByTagName('LABEL');
        }else if(k==3){
            insiemeElementi = document.getElementsByTagName('SPAN');
        }else if(k==4){
            insiemeElementi = document.getElementsByTagName('TD');
        }else if(k==5){
            insiemeElementi = document.getElementsByTagName('TH');
        }else if(k==6){
            insiemeElementi = document.getElementsByTagName('INPUT');
        }else if(k==7){
            insiemeElementi = document.getElementsByTagName('SELECT');
        }
    
        for (var i = 0; i < insiemeElementi.length; i++ ) {
    		
		    /**/
    		
		    if(document.getElementById('Accessibilita_sizeCarattere').value == 0 || document.getElementById('Accessibilita_sizeCarattere').value==''){  
	            
	          
                if(insiemeElementi[i].style.fontSize) {
                    size = parseInt(insiemeElementi[i].style.fontSize.replace("px",""));
                } else {
                    if(formato!="normale"){
                        size = 11;
                    }else{
                        size = 0;
                    }
                }
                
           }else{
                size = parseInt(document.getElementById('Accessibilita_sizeCarattere').value);
            }
      
	        if(formato=="piu"){
    		
	            if(size<maxSize) {
	                size = size + 2;
	            }
    		    
	            insiemeElementi[i].style.fontSize = size  + "px";   
	            
	            
	        }else if(formato=="meno"){
		        
    		    
	            if(size>minSize) {
	                size = size - 2;
	            }else{
	                size = 9;
	            }
    		    
	            insiemeElementi[i].style.fontSize = size + "px";
	             	      
	        }else if(formato=="normale"){
    		
	            // se normale = ripristinati i valori della clase
		        insiemeElementi[i].style.fontSize="";  
			          
	        }else if(formato=="set"){
    		    
		        insiemeElementi[i].style.fontSize=size;            
	        }
    			
        }
	
    }
	
    
	   document.getElementById('Accessibilita_sizeCarattere').value = size;
	
}

function clickButton(e, buttonid){ 
      var evt;
      var isfirefox;
     if(window.event){
        evt = e.keyCode;
        isfirefox=false;
      }else{
        evt = e.which;
        isfirefox=true;
      }
      var bt = document.getElementById(buttonid);
      if (bt){ 
          if (evt == 13){
                if (!isfirefox){
                   bt.click(); 
                }else{
                   bt.click(); 
                }
                return false; 
          } 
   } 
}

/* Controllo campo obbligatorio */

function isMandatory(campoId){
    var campoDaCompilare = true;
          
    if(document.getElementById(campoId).value == ''){
        alert("Compilare i campi obbligatori");
        return false;
    }else{
        return true;
    }
    
}

/* Funzione che controlla se la combo è valorizzata */

function isValidateCombo(campoId,alertText){
    var campoDaCompilare = true;
        
    if(document.getElementById(campoId).value == 0){
        alert(alertText);
        return false;
    }else{
        return true;
    }
}


/* Controllo campi obbligatori Form prenotazione internet */

function controlloFormPrenotazione(DDTipoVisita,txtNRicetta,txtNome,txtCognome,txtCF,DataNascGG,DataNascMM,DataNascYYYY,txtLuogoNasc,txtResidenza,txtVia,txtMail,txtTel){
     
    var alertText = 'Scegliere una visita specialistica' ;
     
    if(isValidateCombo(DDTipoVisita,alertText)==false){return false;}
      
    if(isMandatory(txtNRicetta)==false){return false;}
    
    if(isMandatory(txtNome)==false){return false;}
    
    if(isMandatory(txtCognome)==false){return false;}
    
    if(isMandatory(txtCF)==false){return false;}
    
    if(isMandatory(DataNascGG)==false){return false;}
    
    if(isMandatory(DataNascMM)==false){return false;}
    
    if(isMandatory(DataNascYYYY)==false){return false;}
    
    if(isMandatory(txtLuogoNasc)==false){return false;}
    
    if(isMandatory(txtResidenza)==false){return false;}
    
    if(isMandatory(txtVia)==false){return false;}
    
    /*if(isMandatory(txtMail)==false){return false;}*/
    
    if(isMandatory(txtTel)==false){return false;}

    if(controlloData('DataNascGG','DataNascMM','DataNascYYYY')==false){return false;} 
    
    if(controllomail(document.getElementById(txtMail).value)==false){return false;}
    
}

/* funzione che controlla l'indirizzo mail inserito */

function controllomail(mail){

    if(mail!=''){
	    var espressione = /^[_a-z0-9+-]+(\.[_a-z0-9+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$/;
	    if (!espressione.test(mail))
	    {
	        alert("Il formato della mail non è valido!");
	        return false;
	    }
	}
	return true;
}

/* apri finestra in un popup */

function apriPopup(url,width,height) {
 
    window.open(url,'Popup', 'top=300,left=400, width='+ width +', height=' + height + ', resizable=no, status=no, scrollbars=no, location=no');
    return false;
} 

/* apri finestra in un popup */

function apriPopupFornitore(url,width,height) {
 
    window.open(url,'PopupFornitore', 'top=100,left=200,width='+ width +', height=' + height + ' resizable=no, status=no, scrollbars=yes, location=no');
    return false;
} 

/* apri finestra in un popup */

function accreditaFornitore(url,width,height) {
 
    if(confirm('Sei sicuro di voler accreditare il fornitore?')){
        window.open(url,'PopupFornitore', 'top=100,left=200,width='+ width +', height=' + height + ' resizable=no, status=no, scrollbars=yes, location=no');
        return false;
    }
    
    return false;
} 

/* funzione che restituisce la scelta di un popup in una textbox */

function returnValue(campoValue,idCampo){

    opener.parent.document.getElementById(idCampo).value = campoValue.replace(/\*/g,"'");
    window.close();

}

function returnValueWithId(campoIdValue,campoDescValue,idCampo,descCampo){

    opener.parent.document.getElementById(idCampo).value = campoIdValue;
    opener.parent.document.getElementById(descCampo).value = campoDescValue.replace(/\*/g,"'");
    window.close();

}

function apriSceltaProdotto(url,width,height){

    url += document.getElementById('ProdottiFornitori_HFCatMerce').value;
    
    
    window.open(url,'apriSceltaProdotto', 'top=300,left=400, width='+ width +', height=' + height + ', resizable=no, status=no, scrollbars=no, location=no');
    return false;

}

function apriSceltaProdottoModifica(url,width,height){

    url += document.getElementById('HFCatMerce').value;
    
    
    window.open(url,'apriSceltaProdotto', 'top=300,left=400, width='+ width +', height=' + height + ', resizable=no, status=no, scrollbars=no, location=no');
    return false;

}

/* funzione controllo inserimento prodotto fornitori */

function controlloInsProdotto(campoCatId,campoDescId){
    
    if(document.getElementById(campoCatId).value == '0' || document.getElementById(campoCatId).value == ''){
        alert('Scegliere la categoria merceologica');
        return false;
    }
    
    if(document.getElementById(campoDescId).value == '0' || document.getElementById(campoDescId).value == ''){
        alert('Scegliere il prodotto');
        return false;
    }
    
}

/* Controllo campi obbligatori Form Qualificazione fornitori */

function controlloFormQualificazioneFornitori(){
    
    if(isMandatory('TxtRagSociale')==false){return false;}
    
    if(isMandatory('TxtStatGiuridico')==false){return false;}
    
    if(isMandatory('TxtPartitaIva')==false){return false;}
    
    if(isMandatory('TxtDataGG')==false){return false;}
    
    if(isMandatory('TxtDataMM')==false){return false;}
    
    if(isMandatory('TxtDataYY')==false){return false;}
    
    if(isMandatory('TxtNome')==false){return false;}
    
    if(isMandatory('TxtCognome')==false){return false;}
    
    if(isMandatory('TxtFunzione')==false){return false;}
    
    if(isMandatory('TxtViaRif')==false){return false;}
    
    if(isMandatory('TxtNRif')==false){return false;}
    
    if(isMandatory('TxtCapRif')==false){return false;}
    
    if(isMandatory('TxtLocalitaRif')==false){return false;}
    
    if(isMandatory('TxtTelRif')==false){return false;}
    
    if(isMandatory('TxtMailRif')==false){return false;}
    
    if(isMandatory('TxtViaLeg')==false){return false;}
    
    if(isMandatory('TxtNLeg')==false){return false;}
    
    if(isMandatory('TxtCapLeg')==false){return false;}
    
    if(isMandatory('TxtLocalitaLeg')==false){return false;}
    
    if(isMandatory('TxtTelLeg')==false){return false;}
    
    if(isMandatory('TxtNDipendenti')==false){return false;}
    
    if(isMandatory('TxtNTempoPieno')==false){return false;}
    
    if(isMandatory('TxtNTempoPar')==false){return false;}
    
    if(isMandatory('TxtNDirigenti')==false){return false;}
    
    if(isMandatory('TxtNQuadri')==false){return false;}

    if(isMandatory('TxtNImpiegati')==false){return false;}
    
    if(isMandatory('TxtNOperai')==false){return false;}
    
    
    if(isNaN(document.getElementById('TxtNDipendenti').value)==true){
        alert('Il valore nel campo "Numero dipendenti" deve essere un numero');
        return false;
    }
    
    if(isNaN(document.getElementById('TxtNTempoPieno').value)==true){
        alert('Il valore nel campo "Dipendenti a tempo pieno" deve essere un numero');
        return false;
    }
    
    if(isNaN(document.getElementById('TxtNTempoPar').value)==true){
        alert('Il valore nel campo "Dipendenti a tempo parziale" deve essere un numero');
        return false;
    }
    
    if(isNaN(document.getElementById('TxtNDirigenti').value)==true){
        alert('Il valore nel campo "Numero dirigenti" deve essere un numero');
        return false;
    }
    
    if(isNaN(document.getElementById('TxtNQuadri').value)==true){
        alert('Il valore nel campo "Numero quadri" deve essere un numero');
        return false;
    }
    
    if(isNaN(document.getElementById('TxtNImpiegati').value)==true){
        alert('Il valore nel campo "Numero impiegati" deve essere un numero');
        return false;
    }
    
    if(isNaN(document.getElementById('TxtNOperai').value)==true){
        alert('Il valore nel campo "Numero operai" deve essere un numero');
        return false;
    }
   
    if(controlloData('TxtDataGG','TxtDataMM','TxtDataYY')==false){return false;} 
    
    if(document.getElementById('chkBoxPresaVisione').checked==false){
        alert('Per procedere dichiarare di aver preso visione');
        return false;      
    }
    
    if(document.getElementById('TxtMailRif').value != ""){
	    var espressione = /^[_a-z0-9+-]+(\.[_a-z0-9+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$/;
	    if (!espressione.test(document.getElementById('TxtMailRif').value))
	    {
	        alert("Il formato della mail non è valido!");
	        return false;
	    }
	}
	
	if(document.getElementById('TxtMailLeg').value != ""){
	    var espressione = /^[_a-z0-9+-]+(\.[_a-z0-9+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$/;
	    if (!espressione.test(document.getElementById('TxtMailLeg').value))
	    {
	        alert("Il formato della mail non è valido!");
	        return false;
	    }
	}
	
	if(document.getElementById('TxtMailOper').value != ""){
	    var espressione = /^[_a-z0-9+-]+(\.[_a-z0-9+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$/;
	    if (!espressione.test(document.getElementById('TxtMailOper').value))
	    {
	        alert("Il formato della mail non è valido!");
	        return false;
	    }
	}
    
    
}

/* funzione per controllare un minimo di caratteri prima di effettuare la ricerca */

function controlloCaratteriRicerca(campoID,numCaratteri){

    if(document.getElementById(campoID).value.length < numCaratteri){
        alert('Inserire almeno ' + numCaratteri + ' per effettuare la ricerca');
        return false;
    }

}

/* funzione per la scelta voce di menù parent */

function apriSceltaVoceParent(url,width,height){

    url += document.getElementById('HDTipoVoce').value;

    window.open(url,'apriSceltaVoceMenu', 'top=300,left=400, width='+ width +', height=' + height + ', resizable=no, status=no, scrollbars=no, location=no');
    return false;

}

/* funzione controllo inserimento link struttura */

function controlloLinkStruttura(campoLink){
    
    if(document.getElementById(campoLink).value == ''){
        alert('Valorizzare il campo Link');
        return false;
    }
    
}

/* funzione controllo inserimento link struttura */

function controlloEquipeStruttura(campoNome,Mail){
    
    if(document.getElementById(campoNome).value == ''){
        alert('Valorizzare il campo Nome');
        return false;
    }
    if(document.getElementById(Mail).value != ""){
	    var espressione = /^[_a-z0-9+-]+(\.[_a-z0-9+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$/;
	    if (!espressione.test(document.getElementById(Mail).value))
	    {
	        alert("Il formato della mail non è valido!");
	        return false;
	    }
	}
}

/* alert elimina Voce Menu */

function eliminaMenu(idMenu,idArea,VisPrivata,div){

    var confermaEli;
    var url;
    
    confermaEli = confirm('Sei sicuro di voler eliminare la voce?');
    if(confermaEli){
        url = "ListaMenu.aspx?azione=eli&idMenuEli=" + idMenu + "&idAreaEli=" + idArea + "&idArea=" + idArea + "&visPrivata=" + VisPrivata + "&div=" + div;
        
        location.href = url;
       
    }
}

/* controllo inserimento/modifica struttura */

function controlloSchedaStruttura(txtIDE,txtNome,txtEsistenzaIDE,txtMail){
     
    if(isMandatory(txtIDE)==false){return false;}
    
    if(isMandatory(txtNome)==false){return false;}
    
    if(document.getElementById(txtEsistenzaIDE).value=='1'){
    
        alert('IDE Esistente');
        return false;
    }
    
    if(controllomail(document.getElementById(txtMail).value)==false){return false;}
    
}

/* funzione che restituisce la scelta di un popup in una textbox */

function returnCurriculum(idCampo){

    opener.parent.document.getElementById(idCampo).value = document.getElementById('txtCVAttuale').value; 
    window.close();

}

/* funzione che restituisce la scelta di un popup in una textbox */

function returnAllegatoSPage(idCampo,campoDim){

    opener.parent.document.getElementById(idCampo).value = document.getElementById('txtAllegatoAttuale').value; 
    opener.parent.document.getElementById(campoDim).value = document.getElementById('HFDimensioneAttuale').value; 
    window.close();

}

/* controllo inserimento/modifica menu */

function controlloFormMenu(txtDesc,txtArea,txtTipoVoce,txtTipoIndirizzamento){
     
    if(document.getElementById(txtTipoVoce).options[0].selected==true){
    
        alert("Compilare i campi obbligatori");
        return false;
    }
    
    if(document.getElementById(txtArea).options[0].selected==true){
    
        alert("Compilare i campi obbligatori");
        return false;
    }
    
    if(document.getElementById(txtTipoIndirizzamento).options[0].selected==true){
    
        alert("Compilare i campi obbligatori");
        return false;
    }
    
    if(isMandatory(txtDesc)==false){return false;}
    
}

/* controllo inserimento/modifica pagina semplice */

function controlloPagSemplice(txtTitolo){
     
    if(isMandatory(txtTitolo)==false){return false;}
    
}

/* controllo inserimento/modifica allegato pagina semplice */

function controlloAllegatoSimplePage(txtNome){
     
    if(isMandatory(txtNome)==false){return false;}
    
}

/* controllo inserimento/modifica prestazione */

function controlloPrestazione(txtDescrizione,DDStruttura){
     
    if(isMandatory(txtDescrizione)==false){return false;}
    
    if(document.getElementById(DDStruttura).options[0].selected==true){
    
        alert("Compilare i campi obbligatori");
        return false;
    }
    
}

/* controllo inserimento/modifica catalogo */

function controlloCatalogo(txtISSN,txtTitolo,txtEsistenzaISSN){
     
    if(isMandatory(txtISSN)==false){return false;}
    
    if(isMandatory(txtTitolo)==false){return false;}
    
        if(document.getElementById(txtEsistenzaISSN).value=='1'){
    
        alert('ISSN Esistente');
        return false;
    }
    
}


/* funzione che restituisce la scelta di un popup in una textbox */

function returnAllegatoNews(idCampo,campoDim){

    opener.parent.document.getElementById(idCampo).value = document.getElementById('txtAllegatoAttuale').value; 
    opener.parent.document.getElementById(campoDim).value = document.getElementById('HFDimensioneAttuale').value; 
    window.close();

}


/*Funzione che controlla le date della pagina news*/

function controlloDataNews(daCampoGG,daCampoMM,daCampoYYYY,aCampoGG,aCampoMM,aCampoYYYY){
      
     /*Controllo se valore numerico ai campi data*/ 
     if(isNaN(document.getElementById(daCampoGG).value)){
        alert('Inserire un valore numerico per il Giorno nel campo "Data Pubblicazione"');
        return false;
     }
     if(isNaN(document.getElementById(daCampoMM).value)){
        alert('Inserire un valore numerico per il Mese nel campo "Data Pubblicazione"');
        return false;
     }
     if(isNaN(document.getElementById(daCampoYYYY).value)){
        alert('Inserire un valore numerico per l Anno nel campo "Data Pubblicazione"');
        return false;
     }
      
     /*Controllo campo*/ 
    
     if(parseInt(document.getElementById(daCampoGG).value,10) < 1 || parseInt(document.getElementById(daCampoGG).value,10) > 31){
        alert('Inserire un valore compreso tra 1 e 31 per il giorno nel campo "Data Pubblicazione"');
        return false;
     }
     if(parseInt(document.getElementById(daCampoMM).value,10) < 1 || parseInt(document.getElementById(daCampoMM).value,10) > 12){
        alert('Inserire un valore compreso tra 1 e 12 per il mese nel campo "Data Pubblicazione"');
        return false;
     }
     if(parseInt(document.getElementById(daCampoYYYY).value,10) < 1901 || parseInt(document.getElementById(daCampoYYYY).value,10) > 2078){
        alert('Inserire un valore valido per l\'anno nel campo "Data Pubblicazione"');
        return false;
     }
     
     if((document.getElementById(daCampoGG).value != "" || document.getElementById(daCampoYYYY).value != "") && document.getElementById(daCampoMM).value == "" ){
        alert('Valorizzare mese nel campo "Data Pubblicazione"');
        return false;
     }
     if((document.getElementById(daCampoGG).value != "" || document.getElementById(daCampoMM).value != "" ) && document.getElementById(daCampoYYYY).value == "" ){
        alert('Valorizzare anno nel campo "Data Pubblicazione"');
        return false;
     }
     if((document.getElementById(daCampoMM).value != "" || document.getElementById(daCampoYYYY).value != "") && document.getElementById(daCampoGG).value == "" ){
        alert('Valorizzare giorno nel campo "Data Pubblicazione"');
        return false;
     }
     
     if((parseInt(document.getElementById(daCampoMM).value,10) == 11 || parseInt(document.getElementById(daCampoMM).value,10) == 4 || parseInt(document.getElementById(daCampoMM).value,10) == 6 || parseInt(document.getElementById(daCampoMM).value,10) == 9) && parseInt(document.getElementById(daCampoGG).value,10) > 30){
        alert('Il numero del giorno non può essere più grande di 30 per il mese selezionato nel campo "Data Pubblicazione"');
        return false;
     }
     if((parseInt(document.getElementById(daCampoMM).value,10) == 2) && parseInt(document.getElementById(daCampoGG).value,10) > 28){
        alert('Il numero del giorno non può essere più grande di 28 per il mese selezionato nel campo "Data Pubblicazione"');
        return false;
     }
     
     
         /*Controllo se valore numerico ai campi data*/ 
     if(isNaN(document.getElementById(aCampoGG).value)){
        alert('Inserire un valore numerico per il Giorno nel campo "Data Scadenza"');
        return false;
     }
     if(isNaN(document.getElementById(aCampoMM).value)){
        alert('Inserire un valore numerico per il Mese nel campo "Data Scadenza"');
        return false;
     }
     if(isNaN(document.getElementById(aCampoYYYY).value)){
        alert('Inserire un valore numerico per l Anno nel campo "Data Scadenza"');
        return false;
     }
      
     /*Controllo campo*/ 
    
     if(parseInt(document.getElementById(aCampoGG).value,10) < 1 || parseInt(document.getElementById(aCampoGG).value,10) > 31){
        alert('Inserire un valore compreso tra 1 e 31 per il giorno nel campo "Data Scadenza"');
        return false;
     }
     if(parseInt(document.getElementById(aCampoMM).value,10) < 1 || parseInt(document.getElementById(aCampoMM).value,10) > 12){
        alert('Inserire un valore compreso tra 1 e 12 per il mese nel campo "Data Scadenza"');
        return false;
     }
     if(parseInt(document.getElementById(aCampoYYYY).value,10) < 1901 || parseInt(document.getElementById(aCampoYYYY).value,10) > 2078){
        alert('Inserire un valore valido per l\'anno nel campo "Data Scadenza"');
        return false;
     }
     
     if((document.getElementById(aCampoGG).value != "" || document.getElementById(aCampoYYYY).value != "") && document.getElementById(aCampoMM).value == "" ){
        alert('Valorizzare mese nel campo "Data Scadenza"');
        return false;
     }
     if((document.getElementById(aCampoGG).value != "" || document.getElementById(aCampoMM).value != "" ) && document.getElementById(aCampoYYYY).value == "" ){
        alert('Valorizzare anno nel campo "Data Scadenza"');
        return false;
     }
     if((document.getElementById(aCampoMM).value != "" || document.getElementById(aCampoYYYY).value != "") && document.getElementById(aCampoGG).value == "" ){
        alert('Valorizzare giorno nel campo "Data Scadenza"');
        return false;
     }
     
     if((parseInt(document.getElementById(aCampoMM).value,10) == 11 || parseInt(document.getElementById(aCampoMM).value,10) == 4 || parseInt(document.getElementById(aCampoMM).value,10) == 6 || parseInt(document.getElementById(aCampoMM).value,10) == 9) && parseInt(document.getElementById(aCampoGG).value,10) > 30){
        alert('Il numero del giorno non può essere più grande di 30 per il mese selezionato nel campo "Data Scadenza"');
        return false;
     }
     if((parseInt(document.getElementById(aCampoMM).value,10) == 2) && parseInt(document.getElementById(aCampoGG).value,10) > 28){
        alert('Il numero del giorno non può essere più grande di 28 per il mese selezionato nel campo "Data Scadenza"');
        return false;
     }
     
  
    
      return true;
}

function alertFornitori(tipoMessaggio,url){

    if(tipoMessaggio==1){
    
        alert('Dati modificati correttamente. Il suo stato sarà momentaneamente sospeso per permettere un controllo dei dati.');
        
    }else if(tipoMessaggio==2){
        
        alert('Non è stata eseguita nessuna variazione sui dati');
    
    }else if(tipoMessaggio==3){
    
        alert('IMPOSSIBILE EFFETTUARE LA MODIFICA! Il fornitore ha già modificato i suoi dati. Il suo stato è momentaneamente sospeso per permettere il controllo dei dati.');
    
    }else if(tipoMessaggio==4){
    
        alert('Fornitore bloccato!');
    
    }
    
    opener.parent.location.href = url;
    window.close();        
    
}
/*Funzione che controlla i dati Trouble Ticket*/

function controlloRichieste(Servizio,Cognome,Nome,Telefono){

     /*Controllo se è stato selezionato un servizio*/ 
     if(document.getElementById(Servizio).value == 0){
        alert('Attenzione selezionare il servizio interessato alla richiesta!');
        return false;
     }

     /*Controllo se cognome vuoto*/ 
     if(document.getElementById(Cognome).value == ""){
        alert('Attenzione il campo Cognome è obbligatorio!');
        return false;
     }

     /*Controllo se nome vuoto*/ 
     if(document.getElementById(Nome).value==""){
        alert('Attenzione il campo Nome è obbligatorio!');
        return false;
     }

     /*Controllo se Telefono vuoto*/ 
     if(document.getElementById(Telefono).value==""){
        alert('Attenzione il campo Telefono è obbligatorio!');
        return false;
     }
     
     return true;
     
}

/*Funzione che controlla le date della pagina Elenco Richieste Interventi*/

function controlloDataRichieste(daCampoGG,daCampoMM,daCampoYYYY,aCampoGG,aCampoMM,aCampoYYYY){
     /*Controllo se valore numerico ai campi data*/ 
     if(isNaN(document.getElementById(daCampoGG).value)){
        alert('Inserire un valore numerico per il Giorno nel campo "Da Data Richiesta');
        return false;
     }
     if(isNaN(document.getElementById(daCampoMM).value)){
        alert('Inserire un valore numerico per il Mese nel campo "Da Data Richiesta"');
        return false;
     }
     if(isNaN(document.getElementById(daCampoYYYY).value)){
        alert('Inserire un valore numerico per l Anno nel campo "Da Data Richiesta"');
        return false;
     }
      
     /*Controllo campo*/ 
    
     if(parseInt(document.getElementById(daCampoGG).value,10) < 1 || parseInt(document.getElementById(daCampoGG).value,10) > 31){
        alert('Inserire un valore compreso tra 1 e 31 per il giorno nel campo "Da Data Richiesta"');
        return false;
     }
     if(parseInt(document.getElementById(daCampoMM).value,10) < 1 || parseInt(document.getElementById(daCampoMM).value,10) > 12){
        alert('Inserire un valore compreso tra 1 e 12 per il mese nel campo "Da Data Richiesta"');
        return false;
     }
     if(parseInt(document.getElementById(daCampoYYYY).value,10) < 1901 || parseInt(document.getElementById(daCampoYYYY).value,10) > 2078){
        alert('Inserire un valore valido per l\'anno nel campo "Da Data Richiesta"');
        return false;
     }
     
     if((document.getElementById(daCampoGG).value != "" || document.getElementById(daCampoYYYY).value != "") && document.getElementById(daCampoMM).value == "" ){
        alert('Valorizzare mese nel campo "Da Data Richiesta"');
        return false;
     }
     if((document.getElementById(daCampoGG).value != "" || document.getElementById(daCampoMM).value != "" ) && document.getElementById(daCampoYYYY).value == "" ){
        alert('Valorizzare anno nel campo "Da Data Richiesta"');
        return false;
     }
     if((document.getElementById(daCampoMM).value != "" || document.getElementById(daCampoYYYY).value != "") && document.getElementById(daCampoGG).value == "" ){
        alert('Valorizzare giorno nel campo "Da Data Richiesta"');
        return false;
     }
     
     if((parseInt(document.getElementById(daCampoMM).value,10) == 11 || parseInt(document.getElementById(daCampoMM).value,10) == 4 || parseInt(document.getElementById(daCampoMM).value,10) == 6 || parseInt(document.getElementById(daCampoMM).value,10) == 9) && parseInt(document.getElementById(daCampoGG).value,10) > 30){
        alert('Il numero del giorno non può essere più grande di 30 per il mese selezionato nel campo "Da Data Richiesta"');
        return false;
     }
     if((parseInt(document.getElementById(daCampoMM).value,10) == 2) && parseInt(document.getElementById(daCampoGG).value,10) > 28){
        alert('Il numero del giorno non può essere più grande di 28 per il mese selezionato nel campo "Da Data Richiesta"');
        return false;
     }
     
     
         /*Controllo se valore numerico ai campi data*/ 
     if(isNaN(document.getElementById(aCampoGG).value)){
        alert('Inserire un valore numerico per il Giorno nel campo "A Data Richiesta"');
        return false;
     }
     if(isNaN(document.getElementById(aCampoMM).value)){
        alert('Inserire un valore numerico per il Mese nel campo "A Data Richiesta"');
        return false;
     }
     if(isNaN(document.getElementById(aCampoYYYY).value)){
        alert('Inserire un valore numerico per l Anno nel campo "A Data Richiesta"');
        return false;
     }
      
     /*Controllo campo*/ 
    
     if(parseInt(document.getElementById(aCampoGG).value,10) < 1 || parseInt(document.getElementById(aCampoGG).value,10) > 31){
        alert('Inserire un valore compreso tra 1 e 31 per il giorno nel campo "A Data Richiesta"');
        return false;
     }
     if(parseInt(document.getElementById(aCampoMM).value,10) < 1 || parseInt(document.getElementById(aCampoMM).value,10) > 12){
        alert('Inserire un valore compreso tra 1 e 12 per il mese nel campo "A Data Richiesta"');
        return false;
     }
     if(parseInt(document.getElementById(aCampoYYYY).value,10) < 1901 || parseInt(document.getElementById(aCampoYYYY).value,10) > 2078){
        alert('Inserire un valore valido per l\'anno nel campo "A Data Richiesta"');
        return false;
     }
     
     if((document.getElementById(aCampoGG).value != "" || document.getElementById(aCampoYYYY).value != "") && document.getElementById(aCampoMM).value == "" ){
        alert('Valorizzare mese nel campo "A Data Richiesta"');
        return false;
     }
     if((document.getElementById(aCampoGG).value != "" || document.getElementById(aCampoMM).value != "" ) && document.getElementById(aCampoYYYY).value == "" ){
        alert('Valorizzare anno nel campo "A Data Richiesta"');
        return false;
     }
     if((document.getElementById(aCampoMM).value != "" || document.getElementById(aCampoYYYY).value != "") && document.getElementById(aCampoGG).value == "" ){
        alert('Valorizzare giorno nel campo "A Data Richiesta"');
        return false;
     }
     
     if((parseInt(document.getElementById(aCampoMM).value,10) == 11 || parseInt(document.getElementById(aCampoMM).value,10) == 4 || parseInt(document.getElementById(aCampoMM).value,10) == 6 || parseInt(document.getElementById(aCampoMM).value,10) == 9) && parseInt(document.getElementById(aCampoGG).value,10) > 30){
        alert('Il numero del giorno non può essere più grande di 30 per il mese selezionato nel campo "A Data Richiesta"');
        return false;
     }
     if((parseInt(document.getElementById(aCampoMM).value,10) == 2) && parseInt(document.getElementById(aCampoGG).value,10) > 28){
        alert('Il numero del giorno non può essere più grande di 28 per il mese selezionato nel campo "A Data Richiesta"');
        return false;
     }
     
      return true;
}

/*Funzione che controlla i dati Trouble Ticket CED*/

function controlloRichiesteCed(UnitaOperativa,Mail,Descrizione){

     /*Controllo se è stato inserita un unità*/ 
     if(document.getElementById(UnitaOperativa).value == ""){
        alert('Attenzione inserire l unità operativa!');
        return false;
     }
     if(document.getElementById(Mail).value == ""){
        alert('Attenzione inserire la Mail di riferimento!');
        return false;
     }
     
    if(document.getElementById(Mail).value != ""){
	    var espressione = /^[_a-z0-9+-]+(\.[_a-z0-9+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$/;
	    if (!espressione.test(document.getElementById(Mail).value))
	    {
	        alert("Il formato della mail non è valido!");
	        return false;
	    }
	}
	
	if(document.getElementById(Descrizione).value == ""){
        alert('Attenzione inserire la Descrizione Chiamata!');
        return false;
     }
     
     return confirm('Sei sicuro di voler confermare la Richiesta?');
}

/*Funzione che controlla i dati Trouble Ticket Richieste Tecniche*/

function controlloRichiesteRTecniche(UnitaOperativa,Mail,Descrizione,Cdc,Settore){
     /*Controllo se è stato inserita un unità*/ 
     if(document.getElementById(UnitaOperativa).value == ""){
        alert('Attenzione inserire l unità operativa!');
        return false;
     }
     if(document.getElementById(Mail).value == ""){
        alert('Attenzione inserire la Mail di riferimento!');
        return false;
     }
     
    if(document.getElementById(Mail).value != ""){
	    var espressione = /^[_a-z0-9+-]+(\.[_a-z0-9+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$/;
	    if (!espressione.test(document.getElementById(Mail).value))
	    {
	        alert("Il formato della mail non è valido!");
	        return false;
	    }
	}
	
	 /*Controllo se è stato selezionato un Settore*/ 
     if(document.getElementById(Settore).value == 0){
        alert('Attenzione selezionare il Settore!');
        return false;
     }
	
	if(document.getElementById(Descrizione).value == ""){
        alert('Attenzione inserire la Descrizione Chiamata!');
        return false;
     }
	
     /*Controllo se è stato selezionato un CDC*/ 
     if(document.getElementById(Cdc).value == 0){
        return confirm('La richiesta non è associata a un centro di costo. Si ricorda che hanno la priorità le richieste associate ad un centro di costo. Vuoi Confermare la Richiesta?');
     }else{
     return confirm('Sei sicuro di voler confermare la Richiesta?');
     }
       
       
}

/* controllo inserimento/modifica TempiAttesaAmbulatoriale */

function controlloTempiAttesaAmbulatoriale(txtPrestazione,DDStruttura,txtGiorni){
     
    if(isMandatory(txtPrestazione)==false){return false;}
    
    if(isMandatory(txtGiorni)==false){return false;}
    
    if(document.getElementById(DDStruttura).options[0].selected==true){
    
        alert("Compilare i campi obbligatori");
        return false;
    }
    
    if(isNaN(document.getElementById(txtGiorni).value)){
        alert('Inserire un valore numerico nel campo "Giorni"');
        return false;
     }
    
}

/* controllo inserimento/modifica TempiAttesaRicoveri */

function controlloTempiAttesaRicoveri(DDStruttura,txtGiorni){
    
    if(isMandatory(txtGiorni)==false){return false;}
    
    if(document.getElementById(DDStruttura).options[0].selected==true){
    
        alert("Compilare i campi obbligatori");
        return false;
    }
    
    if(isNaN(document.getElementById(txtGiorni).value)){
        alert('Inserire un valore numerico nel campo "Giorni"');
        return false;
     }
    
}

/* controllo inserimento/modifica RubricaTelefonica */

function controlloRubricaTelefonica(Mail,txtOrdinamento){
    
    if(document.getElementById(Mail).value != ""){
	    var espressione = /^[_a-z0-9+-]+(\.[_a-z0-9+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$/;
	    if (!espressione.test(document.getElementById(Mail).value))
	    {
	        alert("Il formato della mail non è valido!");
	        return false;
	    }
	}
	
	if(isNaN(document.getElementById(txtOrdinamento).value)){
        alert('Inserire un valore numerico nel campo "Ordinamento"');
        return false;
    }
    
}

/* controllo inserimento/modifica patologia */

function controlloPatologia(txtDescrizione){
     
    if(isMandatory(txtDescrizione)==false){return false;}
    
}