jQuery(document).ready(function () {

	function onAfter(curr, next, opts, fwd){
        //get the height of the current slide
        var $ht = $(this).height();
        //set the container's height to that of the current slide
        $(this).parent().css("height", $ht);
	}


	jQuery('#project').cycle({
	   timeout:5000
	 });
	
	jQuery('#screenshots').before('<div id="controller">').cycle({ 
    	fx:     'fade', 
    	speed:  'slow', 
    	timeout: 0, 
    	pager:  '#controller',
    	after:   onAfter,
    	next:   '#next2', 
    	prev:   '#prev2' 
	});
		  
	
	jQuery(".toTop").scrollToTop({
   		speed: "slow"
	});
	
	jQuery('.next').click(function() {

   	var elementClicked = jQuery(this).attr("href");

   	var destination = jQuery(elementClicked).offset().top;
   	
   	jQuery("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination-30}, 700 );
   	return false;
	});
	
	
});