$(function(){
		   
	$("ul#navmenu").show();
		   
	
	//fix para FF:
	if($.browser.mozilla) $("ul#navmenu").addClass("navmenuFF");
	//if($.browser.safari) $(".menuHItem").css("display", "inline-block");
		
	//submenus (IE z-index fix):
	if($.browser.msie){
		$('#navmenu ul li').css("position", "relative");
		var zIndexNumber = 8000;
		$('#navmenu ul li').each(function() {
			$(this).css('z-index', zIndexNumber);
			zIndexNumber -= 1;
		});
		
		navHover();
	}
	
	$("#navmenu li.active a.menuHItem").addClass("active");
																
	$('#navmenu li a.menuHItem').each(function(){
		mainBts = $(this).parent().parent().children("li");
		mainBtsNumber = mainBts.length -1;
		
		//first button:
		$(this).parent().parent().children("li:eq(0)").addClass("first").addClass("iehoverfirst");
																			
		//last button:
		$(this).parent().parent().children("li:eq("+mainBtsNumber+")").addClass("last").addClass("iehoverlast");
	});
	
	
	//transvNav:
	$("#transvNav .clickable").each(function(){
		$(this).hover(	
			function(){
				$(this).addClass("clicked");
				//fix para IE7, que mantinha os botões do menu activos:
				if($.browser.msie) $(".menuCover").show();
				
				//no caso do login há duas hipóteses:
				if($(this).attr('id').indexOf('tNav_portal')<0){
					$(".transNavBox", this).show();
				} else {
					//se estiver logado:
					if($(this).attr('class').indexOf('logged')>0){
						$(".portalBoxLogged", this).show();
					} else {
						$(".portalBoxLogin", this).show();
					}
				}
			},
			function(){
				$(".menuCover").hide();
				$(this).removeClass("clicked");
				$(".transNavBox", this).hide();
			});
	});
	
	//home training + news:
	$("#btTraining").click(function(){
		//remove a class da outra tab:
		$("#btNews").removeClass("active");
		$(this).addClass("active");
		//mostra o bloco e esconde o outro:
		$("#homeNews").hide();
		$("#homeTraining").animate({opacity: "show"});
	  });
	
	$("#btNews").click(function(){
		//remove a class da outra tab:
		$("#btTraining").removeClass("active");
		$(this).addClass("active");
		$("#homeTraining").hide();
		$("#homeNews").animate({opacity: "show"});
	 });
	
	//button highlight:
	$(".highlightsBt").css("cursor", "pointer").toggle(function(){
			$(this).addClass("highlightsBtClose");
			$(".highlightsBox2").show();
	},
	function(){
			$(this).removeClass("highlightsBtClose");
			$(".highlightsBox2").hide();
	});
})

navHover = function() {
	var lis = document.getElementById("navmenu").getElementsByTagName("LI");
	for (var i=0; i<lis.length; i++) {
		lis[i].onmouseover=function() {
			if(this.className.indexOf('active')<0) this.className+=" iehover";
			if(this.className.indexOf('active')<0 && this.className.indexOf('last')>=0) this.className+=" iehoverlasthover";
		}
		lis[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" iehover\\b"), "");
			this.className=this.className.replace(new RegExp(" iehoverlasthover\\b"), "");
		}
	}
}