var cancelHide;
$(document).ready(function(){
	/* se obtiene el submenu mas grande y se igualan todos los demas */
	maxHeight = $('#subNav').height();
	if(maxHeight < 200) maxHeight = 200;
	$('#menuVelo').height(maxHeight);
	$('#subNav ul').height(maxHeight);

	/* controla el estado de hover desde el menu principal */
	$('#topNav li a').hover(
		function(){
			submenu = $(this).attr('rel');
			$(this).addClass('hover');
			$('#'+submenu).addClass('hover');
			cancelHide = true;
			$('#menuVelo').show();
			$('#subNav').show();
			
		},
		function(){
		  	cancelHide = false;
			submenu = $(this).attr('rel');
			$(this).removeClass('hover');
			$('#'+submenu).removeClass('hover');
			
			setTimeout(function() {
				if (!cancelHide) {
					$('#subNav').hide();
					$('#menuVelo').hide();
				}
			}, 500);
			
		}
	);
	
	/* controla el estado de hover de todo el menu desde los menus secundarios */
	$('#subNav ul').hover(
		function(){
			mtopNav = $(this).attr('rel');
			$(this).addClass('hover');
			$('#topNav li:eq('+mtopNav+') a').addClass('hover');
			
			cancelHide = true;
		},
		function(){
			mtopNav = $(this).attr('rel');
		  	$(this).removeClass('hover');
			$('#topNav li:eq('+mtopNav+') a').removeClass('hover');
			
			cancelHide = false;
			setTimeout(function() {
				if (!cancelHide) {
					$('#subNav').hide();
					$('#menuVelo').hide();
				}
			}, 500);
		}
	);
	
$("#seleccionPais").bind("change", function(){											  
			$(".fPais").submit();								  
});

	$(".download_usr").bind("click", function(){											  
		alert("Para realizar esta descarga debe estar registrado");
		return false;							  
	});
	
	
});