// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

function handle_adres(rootId)
{
	var name = $(rootId).id;
	if(name == "postadresandersja")
	{
		Effect.Appear($('padres'),{ duration: 1.0 });
		//$($('padres').style.display = "block");
	}
	if(name == "postadresandersnee")
	{
		Effect.Fade($('padres'),{ duration: 1.0 });		
		//$($('padres').style.display = "none");
	}	
	if(name == "factuurandersja")
	{
		Effect.Appear($('fadres'),{ duration: 1.0 });		
		//$($('fadres').style.display = "block");
	}
	if(name == "factuurandersnee")
	{
		Effect.Fade($('fadres'),{ duration: 1.0 });		
		$($('fadres').style.display = "none");
	}	
}

function handle_adresses()
{
	var checked = $('postadresandersja').checked;
	if(checked)
	{
		$($('padres').style.display = "block");
	}
	var checked = $('factuurandersja').checked;
	if(checked)
	{
		$($('fadres').style.display = "block");
	}	
}

//Account -> edit. Kopieer adresvelden
function fillPostFields()
{
	//Post
	$('record_postadres').value = $('record_bezoekadres').value; 
	$('record_postpc').value = $('record_bezoekpc').value; 
	$('record_postplaats').value = $('record_bezoekplaats').value;
	
}

function fillFactuurFields()
{
	
	//Factuur
	$('record_factuuradres').value = $('record_bezoekadres').value; 
	$('record_factuurpc').value = $('record_bezoekpc').value; 
	$('record_factuurplaats').value = $('record_bezoekplaats').value;	
}

// Gebruik deze in aanmeldenvacature voor een account
function fillPostFields_account(){
	//Post
	$('account_postadres').value = $('account_bezoekadres').value; 
	$('account_postpc').value = $('account_bezoekpc').value; 
	$('account_postplaats').value = $('account_bezoekplaats').value;
}

function fillFactuurFields_account(){
	
	//Factuur
	$('account_factuuradres').value = $('account_bezoekadres').value; 
	$('account_factuurpc').value = $('account_bezoekpc').value; 
	$('account_factuurplaats').value = $('account_bezoekplaats').value;	
}

//Payrolling -------------------------------------------------------------------

function disableGeneralFields(){
	//verberg deze velden altijd
	$('account_naam').disable(this);
	$('handtekening1_').disable(this);	
	$('handtekening2_').disable(this);	
	$('handtekening3_').disable(this);	
	$('handtekening4_').disable(this);	
	$('handtekening5_').disable(this);	
	$('handtekening6_').disable(this);
	$('payroll_uurtarief').disable(this);						
}

function disableCandidateFields(){
	$('payroll_geboorteplaats').disable(this);	
	$('candidate_sexe_id').disable(this);
	$('payroll_nationaliteit').disable(this);
	$('candidate_telefoon').disable(this);
	$('candidate_mobiel').disable(this);
	$('candidate_email').disable(this);
	$('payroll_banktype_id').disable(this);
	$('candidate_bankrekeningnr').disable(this);
	$('payroll_naambankgiro').disable(this);
	$('payroll_loonheffingskorting_algemeen').disable(this);
	$('payroll_loonheffingskorting_wel').disable(this);
	$('payroll_loonheffingskorting_niet').disable(this);	
	$('payroll_loonbelastingingangsdatum_3i').disable(this);
	$('payroll_loonbelastingingangsdatum_2i').disable(this);
	$('payroll_loonbelastingingangsdatum_1i').disable(this);			
	$('payroll_ondertekendatum_3i').disable(this);
	$('payroll_ondertekendatum_2i').disable(this);
	$('payroll_ondertekendatum_1i').disable(this);
	$('payroll_positiebepaling_isscholieretc').disable(this);
	$('payroll_positiebepaling_medewerker_id').disable(this);		
	$('payroll_eerderwerkzaamvoortopwork').disable(this);
	$('payroll_datumeerstedienstverband_1i').disable(this);
	$('payroll_datumeerstedienstverband_2i').disable(this);
	$('payroll_datumeerstedienstverband_3i').disable(this);
	$('payroll_datumeerstedienstverband_weken').disable(this);	
	$('payroll_datumlaatsteverband_1i').disable(this);						
	$('payroll_datumlaatsteverband_2i').disable(this);
	$('payroll_datumlaatsteverband_3i').disable(this);
	$('payroll_datumlaatsteverband_weken').disable(this);
	$('payroll_burgerservicenummer').disable(this);	
	
						
			
}

function disableAccountFields(){

	$('payroll_cao_bouwnijverheid_true').disable(this);	
	//$('payroll_cao_anders').disable(this);
	$('account_cao').disable(this);
	$('payroll_functiebenaming').disable(this);
	$('payroll_brutouurloon').disable(this);
	$('payroll_uurtarief').disable(this);
	$('payroll_ziekteverzuimtype_id').disable(this);
	
	$('payroll_inhouding_koffiegeld').disable(this);
	$('payroll_inhouding_koffiegeld_inhoudingtype').disable(this);
	$('payroll_inhouding_koffiegeld_inhoudingtstariefype').disable(this);
	$('payroll_inhouding_kleedgeld').disable(this);
	$('payroll_inhouding_kleedgeld_inhoudingtype').disable(this);
	$('payroll_inhouding_kleedgeld_inhoudingtstariefype').disable(this);
	$('payroll_inhouding_reiskosten').disable(this);
	$('payroll_inhouding_reiskosten_inhoudingtype').disable(this);
	$('payroll_inhouding_reiskosten_inhoudingtstariefype').disable(this);	
	$('payroll_inhouding_open_value').disable(this);
	$('payroll_inhouding_open').disable(this);	
	$('payroll_inhouding_open_inhoudingtype').disable(this);
	$('payroll_inhouding_open_inhoudingtstariefype').disable(this);
	
	$('payroll_vergoeding_koffiegeld').disable(this);
	$('payroll_vergoeding_koffiegeld_inhoudingtype').disable(this);
	$('payroll_vergoeding_koffiegeld_inhoudingtstariefype').disable(this);
	$('payroll_vergoeding_kleedgeld').disable(this);
	$('payroll_vergoeding_kleedgeld_inhoudingtype').disable(this);
	$('payroll_vergoeding_kleedgeld_inhoudingtstariefype').disable(this);
	$('payroll_vergoeding_reiskosten').disable(this);
	$('payroll_vergoeding_reiskosten_inhoudingtype').disable(this);
	$('payroll_vergoeding_reiskosten_inhoudingtstariefype').disable(this);	
	$('payroll_vergoeding_open_value').disable(this);
	$('payroll_vergoeding_open').disable(this);	
	$('payroll_vergoeding_open_inhoudingtype').disable(this);
	$('payroll_vergoeding_open_inhoudingtstariefype').disable(this);					
			
	//$('payroll_vergoedingen').disable(this);	
	$('payroll_ingangsdatum_3i').disable(this);
	$('payroll_ingangsdatum_2i').disable(this);
	$('payroll_ingangsdatum_1i').disable(this);		
	$('payroll_email').disable(this);
	$('payroll_voornaam').disable(this);
	$('payroll_voorletters').disable(this);
	$('payroll_tussenvoegsels').disable(this);
	$('payroll_achternaam').disable(this);
	$('payroll_burgstaat_id').disable(this);
	$('payroll_meisjesnaam').disable(this);
	$('payroll_geboortedatum_3i').disable(this);
	$('payroll_geboortedatum_2i').disable(this);
	$('payroll_geboortedatum_1i').disable(this);
	$('payroll_adres').disable(this);
	$('payroll_postcode').disable(this);
	$('payroll_plaats').disable(this);
	$('payroll_medewerkertype_id').disable(this);
	$('payroll_datuminschrijving_3i').disable(this);
	$('payroll_datuminschrijving_2i').disable(this);
	$('payroll_datuminschrijving_1i').disable(this);	
	//$('payroll_inhoudingtype_id').disable(this);
	//$('payroll_vergoedingtype_id').disable(this);	
	$('payroll_burgerservicenummer').disable(this);
		
	//Verberg het uurtarief
	$('payroll_uurtarief').hide(this);
	$('lUurtarief').hide(this);	
	$('uurtariefDiv').hide(this);
	
														
}

//Wanneer de user is ingelogd mag hij de account en candidate velden niet editen
function disableUserFields(){
	$('candidate_sexe_id').disable(this);
	$('candidate_telefoon').disable(this);
	$('candidate_mobiel').disable(this);
	$('candidate_email').disable(this);
	$('candidate_bankrekeningnr').disable(this);
	$('account_cao').disable(this);																
}		

function changeUurtarief(type){
	/* 
	*
	*fds
	*/
	
	if(type == 1)
	{
		$('payroll_uurtarief').value = "Type 1";	
	}
	else
	{
		$('payroll_uurtarief').value = "Type 2";	
	}
}

// Contactmomenten in kandidaten overzichten

function toggleMomentsDown(id)
{
	Effect.Appear('contactmomenten_'+ id);
	$('momentlinkDown_' + id).style.display = 'none';	
	$('momentlinkUp_' + id).style.display = 'inline';


}

function toggleMomentsUp(id)
{
	Effect.Fade('contactmomenten_'+ id,{duration:.5});
	$('momentlinkDown_' + id).style.display = 'inline';	
	$('momentlinkUp_' + id).style.display = 'none';	


}

function disableLoonhef()
{
	if ($('payroll_loonheffingskorting_wel').disabled)
	{
    	$('payroll_loonheffingskorting_wel').checked = false;		
    	$('payroll_loonheffingskorting_wel').enable(this);		
	} 
	else
	{
    	$('payroll_loonheffingskorting_wel').checked = false;		
    	$('payroll_loonheffingskorting_wel').disable(this);		
	}

	if ($('payroll_loonheffingskorting_niet').disabled)
	{
    	$('payroll_loonheffingskorting_niet').checked = false;		
    	$('payroll_loonheffingskorting_niet').enable(this);		
	} 
	else
	{
    	$('payroll_loonheffingskorting_niet').checked = false;		
    	$('payroll_loonheffingskorting_niet').disable(this);		
	}	
}

function disableLoonhefWel()
{
	if ($('payroll_loonheffingskorting_wel').disabled)
	{
    	$('payroll_loonheffingskorting_wel').checked = false;		
    	$('payroll_loonheffingskorting_wel').enable(this);		
	} 
	else
	{
    	$('payroll_loonheffingskorting_wel').checked = false;		
    	$('payroll_loonheffingskorting_wel').disable(this);		
	}
}

function disableLoonhefNiet()
{
	if ($('payroll_loonheffingskorting_niet').disabled)
	{
    	$('payroll_loonheffingskorting_niet').checked = false;		
    	$('payroll_loonheffingskorting_niet').enable(this);		
	} 
	else
	{
    	$('payroll_loonheffingskorting_niet').checked = false;		
    	$('payroll_loonheffingskorting_niet').disable(this);		
	}
}


							