jQuery(document).ready(function() {
	jQuery('ul#filter a').click(function() {
		jQuery(this).css('outline','none');
		jQuery('ul#filter .current').removeClass('current');
		jQuery(this).parent().addClass('current');

		var filterVal = jQuery(this).text().toLowerCase().replace(' ','-');

		if(filterVal == 'todos') {
			jQuery('ul#portfolio li').stop().animate({'opacity' : 1,
			 'width' : '240px',
			 'marginRight' : '0',
			 'marginLeft' : '0'
			});
		} else {

			jQuery('ul#portfolio li').each(function() {
                if(!jQuery(this).hasClass(filterVal)) {
                    jQuery(this).stop()
						.animate({'width' : 0,
									 'opacity' : 0,
									 'marginRight' : '-45px',
									 'marginLeft' : 0
									});
				} else {
					jQuery(this).stop()
						.animate({'width' : '240px',
									 'opacity' : 1,
			                         'marginRight' : '0',
									 'marginLeft' : '0'
									});
 			}
			});
		}

		return false;
	});
    jQuery('ul#portfolio li img').hover(function() {
      jQuery(this).animate({'opacity' : 0.9});
    }, function() {
      jQuery(this).animate({'opacity' : 1});
    });
});

