/*
     $Revision$
     $Id$
*/

function pre_submit()
{
    var validation_message = "";

    var cnt_perc = $("#percentage").val();
    var cnt_marge = $("#margin").val();
    var cnt_fiat = $("#approve").prop("checked");

    if (cnt_perc && ( (parseInt(cnt_perc) > 100) || (parseInt(cnt_perc) < 0) ))
        validation_message += L("mgt_validation_error_1").format(L("cnt_discipline_factuurpct")) + "\n";

    if (cnt_fiat && (!cnt_perc && !cnt_marge))
        validation_message += L("mgt_validation_error_2").format(L("cnt_discipline_factuurpct"), L("cnt_discipline_factuurmarge")) + "\n";

    if (validation_message != "")
    {
        FcltMgr.alert(validation_message);
        return false;
    }

    return true;
}