// jQuery Quicksand project categories filtering
// Thanks to Sacha Greif - http://www.sachagreif.com/

jQuery.noConflict();
jQuery(document).ready(function($){
	
	$('#wrapper').cornerz({borderWidth:10, background:"silver", borderColor:"grey", radius:30});
	
	
 	// Clone applications to get a second collection
	
	var $data = $(".portfolio-content").clone();
	
	//NOTE: Only filter on the main portfolio page, not on the subcategory pages
	$('.portfolio-main li').click(function(e) {
		$(".filter li").removeClass("active");	
		// Use the last category class as the category to filter by. This means that multiple categories are not supported (yet)
		var filterClass=$(this).attr('class').split(' ').slice(-1)[0];
		
		if (filterClass == 'all-projects') {
			var $filteredData = $data.find('.project');
			
		} else {
			var $filteredData = $data.find('.project[data-type=' + filterClass + ']');
			
		}
		
		$(".portfolio-content").quicksand($filteredData, {
			duration: 780,
			easing: 'easeInOutQuad',
			adjustHeight: false,
			useScaling: false,
			
		});		
		$(this).addClass("active"); 			
		return false;
	});
});

