jQuery(document).ready(function(){
																
	var $sidebar   = jQuery("#social"),
			$window    = jQuery(window),
			offset     = $sidebar.offset(),
			topPadding = 15;

	$window.scroll(function() {
			if ($window.scrollTop() > offset.top) {
					$sidebar.stop().animate({
							marginTop: $window.scrollTop() - offset.top + topPadding
					});
			} else {
					$sidebar.stop().animate({
							marginTop: 0
					});
			}
	});
	
	function whitehoverIn() {
		jQuery(this).find('.whitehover').stop().animate({
    		opacity: 1
		}, 300);
		jQuery(this).siblings('.description').css({ 'opacity': 0, 'display': 'block' }).stop().animate({
    		opacity: 1
		}, 300);
	}
	
	function whitehoverOut() {
		jQuery(this).find('.whitehover').stop().animate({
    		opacity: 0
		}, 300);
		jQuery(this).siblings('.description').stop().animate({
    		opacity: 0
		}, 300, function() {
			jQuery(this).css('display','none');
		});
	}
	
	jQuery('.thumb').hover(whitehoverIn, whitehoverOut);
	jQuery('.whitehover').css({ opacity: 0 });
	
	
	function logoOut() {
		jQuery(this).find('img').stop().animate({
    		opacity: 0
		}, 250);
	}
	
	function logoIn() {
		jQuery(this).find('img').stop().animate({
    		opacity: 1
		}, 500);
	}
	
	jQuery('#logo').hover(logoOut, logoIn);
	
	
	// Slides
	
	// Set starting slide to 1
	var startSlide = 1;
	// Get slide number if it exists
	
	// Initialize Slides
	jQuery('#slides').slides({
		preload: true,
		preloadImage: 'img/loading.gif',
		generatePagination: true,
		autoHeight: true,
		// Get the starting slide
		start: startSlide,
		animationComplete: function(current){
			// Set the slide number as a hash
			// window.location.hash = '#' + current;
		}
	});
	
	jQuery('.link').click(function(){
		var link = jQuery(this).attr('href').replace('#','');
		jQuery('#slides .pagination li:eq(' + (link - 1) + ') a').click();
		jQuery(this).parent('li').siblings().find('a.current').removeClass('current');
		jQuery(this).addClass('current');
		return false;
	});
	
	jQuery('.sidebar-box').stop().animate({ opacity: 0.5 }, 1000);
	
	jQuery('.sidebar-box').hover(function() {
		jQuery(this).stop().animate({ opacity: 1 }, 500);
	}, function() {
		jQuery(this).stop().animate({ opacity: 0.5 }, 1000);
	});
	
	setTimeout( function() {
		jQuery('.twitter-share-button').fadeIn(1000);
	}, 1000 );
	
});
