// fit to screen
(function(){
	var fitToScreen = function(){
		document.getElementById('content').style.minHeight = ((window.innerHeight || (document.documentElement && document.documentElement.clientHeight) || 0) - 180) + 'px';
	};
	window.onresize = fitToScreen;
	fitToScreen();
}());

// open external links in a new window
(function(){
	var a = document.getElementsByTagName('a'), i;
	for (i = 0; i < a.length; i++) {
		if (a[i].protocol === 'http:' && a[i].hostname !== location.hostname) {
			a[i].onclick = function(){
				open(this.href);
				return false;
			};
		}
	}
}());

// underline current page link in nav
(function(){
	var a = document.getElementById('navigation').getElementsByTagName('a'), i;
	for (i = 0; i < a.length; i++) {
		if (a[i].href.split(location.hostname)[1] === location.pathname) {
			a[i].className = 'active';
		}
	}
}());
