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 ttc field to read only*/
$j('#net_a_payer').prop('readonly', true);

/* calcul du champs montant_ttc */
$j('#remise, #prix').change(function(){
	var remises = parseFloat($j('#remise').val()) || 0;
	var unitPrice = parseFloat($j('#prix').val()) || 0;
	
	var totalPrice = unitPrice - remises;
	$j('#net_a_payer').val(totalPrice);
});

/* calculate total price on opening the detail view form*/
$j('#prix').change();

})