function Registration_VisibilityMngm(valore,valueCustomerKindConventions,errReg)
{
  errRegB = false;
    
    if (errReg == '1')
    {
        errRegB = true;
    }
		Hide_Element('reg_name_field');
		Hide_Element('reg_last_field');
		Hide_Element('reg_qualifica_field');
		Hide_Element('reg_comp_field');
		Hide_Element('reg_comp_field_sign');
        Hide_Element('reg_comp_field_sign1');
		Hide_Element('reg_comp_field_label');
		Hide_Element('reg_phone_field');

		Hide_Element('reg_cell_field');
        Hide_Element('reg_cell_mandatory'); 		   		  		  		  
		Hide_Element('reg_fax_field');
        Hide_Element('reg_phone_mandatory'); 		   		  		  		  

		Hide_Element('reg_email_field');
		Hide_Element('reg_pwd_field');
		Hide_Element('reg_addr_field');
		Hide_Element('reg_zip_field');
		Hide_Element('reg_state_field');
		Hide_Element('reg_listed_field');
		Hide_Element('reg_city_field');
		Hide_Element('reg_ctry_field')
		Hide_Element('reg_customer1_field');
		Hide_Element('reg_customer2_field');
		Hide_Element('reg_customer3_field');
		Hide_Element('reg_piva_field');
		Hide_Element('reg_cofi_field');
		Hide_Element('reg_news_field');
		Hide_Element('reg_privacy');
		Hide_Element('reg_accept');
		Hide_Element('reg_convention_field');
        Hide_Element('reg_datanascita_mandatory'); 		   		  		  		  
		Hide_Element('reg_datanascita_field');
    if (valore != '')
    {
		Show_ElementAdv('reg_name_field',((errRegB) && (document.getElementById('customerName').value == '')));
		Show_ElementAdv('reg_last_field',((errRegB) && (document.getElementById('lastName').value == '')));
		Show_ElementAdvParz('reg_fax_field');
		
		
		Show_ElementAdv('reg_email_field',((errRegB) && (document.cutR.email.value == '')));
		Show_ElementAdv('reg_pwd_field',((errRegB) && (document.cutR.password.value == '')));
		
		Show_ElementAdv('reg_addr_field',((errRegB) && (document.getElementById('address').value == '')));
		Show_ElementAdv('reg_zip_field',((errRegB) && (document.getElementById('zip').value == '')));
		Show_ElementAdv('reg_state_field',((errRegB) && (document.getElementById('stateCode').value == '')));
		Show_ElementAdv('reg_city_field',((errRegB) && (document.getElementById('city').value == '')));
		Show_ElementAdvParz('reg_ctry_field');
		Show_ElementAdvParz('reg_customer1_field');
		Show_ElementAdvParz('reg_customer2_field');
		Show_ElementAdvParz('reg_customer3_field');
		Show_ElementAdvParz('reg_news_field');
		Show_ElementAdvParz('reg_privacy');
		Show_ElementAdv('reg_accept',((errRegB) && (document.getElementById('RgAccept').value == '')));
		Show_ElementAdvParz('reg_datanascita_field');
        Hide_Element('reg_datanascita_mandatory'); 	
        
        Show_Element('reg_convention_field');

		if (valore == 'Azienda')
		{
		  Show_ElementAdv('reg_cofi_field',((errRegB) && (document.getElementById('CodiceFiscale').value == '')));
		  Show_ElementAdv('reg_comp_field',((errRegB) && (document.getElementById('customerCompany').value == '')));
		  Show_ElementAdvParz('reg_qualifica_field');
    	  Show_ElementAdv('reg_piva_field',((errRegB) && (document.getElementById('PartitaIVA').value == '')));
		  
		  Show_ElementAdv('reg_phone_field',((errRegB) && (document.getElementById('phone').value == '')));
		  Show_Element('reg_phone_mandatory'); 		   		  		  
          Show_ElementAdvParz('reg_cell_field'); 	
          Hide_Element('reg_cell_mandatory');
		  Hide_Element('reg_cofi_mandatory'); 
          Show_Element('reg_comp_field_sign');
          Show_Element('reg_comp_field_sign1');			
		  Show_Element('reg_comp_field_label');			   		  		  		  
		}
		else
		{
		  Show_ElementAdv('reg_cofi_field',((errRegB) && (document.getElementById('CodiceFiscale').value == '')));
		  Hide_Element('reg_comp_field');
          Hide_Element('reg_qualifica_field');
		  Hide_Element('reg_piva_field'); 
		  Show_ElementAdvParz('reg_phone_field');
		  Hide_Element('reg_phone_mandatory'); 		   		  		  
          Show_Element('reg_cell_mandatory'); 		   		  		  		  		  
          Show_Element('reg_cofi_mandatory');
          Show_ElementAdv('reg_cell_field',((errRegB) && (document.getElementById('cell').value == '')));		   		  		  		  		  
		  Hide_Element('reg_comp_field_sign');
		  Hide_Element('reg_comp_field_sign1');
		  Hide_Element('reg_comp_field_label');
		}
	
	}
}

function Registration_ValuesMngm()
{
//alert('dd');
  if (document.cutR.Tipologia.options[document.cutR.Tipologia.selectedIndex].value == 'Azienda')
  {
    //document.cutR.CodiceFiscale.value = '';
  }
  else
  {
    document.cutR.Qualifica.value = '';
    document.cutR.customerCompany.value = '';
    document.cutR.PartitaIVA.value = '';
  }  
}


function Registration_VisibilityMngmSSO(valore,valueCustomerKindConventions)
{
	if (valore == 'Azienda')
	{
	  Show_Element('reg_qualifica_field');
	  Show_Element('reg_comp_field');
      Show_Element('reg_comp_field_sign');	
	  Show_Element('reg_comp_field_label');	
	  Show_Element('reg_cofi_field');
	  Show_Element('reg_piva_field');
	  Show_Element('reg_phone_mandatory');
	}
	else
	{
	  Hide_Element('reg_qualifica_field');
	  Hide_Element('reg_comp_field');
      Hide_Element('reg_comp_field_sign');	
      Hide_Element('reg_comp_field_sign1');	
	  Hide_Element('reg_comp_field_label');
	  Show_Element('reg_cofi_field');
	  Hide_Element('reg_piva_field'); 
	  Hide_Element('reg_phone_mandatory'); 		   		  		  
	}

	Show_Element('reg_privacy');
	Show_Element('reg_accept');

	if (valueCustomerKindConventions != '') 
	{
	  Show_Element('reg_convention_field');
	}
	else
	{
	  Hide_Element('reg_convention_field');
	}	
}

function Registration_ValuesMngmSSO()
{
alert('cc');
  if (document.modCust.Tipologia.options[document.modCust.Tipologia.selectedIndex].value == 'Azienda')
  {
    //document.modCust.CodiceFiscale.value = '';
  }
  else
  {
    document.modCust.Qualifica.value = '';
    document.modCust.customerCompany.value = '';
    document.modCust.PartitaIVA.value = '';
  }  
}

function Registration_VisibilityMngmSubMenu(mode,id_divs,id_divp)
{ 
  if (mode)
  {
    Show_Element(id_divs)
    Hide_Element(id_divp)
  }
  else
  {
    Show_Element(id_divp)
    Hide_Element(id_divs)
  }
}

function Registration_customer(emailalert,cfalert,pivalert)
  {
	salva = true;
    if (!(controllo_email(document.cutR.email.value)))
    {
	  salva = false;
      alert(emailalert);
      document.cutR.email.focus();
      document.cutR.email.select();
    }
    
    if (!(controllo_piva(document.cutR.PartitaIVA.value)))
    {
	  salva = false;
      alert(pivalert);
      document.cutR.PartitaIVA.focus();
      document.cutR.PartitaIVA.select();
    }          
       
    if (document.cutR.Tipologia.options[document.cutR.Tipologia.selectedIndex].value == 'Azienda')
    {
		/*
        if (!(controllo_cofi_piva(document.cutR.PartitaIVA.value)))
        {
	      salva = false;
          alert(cfalert);
          document.cutR.CodiceFiscale.focus();
          document.cutR.CodiceFiscale.select();
        }
		*/
		if (!(controllo_piva(document.cutR.PartitaIVA.value)))
		{
		  salva = false;
		  alert(pivalert);
		  document.cutR.PartitaIVA.focus();
		  document.cutR.PartitaIVA.select();
		} 
    }
    else
    {
        if (!(controllo_cofi(document.cutR.CodiceFiscale.value)))
        {
	      salva = false;
          alert(cfalert);
          document.cutR.CodiceFiscale.focus();
          document.cutR.CodiceFiscale.select();
        }
    }
    
    if (salva)
    {

		/* SVV Validazione e spedizione form autorisponditore nascosto*/
		//if(document.all) mioform = frame_autorisponditore_registrazione.sitovivo_form;
		//else mioform = document.getElementById("frame_autorisponditore_registrazione").contentDocument.sitovivo_form;

		lCheckMail = document.cutR.email.value;

		if(lCheckMail != "") {
		/*
			mioform.NOME.value = document.cutR.customerName.value;
			mioform.COGNOME.value = document.cutR.lastName.value;
			mioform.EMAIL.value = document.cutR.email.value;
			mioform.TELEFONO.value = document.cutR.cell.value;
			mioform.INDIRIZZO.value = document.cutR.address.value;
			mioform.NICK.value = document.cutR.email.value;
			mioform.svv_id_visitatore.value = "";
			mioform.submit();
		*/
		}

		document.cutR.submit();
		return true;

      document.cutR.submit();
    }  
  }
  
  function Modify_customerExt(emailalert,cfalert,pivalert,ragsocalert)
  {
	salva = true;
    if (document.modCust.customerCompany.value.length > 40)
    {
	  salva = false;
      alert("Lunghezza ragione sociale errata (massimo 40 caratteri)!");
      document.modCust.customerCompany.focus();
      document.modCust.customerCompany.select();
    }
    
    if (!(controllo_email(document.modCust.email.value)))
    {
	  salva = false;
      alert(emailalert);
      document.modCust.email.focus();
      document.modCust.email.select();
    }
    
    if (!(controllo_piva(document.modCust.PartitaIVA.value)))
    {
	  salva = false;
      alert(pivalert);
      document.modCust.PartitaIVA.focus();
      document.modCust.PartitaIVA.select();
    }
    
    if (document.modCust.Tipologia.options[document.modCust.Tipologia.selectedIndex].value == 'Azienda')
    {            
        if (!(controllo_cofi_piva(document.modCust.CodiceFiscale.value)))
        {
	      salva = false;
          alert(cfalert);
          document.modCust.CodiceFiscale.focus();
          document.modCust.CodiceFiscale.select();
        }
    }   
    else
    {
        if (!(controllo_cofi(document.modCust.CodiceFiscale.value)))
        {
	      salva = false;
          alert(cfalert);
          document.modCust.CodiceFiscale.focus();
          document.modCust.CodiceFiscale.select();
        }
    }    
    
    if (salva)
    {
      document.modCust.submit();
    }  
  }

  function Modify_customer(emailalert,cfalert,pivalert)
  {
	salva = true;
    
    if (!(controllo_email(document.modCust.email.value)))
    {
	  salva = false;
      alert(emailalert);
      document.modCust.email.focus();
      document.modCust.email.select();
    }
    
    if (!(controllo_piva(document.modCust.PartitaIVA.value)))
    {
	  salva = false;
      alert(pivalert);
      document.modCust.PartitaIVA.focus();
      document.modCust.PartitaIVA.select();
    }
    
    if (document.modCust.Tipologia.options[document.modCust.Tipologia.selectedIndex].value == 'Azienda')
    {            
        if (!(controllo_cofi_piva(document.modCust.CodiceFiscale.value)))
        {
	      salva = false;
          alert(cfalert);
          document.modCust.CodiceFiscale.focus();
          document.modCust.CodiceFiscale.select();
        }
    }   
    else
    {
        if (!(controllo_cofi(document.modCust.CodiceFiscale.value)))
        {
	      salva = false;
          alert(cfalert);
          document.modCust.CodiceFiscale.focus();
          document.modCust.CodiceFiscale.select();
        }
    }    
    
    if (salva)
    {
      document.modCust.submit();
    }  
  }


 /* SVV Aggiunta Ex Novo per spedire l'autorisponditore nascosto su login */

 function checkSVVForm() {
 		//if(document.all) mioform = frame_autorisponditore_registrazione.sitovivo_form;
		//else mioform = document.getElementById("frame_autorisponditore_registrazione").contentDocument.sitovivo_form;

		lCheckMail = document.login.email.value;

		if(lCheckMail != "") {
		/*
			mioform.EMAIL.value = document.login.email.value;
			mioform.NICK.value = document.login.email.value;
			mioform.svv_id_visitatore.value = "";
			mioform.submit();
		*/	
			return(true);
		} else {
			return(false);
		}
 }

  function checkSVVForm2() {
 		//if(document.all) mioform = frame_autorisponditore_registrazione.sitovivo_form;
		//else mioform = document.getElementById("frame_autorisponditore_registrazione").contentDocument.sitovivo_form;

		lCheckMail = document.auth.email.value;

		if(lCheckMail != "") {
		/*
			mioform.EMAIL.value = document.auth.email.value;
			mioform.NICK.value = document.auth.email.value;
			mioform.svv_id_visitatore.value = "";
			mioform.submit();
		*/
			return(true);
		} else {
			alert('Attenzione: Immettere tutte le informazioni richieste per l\'accesso');
            //alert('Attenzione: Inserire email e password per poter proseguire');
			
			return(false);
		}
 }
 
 function FindingPassword() {
	 
	with(document.login)
	{
		CustomerMail = email.value;
		action="comersus_optForgotPasswordForm.asp?email="+CustomerMail;
		submit();
	};
	return false;
 }
 
 function Registration_VisibilityBundleSon(divVISTrue,arrVISFALSE,arrDim)
{ 
  var vars = arrVISFALSE.split("|");
 
  Show_Element(divVISTrue)

  for (var i=0;i<vars.length;i++){
    if (vars[i] != divVISTrue){
        Hide_Element(vars[i]);
	}	
  }

 for (var i=1;i<=arrDim ;i++){
   if (document.getElementById("scheda-tecnica"+i) != "undefined")
   {  
    document.getElementById("scheda-tecnica"+i).className = "";
    document.getElementById("tab_scheda-tecnica"+i).style.display = "none";
   }
   if (document.getElementById("servizi"+i) != "undefined")
   {  
    document.getElementById("servizi"+i).className = "";
    document.getElementById("tab_servizi"+i).style.display = "none";
   }
   if (document.getElementById("inforeq"+i) != "undefined")
   {  
    document.getElementById("inforeq"+i).className = "";
    document.getElementById("tab_inforeq"+i).style.display = "none";
   }
  }
 for (var i=1;i<=arrDim;i++){
   if (document.getElementById("scheda-tecnica"+i) != "undefined")
   {  
    document.getElementById("scheda-tecnica"+i).className = "tab-on";
    document.getElementById("tab_scheda-tecnica"+i).style.display = "";
   }
 }
}

//customer modify form
function Registration_VisibilityMngmMCF(valore,valueCustomerKindConventions,errReg)
{

    errRegB = false;
    
    if (errReg == '1')
    {
        errRegB = true;
    }
    
		Hide_Element('reg_name_field');
		Hide_Element('reg_last_field');
		Hide_Element('reg_qualifica_field');
		Hide_Element('reg_comp_field');
        Hide_Element('reg_comp_field_sign');
        Hide_Element('reg_comp_field_sign1');
		Hide_Element('reg_comp_field_label');
		
		Hide_Element('reg_phone_field');

		Hide_Element('reg_cell_field');
        Hide_Element('reg_cell_mandatory'); 		   		  		  		  
		Hide_Element('reg_fax_field');
        Hide_Element('reg_phone_mandatory'); 		   		  		  		  

		Hide_Element('reg_email_field');
		Hide_Element('reg_pwd_field');
		Hide_Element('reg_addr_field');
		Hide_Element('reg_zip_field');
		Hide_Element('reg_state_field');
		Hide_Element('reg_listed_field');
		Hide_Element('reg_city_field');
		Hide_Element('reg_ctry_field')
		Hide_Element('reg_customer1_field');
		Hide_Element('reg_customer2_field');
		Hide_Element('reg_customer3_field');
		Hide_Element('reg_piva_field');
		Hide_Element('reg_cofi_field');
		Hide_Element('reg_news_field');
		Hide_Element('reg_privacy');
		Hide_Element('reg_accept');
		Hide_Element('reg_convention_field');
        Hide_Element('reg_datanascita_mandatory'); 		   		  		  		  
		Hide_Element('reg_datanascita_field');
		
        if (valore != '')
        {
		    Show_ElementAdv('reg_name_field',((errRegB) && (document.getElementById('customerName').value == '')));
		    Show_ElementAdv('reg_last_field',((errRegB) && (document.getElementById('lastName').value == '')));
		    Show_ElementAdvParz('reg_fax_field');
    		
    		
		    Show_ElementAdv('reg_email_field',((errRegB) && (document.modCust.email.value == '')));
		    Show_ElementAdv('reg_pwd_field',((errRegB) && (document.modCust.password.value == '')));
    		
		    Show_ElementAdv('reg_addr_field',((errRegB) && (document.getElementById('address').value == '')));
		    Show_ElementAdv('reg_zip_field',((errRegB) && (document.getElementById('zip').value == '')));
		    Show_ElementAdv('reg_state_field',((errRegB) && (document.getElementById('stateCode').value == '')));
		    Show_ElementAdv('reg_city_field',((errRegB) && (document.getElementById('city').value == '')));
		    Show_ElementAdvParz('reg_ctry_field');
		    Show_ElementAdvParz('reg_customer1_field');
		    Show_ElementAdvParz('reg_customer2_field');
		    Show_ElementAdvParz('reg_customer3_field');
		    Show_ElementAdvParz('reg_news_field');
		    Show_ElementAdvParz('reg_privacy');
		    if (document.getElementById('RgAccept') != null) {
		        Show_ElementAdv('reg_accept',((errRegB) && (document.getElementById('RgAccept').value == '')));
		    }
		    Show_ElementAdvParz('reg_datanascita_field');
            Hide_Element('reg_datanascita_mandatory'); 	
            
            Show_Element('reg_convention_field');

		    if (valore == 'Azienda')
		    {
		      Show_ElementAdv('reg_cofi_field',((errRegB) && (document.getElementById('CodiceFiscale').value == '')));
		      Show_ElementAdv('reg_comp_field',((errRegB) && (document.getElementById('customerCompany').value == '')));
		      Show_ElementAdvParz('reg_qualifica_field');
    	      Show_ElementAdv('reg_piva_field',((errRegB) && (document.getElementById('PartitaIVA').value == '')));
    		  
		      Show_ElementAdv('reg_phone_field',((errRegB) && (document.getElementById('phone').value == '')));
		      Show_Element('reg_phone_mandatory'); 		   		  		  
              Show_ElementAdvParz('reg_cell_field'); 	
              Hide_Element('reg_cell_mandatory');
              Show_Element('reg_comp_field_sign');
              Show_Element('reg_comp_field_sign1');
		      Show_Element('reg_comp_field_label');
    		 		   		  		  		  
		    }
		    else
		    {
		      Show_ElementAdv('reg_cofi_field',((errRegB) && (document.getElementById('CodiceFiscale').value == '')));
		      Hide_Element('reg_comp_field');
              Hide_Element('reg_comp_field_sign');
              Hide_Element('reg_comp_field_sign1');
		      Hide_Element('reg_comp_field_label');
    		
              Hide_Element('reg_qualifica_field');
		      Hide_Element('reg_piva_field'); 
		      Show_ElementAdvParz('reg_phone_field');
		      Hide_Element('reg_phone_mandatory'); 		   		  		  
              Show_Element('reg_cell_mandatory'); 		   		  		  		  		  
              Show_ElementAdv('reg_cell_field',((errRegB) && (document.getElementById('cell').value == '')));		   		  		  		  		  
    		  
		    }
	    }
}


