//SLIDESHOW

$(document).ready(function() {	 
	$('#slideshow').cycle({
        fx: 'fade', // type of effect
        timeout: 6000, // time between auto change
        //prev: '#prev-slide',//prev button
       //next: '#next-slide',//next button
        //pager: '#slidernav' //ul container for dots
        //pagerAnchorBuilder: pagerFactory // function to call for page dots
    });

    function pagerFactory(idx, slide) {
        var s = idx > 2 ? ' style="display:none"' : '';
        return '<li' + s + '><a href="#"></a></li>'; // markup for li dots
    };
});

//TWITTER

$(document).ready(function() {
				$("#twitter").getTwitter({
					userName: "designsheffield",
					numTweets: 2,
					loaderText: "Loading tweets...",
					slideIn: true,
					slideDuration: 100,
					showHeading: true,
					headingText: "",
					//showProfileLink: true,
					showTimestamp: true	
				});			
});

//QUICKSAND

$(document).ready(function() {

  // get the action filter option item on page load
  var $filterType = $('.filter li.active a').attr('class');
	
  // get and assign the ourHolder element to the
	// $holder varible for use later
  var $holder = $('ul.projects');

  // clone all items within the pre-assigned $holder element
  var $data = $holder.clone();

  // attempt to call Quicksand when a filter option
	// item is clicked
	$('.filter li a').click(function(e) {
		// reset the active class on all the buttons
		$('.filter 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');
		} 
		else {
			// find all li elements that have our required $filterType
			// values for the data-type element
			var $filteredData = $data.find('li[data-type~=' + $filterType + ']');
		}
		
		// call quicksand and assign transition parameters
		$holder.quicksand($filteredData, {
			easing: 'easeInOutSine',
		});
		return false;
	});
});




