$(document).ready(function() {	
	

	
	$('form input[name=current_address_duration_years]').change(function(e) {
		
		//console.log('here');
		var val = parseInt($(this).val());
		//console.log(val);
		
		if (val < 2 || isNaN(val))
		{
			$('fieldset#previous_address').fadeIn('slow');
		}
		else
		{
			$('fieldset#previous_address').fadeOut();
		}	
	});	
	
	$('form input[name=current_address_duration_months]').change(function(e) {
		var val = $('form input[name=current_address_duration_years]').val();		
		val = parseInt(val);
		if (val < 2 || isNaN(val))
		{ $('fieldset#previous_address').fadeIn('slow'); }
		else
		{ $('fieldset#previous_address').fadeOut(); }
	});
	
	
	$('form input[name=current_employment_duration_years]').change(function(e) {
		
		var val = parseInt($(this).val());
		
		if (val < 2 || isNaN(val))
		{
			$('fieldset#previous_employment_information').fadeIn('slow');
		}
		else
		{
			$('fieldset#previous_employment_information').fadeOut();
		}
	});
	
	$('form input[name=current_employment_duration_months]').change(function(e) {
		
		var val = $('form input[name=current_employment_duration_years]').val();
		val = parseInt(val);
		
		if (val < 2 || isNaN(val))
		{
			$('fieldset#previous_employment_information').fadeIn('slow');
		}
		else
		{
			$('fieldset#previous_employment_information').fadeOut();
		}
	});	
	
	

	
	
	
	
});


	function goPrevStep (step)
	{
		$('form input[name=step]').val(step);
		$('form input[name=going_back]').val(1);
		$('form').submit();	
	}
