$(function(){

  $('#footer-links a:first-child').addClass('first');
  $('#breadcrumbs a:first-child').addClass('first');
  
// Fonts
  //Cufon.replace('#main-navigation .menu > li > a', { hover: true });
  //Cufon.replace('.ui-tabs-nav a, #content h2', { hover: true });
 
// Creating Labs
  (function () {
      var $d = $('div.product_details div.description');
      var as = [];
      var cs = [];
      var i = 1;
      $d.find('h3').each(function () {
          var $h = $(this);
          var id = 's'+(i++);
          var $content = $();
          var $e = $h.next();
          while ($e.size() > 0 && $e[0].nodeName.toUpperCase() != 'H3') {
              $content = $content.add($e);
              $e = $e.next();
              if ($e.size() == 0) break;
          }
          as.push($('<a>').attr('href', '#'+id).text($h.remove().text())[0]);
          cs.push($('<div>').attr('id', id).append($content.remove())[0]);
      });
      
      $d
          .append($('<ul>').append($(as).map(function (i, e) { return $('<li>').append(e)[0]; })))
          .append(cs)
          .tabs()
      ;
      $(cs).removeClass('ui-corner-bottom');
      // Cufon.refresh('.ui-tabs-nav a');
  })();
  
// Color box
    $('a.main_image_link, a[rel=gallery]').colorbox();
});

