jQuery(function(){

  // group gallery items
  jQuery('div.fancy.gallery a')
  .each(function(){
    var $this = jQuery(this); 
    $this.attr('rel', $this.parent().attr('id'));
  });
  
  jQuery('img.wp-image-5').attr('title', 'http://www.seanofdesign.com/wp-content/uploads/2010/12/stripe2.gif');
  jQuery('img.wp-image-9').attr('title', 'This was taken by the famous photographer, Mary Diaz while on the tour of a lifetime in SF.');
  jQuery('img.wp-image-14').attr('title', 'http://www.seanofdesign.com/wp-content/uploads/2010/12/cropped-bbar.jpg');
  jQuery('img.wp-image-15').attr('title', 'My love');
  jQuery('img.wp-image-52').attr('title', 'http://www.seanofdesign.com/wp-content/uploads/2010/12/stripe3.gif');
  jQuery('img.wp-image-62').attr('title', 'Brewing guide designed to help customers quickly reference the appropriate brewing for various tea types.');
  jQuery('img.wp-image-65').attr('title', 'Poster design promoting Rishi\'s booth at a Milwaukee farmer\'s market.');
  jQuery('img.wp-image-66').attr('title', 'Promotional mailer tied to e-commerce marking campaign.');
  jQuery('img.wp-image-67').attr('title', 'Advertising designed to educate consumers on the benefits of Matcha. Produced for the Vegetarian Times magazine.');
  jQuery('img.wp-image-68').attr('title', 'Rishi Tea business cards designed to highlight the connection Rishi has with the gardens and producers. Each card has multiple versions of the back, each with a different photo.');
  jQuery('img.wp-image-69').attr('title', 'Mini promotional card designed to hand out at various Rishi events.');
  jQuery('img.wp-image-73').attr('title', 'Promotional mailer for the product launch of the Jane Goodall sponsored Masala Chai concentrate.');
  jQuery('img.wp-image-74').attr('title', 'T-shirt designs for Rishi staffed at the Jane Goodall product launch party.');
  jQuery('img.wp-image-75').attr('title', '40 page bulk tea catalog. This booklet serves as both a sales tool and an educational tool.');
    
  
  // Add Fancy Classes to single items:
  jQuery('a').each(function(){
    // filter items
    if (          this.href.substr(-4).toLowerCase().indexOf('.jpg') < 0 &&
                  this.href.substr(-5).toLowerCase().indexOf('.jpeg') < 0 &&
                  this.href.substr(-4).toLowerCase().indexOf('.png') < 0 &&
                  this.href.substr(-4).toLowerCase().indexOf('.gif') < 0 &&
                  this.href.substr(-4).toLowerCase().indexOf('.bmp') < 0 &&
                  this.href.substr(-5).toLowerCase().indexOf('.wbmp') < 0 &&
                  this.href.substr(-4).toLowerCase().indexOf('.ico') < 0 &&
                  true )
    return;
    
    // shorter access path
    var $lnk = jQuery(this);
    var $img = $lnk.find('img'); 

    // Add the fancybox class
    $lnk.addClass('fancybox');
    
        
    // Copy the title tag from link to img
    $lnk.attr('title', $img.attr('title'));
  });
  
  jQuery('a.fancybox')
  .unbind('click')
  .fancybox({
  
    padding        :  20,
    cyclic         :  true,
    scrolling      : 'auto',
    centerOnScroll :  false,
    overlayOpacity :  0.8,
    overlayColor   : '#000000',
    titleShow      :  true,
    titlePosition  : 'inside',
    transitionIn   : 'none',
    transitionOut  : 'none',    
    speedIn        :  100,
    speedOut       :  100,
    changeSpeed    :  100,
    showCloseButton:  false        

  });

});

