// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
$(document).ready(function(){

  // Add explanation anchors
  $('div.explanation').after('<a href="#" class="explain">?</a>');

  $('a.explain').click(
    function() {
      $(this).next('div.explanation').toggle();
    }
  );
  
  // Toggles the display of admin classes
  $('a#toggle-admin').click(
    function() {
      $('.admin').toggle();
    }
  );
  
  // Allows span.button_replacements to act as submit buttons on forms
  $('span.button_replacement a').click(
    function() {
      $(this).parents('form:first').submit();
      return false;
    }
  );
  
  // Makes clicking on any table row in the 'primary' table go to that row's company name
  $('table.primary tbody tr td').click(
    function() {
      var parent_tr = $(this).parent('tr').get(0);
      location.href = $( 'a', parent_tr )[0].href;
    }
  );
  
  // IE6 niceties
  $(document).pngFix();
  $("table.primary tbody tr").mouseover(
    function() {
      $(this).addClass("sfhover");
    }
  ).mouseout(
    function() {
      $(this).removeClass("sfhover");
    }
  );

  
});