$(document).ready(function()
{
  // Remove event trapping
  window.onresize = null;
  document.onmousemove = '';
 
  $("#whyubs_tabs").tabs();

  // Logic to change the tab graphic
  // Note: this assumes that on and off graphics are named with '_off' and '_on' at the end of the filename
  $('.ui-tabs-nav').bind('tabsshow', function(event) {
    var imgSrc = '';
    $("#whyubs_tabs li").each(
      function() {
        if( $("img", this) )
        {
          // Get the image path
          imgSrc = $("img", this).attr("src");
          // Swap the images
          if( $(this).attr("class") == 'ui-tabs-selected' ) {
            imgSrc = imgSrc.replace(/_off\./, '_on.');
          } else {
            imgSrc = imgSrc.replace(/_on\./, '_off.');
          }
          // Update the image
          $("img", this).attr("src", imgSrc);
        }
    });
  });

});


