/**
 * jQuery slajd plugin
 * @name jquery.slajd-0.1.js
 * @author pawelw
 * @www www.projektujemy.pl
 * @version 0.1
 * @date April 17, 2009
 * @category jQuery plugin
 */
(function($) {

$.fn.slajd = function(options) {
		
  	$.fn.slajd.defaults = {
		opacity: '0.5',
		sizeNormal: 220, 
		sizeSmall: 200, 
		sizeFull: 280
  	};
  	
  	var defaults = $.extend(defaults, options);

  	var events = function(elem, i) {
		var $elem = $(elem);
		
		$elem.mouseenter(function() {
			
			$elem.each(function() {
				$("#category li a span").animate({top:'-45px'},{queue:false, duration:500, easing: 'easeOutCubic'});
				
				$elem.stop().animate(
									 {
										 width: defaults.sizeFull, opacity: 1
									 },
									 {
										 queue:false, 
										 duration:500, 
										 easing: 'easeOutBack', 
										 complete: function() {$elem.children().children('span').css({display:'block', opacity: 0.6}).animate({top:'0px'},{queue:false, duration:300, easing: 'easeOutCubic'});}
									  });
				
				$("#category li").not(this).stop().animate({width: defaults.sizeSmall, opacity: 0.8},{queue:false, duration:500, easing: 'easeOutBack'});

			});
			
			return false;
		});
		
		$("#category").mouseleave(function() {
			$("#category li").stop().animate({width: defaults.sizeNormal, opacity: 1},{queue:false, duration:500, easing: 'easeOutBack'});
			$("#category li").removeClass('selected');
			$("#category li a span").animate({top:'-45px'},{queue:false, duration:500, easing: 'easeOutCubic'});
	
			return false;
		});
    };
  	
  	return this.each(function() {
		events(this);
    });
	return this;	
};

})(jQuery);