/**
* ------------------------------------------------------------------------------------------------
* @author 	Diego Tres me@diegotres.com
* @version 	0.1
* ------------------------------------------------------------------------------------------------
*/


(function($)
{

	$.fn.neoHighlight = function(options)
	{

		var defaults = {
			queue: false,
			duration: 200,
			easing: 'linear',
			opacity: .4,
			hoverButton: false,
			hasLink: true
		};

		var options = $.extend(defaults, options);

		var aThis = this;

		return this.each(function()
		{

			var $this = $(this);


			if (options.hoverButton)
			{

				var alink = $('a', this).eq(0);
				alink.neoHover({ init: false });
				$this.css('cursor', 'pointer');

				if (options.hasLink)
				{
					$this.attr('href', alink.attr('href'));
					$this.click(function()
					{
						window.location = $this.attr('href');
					});
				}

			}

			$this.hover(function()
			{
				$(aThis).animate({ opacity: options.opacity }, { queue: options.queue, duration: options.duration }, options.easing);
				$this.animate({ opacity: 1 }, { queue: options.queue, duration: options.duration }, options.easing);

				if (options.hoverButton) $('a span', $this).animate({ opacity: 1 }, { queue: options.queue, duration: options.duration }, options.easing);


			}, function()
			{
				$(aThis).animate({ opacity: 1 }, { queue: options.queue, duration: options.duration }, options.easing);
				if (options.hoverButton) $('a span', $this).animate({ opacity: 0 }, { queue: options.queue, duration: options.duration }, options.easing);
			});

		});

	};

})(jQuery); 




