/* 
SlashC jQuery thumbnail plugin
hi@slashc.com, www.slashc.com
*/
(function($)
{	
	/* plugin methods */
	var methods =
	{
		/* intialization */
		init : function()
		{
			return this.each(function()
			{
				var $this = $(this), props = $this.data('props');
				if(!props)
				{
					var descr = $('span', $this);
					var descrOutPos = -descr.outerHeight();
					descr.css('bottom', descrOutPos);
					
					$this.data('props', 
					{
						descr: descr,
						descrOutPos: descrOutPos
					});
					
					$this.bind('mouseover.slashcThumbnail', $.proxy(methods.onMouseOver, $this));
					$this.bind('mouseout.slashcThumbnail', $.proxy(methods.onMouseOut, $this));
				}
			});
		},
		/* mouse over handler */
		onMouseOver : function(e)
		{
			var props = this.data('props');
			if (props) props.descr.stop(true, false).animate({ bottom: 0 }, { duration: 200 });			
			e.preventDefault();
		},
		/* mouse out handler */
		onMouseOut : function(e)
		{
			var props = this.data('props');			
			if (props) props.descr.stop(true, false).animate({ bottom: props.descrOutPos }, { duration: 200 });
			e.preventDefault();
		}
	};
	/* Thumbnail plugin */
	$.fn.slashcThumbnail = function(method)
	{
		if(methods[method])
		{
			return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
		}
		else if(!method)
		{
			return methods.init.call(this);
		}		
	};
})(jQuery);
