var indx = -1;
var t;
$(function() {
	
	
	$('#menu li').hover(function() {
		
		var curRel = $('a', $(this)).attr('rel');
		indx = $(this).index();
		
		if (curRel) {
			
			$('#' + curRel).show();
			
		}
								 
	},
	function() {
				 
		var curRel = $('a', $(this)).attr('rel');
		indx = $(this).index();
		
		if (curRel) {
			
			t = setTimeout( function() {
								 
				$('#' + curRel).hide();
				
			}, 1000 );
			
		}
			
	});
	
	$('section.top_dropmenu').hover(function() {
		
		$('#menu li').eq(indx).addClass('active');
		clearTimeout(t);
		
	},
	function() {
		
		$('#menu li').removeClass('active');
		$(this).hide();
		
	});
	
	
	
});

