$(document).ready(function(){

		// Scroll to top
		(function scrollToTop() {
				$.localScroll({
						duration: 500,
						hash: true
				});
		})();

		// Extend Main Content to length of sidebar if shorter than
		(function addMinHeight() {

				var aHeight = $("aside").height(),
						mcHeight = $("#main-content").height();

				if (mcHeight < aHeight) {
						$("#main-content").height(aHeight + 68);
				}

		})();

		// Portfolio Slideshow functionality
		(function slideshow() {
		
				$(".slideshow-controls").css({ opacity: 0 });

				var arr = $.makeArray(document.getElementsByTagName("article"));

				$.each(arr, function() {
				
						$("#" + this.id + " .slideshow-controls").hover(
								function() {
										$(this).fadeTo(500, 1.0);
								},
								function() {
										$(this).fadeTo(500, 0.0);
								}
						);

						$("#" + this.id + " .slideshow-images").cycle({
								fx:     'fade',
								speed:   500,
								timeout: 0,
								next:   '#' + $(this).attr("id") + ' .next',
								prev:   '#' + $(this).attr("id") + ' .prev'
						});

				});

		})();

});