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-groupe').addClass('has-error');
		}
	});
	
	return false;
}

/* calcul age */

$j(function(){
	$j('#age, #anciennete').prop('readonly', true);
	
	$j('#date_naissance-dd, #date_naissance-mm, #date_naissance').change(function(){
		var dob = get_date('date_naissance');
		var dor = get_date('date_recrutement');
		var today = new Date();
		var age = Math.floor((today - dob) / 1000 / 60 / 60 / 24 / 365.25);
		var service = Math.floor((today - dor) / 1000 / 60 / 60 / 24 / 365.25);
		
		$j('#age').val(age);
		$j('#anciennete').val(service);
	});
	
	$j('#date_naissance').change();
	$j('#date_recrutement').change();
});