function show_error(field, msg){
	modal_window({
		message: '<div class="alert alert-danger">' + msg + '</div>',
		title: 'Error in ' + field,
		close: function(){
			$j('#' + field).focus();
			$j('#' + field).parents('.form-group').addClass('has-error');
		}
	});
	
	return false;
}

$j(function(){
	/* set montant net à anciennete field to read only*/
$j('#anciennete').prop('readonly', true);

	$j('#date_recrutement-dd, #date_recrutement-mm, #date_recrutement').change(function(){
		var drecrut = get_date('date_recrutement');
		var ddepar = get_date('date_depart');
		var today = new Date();
		
		var ancien = Math.floor((ddepar - drecrut) / 1000 / 60 / 60 / 24 / 365.25);
		//var ancien = (ddepar - drecrut) / (1000 * 60 * 60 * 24);
		
		$j('#anciennete').val(ancien);
	});
	
	$j('#date_recrutement').change();
});
