var timer = null;

$(document).ready(function() {

	if(typeof(window.innerWidth) == 'number' && typeof(window.innerHeight) == 'number' && typeof(window.outerWidth) == 'number' && typeof(window.outerHeight) == 'number') {
		/* Resize all except IE */
		window.resizeTo(window.outerWidth, 500+(window.outerHeight-window.innerHeight));
	}
	
	$(".submenu-item").hide();
	
	$(".menu").mouseover(function() {
		$("#"+this.id+" img").attr("src", "static/img/"+this.id+"-on.gif");
		$(".submenu-item").hide();
		$("#sub"+this.id).show();
		clearTimeout(timer);
	});
	
	$(".submenu-item").mouseover(function() {
		$(this.id).show();
		clearTimeout(timer);
	});
	
	$(".menu").mouseout(function() {
		$("#"+this.id+" img").attr("src", "static/img/"+this.id+"-off.gif");
	});
	
	$(".menu, .submenu-item").mouseout(function() {
		timer = setTimeout("restoreMenu()", 500);
	});
	
	$(".menu").click(function() {
		if(this.id == "menu-4") {
			location.href = "team/";
		}
	});
	
});

function restoreMenu() {
	$(".submenu-item").hide();
}

function _innerWidth() {
	var innerWidth = 0;
	if(typeof(window.innerWidth) == 'number') {
		/* Capable browsers */
		innerWidth = window.innerWidth;
	} else if(document.documentElement && document.documentElement.clientWidth) {
		/* IE 6+ in 'standards compliant mode */
		innerWidth = document.documentElement.clientWidth;
	} else if(document.body && document.body.clientWidth) {
		/* IE 4 compatible */
		innerWidth = document.body.clientWidth;
	}
	return innerWidth;
}

function _innerHeight() {
	var innerHeight = 0;
	if(typeof(window.innerHeight) == 'number') {
		/* Capable browsers */
		innerHeight = window.innerHeight;
	} else if(document.documentElement && document.documentElement.clientHeight) {
		/* IE 6+ in 'standards compliant mode */
		innerHeight = document.documentElement.clientHeight;
	} else if(document.body && document.body.clientHeight) {
		/* IE 4 compatible */
		innerHeight = document.body.clientHeight;
	}
	return innerHeight;
}

function _outerWidth() {
	var outerWidth = 0;
	if(typeof(window.outerWidth) == 'number') {
		/* Capable browsers */
		outerWidth = window.outerWidth;
	} else if(document.documentElement && document.documentElement.clientWidth) {
		/* IE 6+ in 'standards compliant mode */
		outerWidth = document.documentElement.clientWidth+35;
	} else if(document.body && document.body.clientWidth) {
		/* IE 4 compatible */
		outerWidth = document.body.clientWidth+35;
	}
	return outerWidth;
}

function _outerHeight() {
	var outerHeight = 0;
	if(typeof(window.outerHeight) == 'number') {
		/* Capable browsers */
		outerHeight = window.outerHeight;
	} else if(document.documentElement && document.documentElement.clientHeight) {
		/* IE 6+ in 'standards compliant mode */
		outerHeight = document.documentElement.clientHeight+150;
	} else if(document.body && document.body.clientHeight) {
		/* IE 4 compatible */
		outerHeight = document.body.clientHeight+150;
	}
	return outerHeight;
}
