// Filter portfolio by type
//
// This script is a part of Blur Studio template
// Author Emil Nikov - enstyled
$(document).ready(function(){

$('#filter a').click(function() {
	
	if(!($(this).parent().hasClass('active'))) {
		
		$(this).parents('ul').find('.active').removeClass('active');
		$(this).parent().addClass('active');
	
		var i;
		var type = $(this).attr('class');
		
		if(type == 'all') {
			$('#articles li').fadeIn();
				
			$('#articles li').each(function() {
				$(this).find('a').attr('rel', 'portfolio');
			});
			
			
		} else {
		
		
			$('#articles li').each(function() {	
				$(this).hide().find('a').attr('rel', '');
				if(($(this).hasClass(type))) {
					$(this).fadeIn().find('a').attr('rel', 'portfolio');
				} else {
					$(this).hide();
				}
			});
		}
	}
	
	return false;
	
});

$('.main2 li:odd').addClass('odd');

});
