$(document).ready( function() {
	hideNavMenu();
	$('#navContain').mouseenter( function() { showNavMenu(); } );
	$('#navContain').mouseleave( function() { hideNavMenu(); } );
});

function getImgSize( imgSrc ) {
	var i = new Image();
	var dim=new Array();

	i.src = imgSrc;

	dim = [ i.width, i.height ];

	if ( dim[0] == 0 || dim[1] == 0 ) return [ 500, 750 ];

	return dim;
}

function showNavMenu() {
	$('#navMenu > a').show();	
}

function hideNavMenu() {
	curPath = window.location.pathname.substr(1);
	if (curPath=='') return;	// don't strip anything if we're on the welcome page
	$('#navMenu > a > img[id="'+curPath+'"]').prependTo($('#navMenu'));
	$('#navMenu > a').hide();
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		do {
			curleft += parseInt(obj.offsetLeft);
			curtop += parseInt(obj.offsetTop);
		} while (obj = obj.offsetParent);
		return [curleft,curtop];
	}
	return [0,0];
}

