$(document).ready(function() {

	/* function to scroll pages and to add a hashtag for unique URLs */
	$('#nav li a[href*=#]').live('click', function() {
		$.bbq.pushState( '#/' + this.hash.slice(1) );
		return false;
	});
	$(window).bind('hashchange', function(event) {
		if (location.hash) {
		var tgt = location.hash.replace(/#\//,'');
	} else {
		var tgt = '#top';
	}
	$.smoothScroll({scrollTarget: '#' + tgt});
	});
	$(window).trigger('hashchange');

	/* function to remove and add the active class on the navigation links to activate the active state on window height */
	$(window).scroll(function() {    
    	$("#nav a.active").removeClass("active");
    	var scroll = $(window).scrollTop();
	if (scroll <= 1) {
        $("#active-home").addClass("active");
	}
	else if (scroll <= 1500) {
        $("#active-oot").addClass("active");
	}
	else if (scroll <= 3000) {
        $("#active-puck").addClass("active");
	}
	else if (scroll <= 4500) {
        $("#active-regels").addClass("active");
	}
	/* not relevant now
	else {
        $("#").addClass("active");
	}
	*/
	});
	
});
