function equalHeight(group) {
	tallest = 0;
	group.each(function() {
		thisHeight = $(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	group.height(tallest);
}

$(document).ready(function() {
	equalHeight($(".eqbox"));
	$('#nav>ul>li').each(function(i,item){
		var mover = false;
		var hideTimeout = 0;
		var elem = this;
		
		var clearHideTimeout = function(){
			if ( hideTimeout > 0 ){
				window.clearTimeout(hideTimeout);
			}
			hideTimeout = 0;
		}
		var setHideTimeout = function() {
			clearHideTimeout();
			hideTimeout = window.setTimeout(function(){
				$(elem).removeClass("hover");
			},300);
		};
		
		$(item).bind('mouseover', function(event){
			if (!mover) {
				clearHideTimeout();
				$('#nav>ul>li').removeClass("hover");
				$(this).addClass('hover');
				mover = true;
			}
		});
		$(item).bind('mouseout', function(event){
			if (mover) {
				setHideTimeout();
			}
			mover = false;
		});
		
		if ($.browser.msie && $.browser.version < 8 &&  $("ul",elem).length) {
			var w = $("ul",elem).outerWidth();
			var pl,pr;
			$("ul a", elem).each(function(){
				pl = parseInt($(this).css("paddingLeft")) || 0;
				pr = parseInt($(this).css("paddingRight")) || 0;
				$(this).css({width:(w-pl-pr)+'px'});
			});
			
		}
		
		
		var links = $('a', item);
		if (links.length) {
			links = links[0];
			$(links).bind('focus', function(event){
				$(item).addClass('hover');
			});
		}
	});
});

//Loads new portfolio galleries
function go() 
{
window.location=document.getElementById("menu").value;
}
