$(document).ready(function() {

	// Creates In-Field label effect on Login Form
	$("#loginForm label").inFieldLabels();

	/* Makes vertical scroll horizontal */
	$('html, body').mousewheel(function(event, delta) {
		this.scrollLeft -= (delta * 40);
		event.preventDefault();
	});

	/* Adds the Navigation effect to links */
	$(' .nav a, #subpageNav a').bind('click',function(event){
		event.preventDefault();
		var $anchor = $(this);
		$('html, body').stop().animate({
			scrollLeft: $($anchor.attr('href')).offset().left
		}, 1500,'easeInOutExpo');
	});
	
	/* Resizes to browser */
	function fitToBrowser() {
		if($(window).height() > $(".container").height()) {
			var marginTop = ($(window).height() - $(".container").height() - 50) / 2 ;
			$(".container").css('margin-top', marginTop);
		}
		if($(window).width() > 1024) {
			var width = $(window).width();
		} else {
			var width = 1024;
		}
		$("section").width(width);
		var numberOfPages = $("section").length;
		$("body").width(numberOfPages * width);
		$(".square").width(width/2).height($(window).height()/2+5);
	}
	fitToBrowser();
	$(window).resize(function() {
		fitToBrowser();
	});
	
	/* Fixes Width bug */
	fitToBrowser();
	
});

