/*
     $Revision$
     $Id$

     File:      res_search.js
*/

function checkCheckboxes()
{
  if (!document.getElementById("res_open").checked && !document.getElementById("res_closed").checked )
  {
    document.getElementById("res_open").checked = true;
  }
  if (document.getElementById("res_approved") && !document.getElementById("res_approved").checked &&
      document.getElementById("res_notapproved") && !document.getElementById("res_notapproved").checked)
  {
    document.getElementById("res_approved").checked = true;
  }
  if (!document.getElementById("roomcat").checked &&
      !document.getElementById("objcat").checked &&
      !document.getElementById("artcat").checked)
  {
    document.getElementById("roomcat").checked = true;
  }
}

function updateArt(pautfunction, particle_str)
{
  var lartcat_key_str = new Array();
  $('#artcatmulti :selected').each(function(i, selected)
                                   {
                                     lartcat_key_str[i] = $(selected).val();
                                   });
  $("#selectartdiv").load("../Shared/loadArticle.asp?autfunction=" + pautfunction
                                                   + (lartcat_key_str != ""? "&artcat_key_str=" + lartcat_key_str : "")
                                                   + (particle_str? "&article_str=" + particle_str : ""));
}

function fnStepPlanbord(stepFrom, stepTo, autosearch)
{
    var currFrom = $("#show_date_from").datepicker('getDate');
    var currTo = $("#show_date_to").datepicker('getDate');
    currFrom.setDate(currFrom.getDate() + stepFrom);
    currTo.setDate(currTo.getDate() + stepTo);
    $("#show_date_from").datepicker('setDate', currFrom);
    $("#show_date_to").datepicker('setDate', currTo);
    if (autosearch == 1)
      $("#autosearch").val(1);
    else
      $("#autosearch").val(0);
    doSubmit(__mode);
}