/*
     $Revision$
     $Id$
*/
function updateDisc(purole, pautfunction)
{
  var lsrtdisc_key_arr  = new Array();
  $('#srtdiscmulti :selected').each(function(i, selected)
                                   {
                                     lsrtdisc_key_arr[i] = $(selected).val();
                                   });
  var offerte = $("#offerte").val();
  $("#discmulti").load("../Shared/loadDisc.asp?urole=" + purole
                                           + "&autfunction=" + pautfunction
                                           + "&srtdisc_key_arr=" + lsrtdisc_key_arr.join(",")
                                           + (offerte >= 0? "&offerte=" + offerte : ""),
                       function ()
                       {
                         // Laad de stdmeldingen
                         updateStdm(purole, pautfunction);
                       });
}

function updateStdm(purole, pautfunction)
{
  var lsrtdisc_key_arr = new Array();
  var ldisc_key_arr = new Array();
  var offerte = $("#offerte").val();
  $('#srtdiscmulti :selected').each(function(i, selected)
                                   {
                                     lsrtdisc_key_arr[i] = $(selected).val();
                                   });
  $('#discmulti :selected').each(function(i, selected)
                                   {
                                     ldisc_key_arr[i] = $(selected).val();
                                   });
  $("#sm").load("../Shared/loadStdmelding.asp?urole=" + purole
                                                 + "&autfunction=" + pautfunction
                                                 + (lsrtdisc_key_arr.length != 0? "&srtdisc_key_arr=" + lsrtdisc_key_arr.join(",") : "")
                                                 + (ldisc_key_arr.length != 0? "&disc_key_arr=" + ldisc_key_arr.join(",") : "")
                                                 + (offerte >= 0? "&offerte=" + offerte : ""));
}

function checkieuitv()
{
  if (!document.getElementById("opdrIUit").checked &&
      !document.getElementById("opdrEUit").checked)
  {
    document.getElementById("opdrIUit").checked = true;
    document.getElementById("opdrEUit").checked = true;
  }
}
function checkplanned()
{
  if (!document.getElementById("opdrPlanned").checked &&
      !document.getElementById("opdrUnplanned").checked)
  {
    document.getElementById("opdrPlanned").checked = true;
    document.getElementById("opdrUnplanned").checked = true;
  }
}
function checkbedragonder()
{
        var bedragonder = parseFloat($("#bedragonder").val().replace(',', '.'));
        if (isNaN(bedragonder))
          bedragonder = 0;
        if ($("#bedragonder").val() != '' && !isNaN(bedragonder))
          $("#bedragonder").val(num2currEditable(bedragonder));
}
function checkbedragboven()
{
        var bedragboven = parseFloat($("#bedragboven").val().replace(',', '.'));
        if (isNaN(bedragboven))
          bedragboven = 0;
        if ($("#bedragboven").val() != '' && !isNaN(bedragboven))
          $("#bedragboven").val(num2currEditable(bedragboven));
}