function Registration_VisibilityMngm(valore,valueCustomerKindConventions)
{
	if (valore == '')
	{
		Hide_Element('reg_name_field');
		Hide_Element('reg_last_field');
		Hide_Element('reg_qualifica_field');
		Hide_Element('reg_comp_field');
		Hide_Element('reg_phone_field');
		Hide_Element('reg_cell_field');
		Hide_Element('reg_fax_field');
		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');
	}
	else
	{
		if (valore == 'Azienda')
		{
		  //Hide_Element('reg_cofi_field');
		  Show_Element('reg_cofi_field');
		  Show_Element('reg_comp_field');
		  Show_Element('reg_qualifica_field');
		  Show_Element('reg_piva_field');
		  Show_Element('reg_phone_mandatory');
          Hide_Element('reg_cell_mandatory'); 		   		  		  		  
		}
		else
		{
		  Show_Element('reg_cofi_field');
		  Hide_Element('reg_piva_field'); 
		  Hide_Element('reg_comp_field');
		  Hide_Element('reg_qualifica_field');
		  Hide_Element('reg_phone_mandatory'); 		   		  		  
          Show_Element('reg_cell_mandatory'); 		   		  		  		  		  
		}
		Show_Element('reg_name_field');
		Show_Element('reg_last_field');
		Show_Element('reg_phone_field');
		Show_Element('reg_cell_field');
		Show_Element('reg_fax_field');
		Show_Element('reg_email_field');
		Show_Element('reg_pwd_field');
		Show_Element('reg_addr_field');
		Show_Element('reg_zip_field');
		Show_Element('reg_state_field');
		Show_Element('reg_listed_field');
		Show_Element('reg_city_field');
		Show_Element('reg_ctry_field');
		Show_Element('reg_customer1_field');
		Show_Element('reg_customer2_field');
		Show_Element('reg_customer3_field');
		Show_Element('reg_news_field');
		Show_Element('reg_privacy');
		Show_Element('reg_accept');
		if (valueCustomerKindConventions != '') 
		{
		  Show_Element('reg_convention_field');
		}
		else
		{
		  Hide_Element('reg_convention_field');
		}
	
	}
}

function Registration_ValuesMngm()
{

  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_cofi_field');
	  Show_Element('reg_piva_field');
	  Show_Element('reg_phone_mandatory');
	}
	else
	{
	  Hide_Element('reg_qualifica_field');
	  Hide_Element('reg_comp_field');
	  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()
{

  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.CodiceFiscale.value)))
        {
	      salva = false;
          alert(cfalert);
          document.cutR.CodiceFiscale.focus();
          document.cutR.CodiceFiscale.select();
        }
    }
    else
    {
        if (!(controllo_cofi(document.cutR.CodiceFiscale.value)))
        {
	      salva = false;
          alert(cfalert);
          document.cutR.CodiceFiscale.focus();
          document.cutR.CodiceFiscale.select();
        }
    }

    if (salva)
    {
      document.cutR.submit();
    }  

/*
    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_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);
		}
*/
   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 {
			return(false);
		}
*/
  return(false);
 }
 
  
 function FindingPassword() {
	 
	with(document.login)
	{
		CustomerMail = email.value;
		action="comersus_optForgotPasswordForm.asp?email="+CustomerMail;
		submit();
	};
	return false;
 }