// Highlight rows on a table with the class 'ruler'
function tableRowHighlighter() {
  $(".ruler tbody tr").hover(
    function(){ $(this).addClass("ruled"); },
    function(){ $(this).removeClass("ruled"); }
  )
}

// Check if the chartered forestry check boxes are ticked and show or hide the insurance fieldset
function toggleInsuranceForm() {
  if ($('#user_registered_chartered_forester').attr('checked') || $('#user_chartered_forester').attr('checked')) {
    if ($('#insurance_details').css("display") == "none") {
      $('#insurance_details').slideDown();
    }
  } else {
    if ($('#insurance_details').css("display") == "block") {
      $('#insurance_details').slideUp(); 
    }
  }
}

// Once JQuery is loaded, load table highlighter
jQuery(document).ready(function($) {
  tableRowHighlighter();
});