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(){
$j('#update, #insert').click(function(){
/* Make sure Taux is valid */
var taux = $j('#commission').val();

});

/* Set montant a payer to read-only */
$j('#prix_ttc').prop('readonly', true);

/* calculer le total */
$j('#prix_ht, #prix_ttc, #commission').change(function(){
var prixHt = parseFloat($j('#prix_ht').val()) || 0;
var commission = parseFloat($j('#commission').val()) || 0;
var prixTt = parseFloat($j('#prix_ttc').val()) || 0;


var prixTotal = prixHt * commission / 100 + prixHt;
$j('#prix_ttc').val(prixTotal);
});

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


})