
// Set focus on search form input field
function setFocusOnForm(theForm) {
  if (theForm != null){
    try{
      eval( "document." + theForm + ".freesearch.focus();" )
    }catch(err){
      document.searchForm.freesearch.focus();
    }
  }else{
    document.searchForm.freesearch.focus();
  }
}

// Print Window functionality
function printWindow () {
  window.print();
}

// Via JQuery make table "wachttijden" row (odd / even) gray or not
$(document).ready(function(){
  // Change collor of odd and even rows of a wachttijden table.  
  $('table.wachttijden tbody tr:odd').removeClass('even');
  $('table.wachttijden tbody tr:even').addClass('even');

  // AMGINT-101 : de tekst 'Zoekterm' vervalt niet automatisch. 
  // Get the first "default value" from freesearch field and save it.
  var gotIt = false;
  var default_value = '';
  $('form, input, text').each(function(i) {
    if (!gotIt && $(this).attr('name') == 'freesearch'){
      default_value = $(this).val();
      gotIt = true;
    }
  });

  // If form field value is the default value.... delete it.
  $('input, text').focus(function() {
    if($(this).val() === default_value) {
      $(this).val('');
    };
  })
  
});

