window.onload = initPage;

function dirname( path )
{
	var i = 1;
	while( path.substr( path.length - i, 1 ) != "/" ) {
		i ++;
	}

	if( i < path.length ) {
		return path.substr( 0, path.length - i );
	} else {
		return "";
	}
}

function initPage() {
	/* Hack for IE as it needs an explicit width on block <a>'s
	    and thinks 5 * 20 is > 100 

	    We also add an onresize handler to perform a min-height on
	    our main content area

	*/
	if( navigator.appName == "Microsoft Internet Explorer" ) {
		var sitenav = document.getElementById( "sitenav" );

		var listitems;

		listitems = sitenav.getElementsByTagName( "li" );

		var i;

		listitems[ 0 ].style.borderLeft="1px solid white";
		for( i = 0; i != listitems.length; ++ i ) {
			listitems[ i ].style.width="19%";
			listitems[ i ].firstChild.style.width="98%";
		}

		resizeHack();
		window.onresize = function() { resizeHack() };
	}

}

function resizeHack() {
		var main = document.getElementById( "main" );

		/* 75% min-height */
		var height = ( document.body.offsetHeight * 75 )/ 100;

		main.style.height=height + "px";
}
