$(document).ready(function() {
	
	// Active Menu & Page
	
	$(document).ready(function() {
	
		var url = location.pathname;
		var folders = url.split('/');
		var curDir = folders[folders.length-2];
		var curPage = folders[folders.length-1];
		
		if (curPage == '') {
			$('#secondarySidebar li a.'+curDir).addClass('active');
			$('#secondarySidebar li ul.'+curDir).slideDown(0, 'easeInOutSine');
		}
		else {
			$('#secondarySidebar li a.'+curPage).addClass('active');
			$('#secondarySidebar li ul.'+curDir).slideDown(0, 'easeInOutSine');
		}
	
	});

	// Sticky Scroll
	
	
	
	// Quicksand
	
	$(document).ready(function() {

	  // get the action filter option item on page load
	  var $filterType = $('#portfolioCategories li.active a').attr('class');
		
	  // get and assign the ourHolder element to the
	  // $holder varible for use later
	  var $holder = $('ul.portfolioList');
	
	  // clone all items within the pre-assigned $holder element
	  var $data = $holder.clone();
	
	  // attempt to call Quicksand when a filter option
		// item is clicked
		$('#portfolioCategories li a').click(function(e) {
			// reset the active class on all the buttons
			$('#portfolioCategories li').removeClass('active');
			
			// assign the class of the clicked filter option
			// element to our $filterType variable
			var $filterType = $(this).attr('class');
			$(this).parent().addClass('active');
			
			if ($filterType == 'all') {
				// assign all li items to the $filteredData var when
				// the 'All' filter option is clicked
				var $filteredData = $data.find('li.portfolioItem');
			}
			else {
				// find all li elements that have our required $filterType
				// values for the data-type element
				var $filteredData = $data.find('li[data-type=' + $filterType + '], li[data-typetwo=' + $filterType + '], li[data-typethree=' + $filterType + ']');
			}
			
			// call quicksand and assign transition parameters
			$holder.quicksand($filteredData, {
				duration: 500,
				easing: 'easeInOutSine'
			});
			return false;
		});
	});

});
