jQuery(document).ready(function(){

  /* -----------------------------------------------------------------------
      FIXES AND HACKS TO DEAL WITH BROWSER ISSUES AND INCONSISTENCIES
  ----------------------------------------------------------------------- */

  // Replace the <hr/> elements with <b class="hr"></b>
  // We want the hr's to appear the same across all major browsers and we want to maintain the vertical rhythm.
  // This proves practically impossible to achieve by just styling the hr tag, this is why we are replacing 
  // it with another element.
  $('hr').replaceWith('<b class="hr"></b>');

  // Normally all block element have a bottom margin of 20px. However, inside various modules, 
  // for the last element in the module don't want the bottom margin. Because the support for the CSS 
  // pseudo selector :last-child differs between browsers, we are using jQuery to do this.
  $('div.alignright, div.alignleft, div.aligncenter, div.mod-bevel .bd, .message').children(':last-child').css({ 'margin-bottom': '0' });
  
  // Normally browsers collapse margins on adjacent elements. In many situations this is desirable, 
  // but it breaks vertical spacing between modules. Margin collapsing can't be prevented by using 
  // normal CSS mechanisms, so we are inserting additional element after each module. With this 
  // element between them, the modules are no longer adjacent and their margins will not be collapsed.
  $('.mod').after('<b class="uncollapse-margins"></b>');
  
  // Set cell spacing on all tables to 1px
  $('table').attr({ cellSpacing : 1 })


  /* -----------------------------------------------------------------------
      CALL AND INITIALISE GLOBALLY USED PLUGINS
  ----------------------------------------------------------------------- */
  
  // Pretty buttons
  $('a.jbtn').pragmaButtons();
  $('input.jbtn').pragmaButtons();
  
  // Main navigation
  $('#main-nav').pragmaNavigation();
});

