// This script will fix the top navigation bar to the top of the browser window.
// A DIV with class "nav" is assumed.
function ect_fixed_topbar(){
	var stickyNavTop = document.getElementsByClassName("nav")[0].offsetTop;
	function stickyNav(){
		var scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
		if (scrollTop > stickyNavTop)
			ectaddclass(document.getElementsByClassName("nav")[0],'sticky');
		else
			ectremoveclass(document.getElementsByClassName("nav")[0],'sticky');
	}
	stickyNav();
	window.addEventListener('scroll', function () {
		if(window.scrollY > 20) ectaddclass(document.body,'scrolled'); else ectremoveclass(document.body,'scrolled');
		stickyNav();
	});
}
document.addEventListener("DOMContentLoaded",ect_fixed_topbar);