jQuery(document).ready( function () {
  jQuery('.staff_entry').hover( function() {
      var target_div = jQuery(this).find('.staff_info');
      var move = 185 - target_div.height();
      jQuery(this).find('.staff_info').animate({top:move}, {queue:false, duration:250, easing: 'easeInSine'});
    },
    function() {
      jQuery(this).find('.staff_info').animate({top:'160px'}, {queue:false, duration:250, easing: 'easeOutSine'});
    }
  );
  
  jQuery(".amzn-price").fancybox();
  jQuery(".fancybox").fancybox();
  
  jQuery(".iframe").fancybox({
    'width'                 : 580,
    'height'                : 335,
    'autoScale'             : false,
    'transitionIn'          : 'none',
    'transitionOut'         : 'none',
    'type'                  : 'iframe'
  });
  
	jQuery("a[rel=photos_group]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
		    return '<span id="fancybox-title-over">Image ' +  (currentIndex + 1) + ' / ' + currentArray.length + ' ' + title + '</span>';
		}
	});
  
  jQuery('.wishlist-form').click(function(e) {
    var form = jQuery(this);
    $.post('/wishlist/addItem.js', form.serialize(), function(res) 
    {
      form.parent().html('in wishlist');
    }, "json");
    e.preventDefault();
  });
  
  jQuery('.product-form').click(function(e) {
  
    if(jQuery('#fancy_notification').length) 
    {
      jQuery('#fancy_notification').css('display', 'block');
      jQuery('#fancy_notification_content').css('display', 'none');
      jQuery('#loading_animation').css("display", 'block');
    }
    
    var form = jQuery(this);
    $.post('/cart/addItem', form.serialize(), function(res) 
    {
      jQuery('#smcart').html(res);
    }, "html");
    e.preventDefault();
  });
  
  jQuery('.feature-form').click(function(e) {
    var form = jQuery(this);
    $.post('/product/setFeatured.js', form.serialize(), function(res) 
    {
      form.remove();
    }, "json");
    e.preventDefault();
  });
  
  function popUp(win)
  {
    var newWin = window.open(win,'name','width=700,scrollbars=yes');
  }  
    
});

