//common variables
var pageurl = location.pathname;

//Do this jQuery stuff as soon as the DOM is ready to be manipulated
$(function() {
         
   //make the pods clickable and add a hover event 
   $(".pod").click(function() {window.location = $(this).find("a:first").attr("href")});  
   $(".pod").hover(
      function () {$(this).addClass("pod-hover")}, 
      function () {$(this).removeClass("pod-hover")}
    );
   
   $('a.print-page').click(function(){
      window.print();
      return false;
   });

   $('#tabs li a').each(function(index, link){
       if ($('body').hasClass('therapy') && $(link).html() == 'Therapy') {
           $(link).parent().addClass('current-menu-item');
       } else if ($('body').hasClass('training') && $(link).html() == 'Training') {
           $(link).parent().addClass('current-menu-item');
       } else if ($('body').hasClass('our-team') && $(link).html() == 'Our Team') {
           $(link).parent().addClass('current-menu-item');
       }
   });

   //do the following stuff, but don't bother doing it to IE6...
   if (!(jQuery.browser.msie && jQuery.browser.version <= 6)) {      
      //add rounded corners to the tabs
      $("#tabs li").append('<span class="tl"></span><span class="tr"></span>');
      
      //adds an extra bit of padding to the right of p elements if they're direct children of the col-r-inner element.
      //Avoids a lot of messy CSS to that would be needed to keep the designs like Mark's png's
      $(".col-r-inner > p").css("padding-right","40px");
      
   }     

   //make links with rel="external" and rel="download" open in new windows. target="_blank" doesn't validate as XHTML STRICT
   $('a[href][rel*=external]').each(function(i){this.target = "_blank";})
   $('a[href][rel*=download]').each(function(i){this.target = "_blank";})
   
   
   $(".book-box-small").each(function(){
      $(this).find("img:first").wrap('<div style="height:155px"></div>');
      $(this).find(".book-box-foot").css("height","110px");
   });   

});
