/*
Changes the #header div from fixed to static when the window height gets too small so all the nav
can still be seen.
*/
var $m = jQuery; 
$m(document).ready(function() {

	/*sliding navigation bar when window is resized*/
	function stickyStart() {
		var sidenavHeight = $m("#header").height();
		var winHeight = document.documentElement.clientHeight;
		
		$m("#header").css({'top' : '0'});
		
		if(sidenavHeight > winHeight) {
			$m("#header").css({'top' : '-170px'});
		}
	}
	
	function stickySlide() {
		var sidenavHeight = $m("#header").height();
		var winHeight = document.documentElement.clientHeight;
		
		$m("#header").stop().animate({top: '0'}, 1000);
		
		if(sidenavHeight > winHeight) {
			$m("#header").stop().animate({top: '-170px'}, 1000);
		}
	}
	
	stickyStart();
	
	$m(window).resize(function () {
		stickySlide();
	});
	
	/* automatically set link email on board of directors page*/
	var currentEmail = $m(".bio-email a").html();
	$m(".bio-email a").attr("href", "mailto:"+currentEmail);
});
