// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

jQuery(function(){
  // ZEBRA STRIPING
  jQuery('tbody tr:nth-child(odd),li:nth-child(odd)').addClass('odd');
  jQuery('tbody tr:nth-child(even),li:nth-child(even)').addClass('even');
  // HOVER CLASS
  jQuery('li').hover(
    function(){
      jQuery(this).addClass('hover');
    },function(){
      jQuery(this).removeClass('hover');
  });
  jQuery('a._blank').click(function(){
    window.open(this.href);
    return false;
  });
  
  /**
   * BUTTON HACK for all browsers
   * Clicked button name is returned as value of 'clicked' object
   * @author Adam Łyskawa
 */

  jQuery('button').bind('click', function(e) {
    e = jQuery(this);
    e.attr('value', e.attr('name'));
    e.attr('name', 'clicked');
  });

  jQuery('form').submit(function(event) {
    jQuery('button[name!=clicked]').remove();
  });  

});

