//  *****************************************************************************
//  *         progetto : VULCANO
//  *     applicazione : Adesioni Aziende
//  *         modulo   : 
//  *     nome libreria: PKU2_COLLECTION_aut.JS
//  * contenuto:
//  *  elementi software componenti l'interfaccia utente 
//  *  relativi alle funzioni di predisposizione del modulo di data-entry delle adesioni
//  *
//  * data ultimo aggiornamento: 06/03/2009 14.25 (ex 14/09/2007 21.49 (ex 08/08/2007 14.21  
//  *****************************************************************************
  var browserNs = (navigator.appName=='Netscape') ?  true  :  false ;
//                             ::::::::::::::::::::::::: 
// 
// costruttore di un array associativo
//                       
 function AssociativeArray() 
 {
  for (var i = 0; i < arguments.length - 1; i += 2)
  {
    this[arguments[i]] = arguments[i + 1];
  }
 }
//                             :::::::::::::::::::::::::
//
// definizione array diagnostiche in italiano e in Inglese
//
 var arDiag = new AssociativeArray(  "Aut001IT","Attenzione! Digitare Utente (lunghezza di almeno 6 caratteri)"
                                    ,"Aut002IT","Attenzione! Digitare Password (lunghezza di almeno 4 caratteri)" 
                                    ,"Aut003IT","Attenzione! Selezionare un Ateneo"
                                    ,"Aut001EN","Attention! Fill in User field (at least 6 characters)"
                                    ,"Aut002EN","Attention! Fill in Password field (at least 4 characters)" 
                                    ,"Aut003EN","Attention! Select an University"
                                   );  
//                             ::::::::::::::::::::::::: 
//
//
//
 function warnDiag (theField,diagId,p_lan) 
 {
    //alert (arDiag[diagId+p_lan]);
    theField.focus();
    return false;
 }   // chiudi function 
//                             ::::::::::::::::::::::::: 
//
// effettua il controllo formale di validazione campi della form di autenticazione
// 
 function checkAut (theForm,p_lan)
 {
//   // monitorArgFun('checkAut',checkAut.arguments);
   var diagId = "";
 
   theField = document.getElementById('user');
   if (theField.value.length < 6)
    {
      diagId = "Aut001";
      return warnDiag(theField,diagId,p_lan);
    }

   theField = document.getElementById('pass'); 
   if (theField.value.length < 4)
    { 
      diagId = "Aut002";
      return warnDiag(theField,diagId,p_lan);
    }  

   if ( document.getElementById('aten') )
    { theField = document.getElementById('aten'); 
      if (theField.selectedIndex == 0)
       { 
       	  diagId = "Aut003";
         return warnDiag(theField,diagId,p_lan);
       }  
      else  {  setAction(theForm)    }
    } 
    
    return true; 
            
 }   // chiudi function
//                            :::::::::::::::::::::::: 
//
// restituisce la sigla dell’Università selezionata nel menu a tendina 
// della finestra di autenticazione 
// 
 function readSelUni() 
 { 
    var seluni=''; 
    seluni = document.forms[0].aten.options[document.forms[0].aten.selectedIndex].value; 
    return seluni.toLowerCase(); 
 } 
//                            :::::::::::::::::::::::: 
//   
// imposta l’URL del tag ACTION in base all’università selezionata    
// 
 function setAction(theForm) 
 {
  document.getElementById(theForm).action = document.getElementById(theForm).action.replace("$UNI",readSelUni() );
 // alert("action="+document.forms[1].action); 
 } 
//                            :::::::::::::::::::::::: 
//
//
//
 function preSubmitAut(theForm,p_lan)
 {
  return checkAut(theForm,p_lan);
  
 }   // chiudi function
//                            ::::::::::::::::::::::::
  var minFaq=1; 
  var maxFaq; 
  var prevFaq=1; 
  var nextFaq=1;
  var ardivF = new Array();
//
// porta in primo piano la porzione di documento identificata dal 
// parametro fornito
//
 function visFaqAut (theId)
 {
//   // monitorArgFun('visFaqAut',visFaqAut.arguments);
  maxFaq = document.getElementById('faq').getElementsByTagName('div').length; 
  ardivF = document.getElementById('faqtd').getElementsByTagName('div'); // Array dei div contenuti nella cella faqtd
  //alert('********** lunghezza Array dei DIV:**********'+ ardivF.length);
  // si mascherano le porzioni di documento non richieste  
  for (var f = 0; f <ardivF.length; f++)
   { if (ardivF.item(f).id != theId) 	
  //alert('********** sono nel caso theid passato= **********'+theId);    
       { ardivF.item(f).style.display ="none";
         ardivF.item(f).style.visibility ="hidden";
       }  
    }  // chiusura ciclo for
// si rende visibile la porzione di documento richiesta
   document.getElementById(theId).style.display ="block";
   document.getElementById(theId).style.visibility ="visible";  
   
   if (theId.length>3)
     { document.getElementById(theId.substring(0,3)).style.display ="block";
       document.getElementById(theId.substring(0,3)).style.visibility ="visible";
       curFaq = eval(theId.charAt(3));
       prevFaq = (curFaq == minFaq) ? minFaq : eval(curFaq-1);
       nextFaq = (curFaq == maxFaq) ? maxFaq : eval(curFaq+1);
     }
    else 
    {  prevFaq = 2;
       nextFaq = 1;
    } 
// la collezione document.links è di Explorer?  
//   document.links('lki').disabled= (curFaq == minFaq) ?   true : false;
//   document.links('lka').disabled= (curFaq == maxFaq) ?   true : false; 
     document.getElementById('lki').disabled= (curFaq == minFaq) ?   true : false;
     document.getElementById('lka').disabled= (curFaq == maxFaq) ?   true : false; 
  
  }    // chiudi function
 //                            ::::::::::::::::::::::::

//window.onload=InitAut();
  

