function ContextMenu() {
		
	var zIndexNumber = 10000;
	$('#context-head ul.first li:has(ul)').each(function() {
		$(this).css('zIndex', zIndexNumber);
		zIndexNumber -= 10;
	});
		
	$('#context-head ul.first li:has(ul)').hover(
	    
		function() {
	        	
			var $ul = $(this).find('ul:first');
	        	
	        // Первый уровень
	        if($(this).parent('ul.first').get(0)) {
	        		
		        var $left = -142;
		        $(this).prevAll('li').each(function(){
		        	$left += $(this).width();
		        });
				$ul.css({left:$left,top:0}).show();
		           
			// Нижележащие уровни 
	        } else {
	        		
	        	var $top = -1;
		        $(this).prevAll('li').each(function(){
		        	$top += $(this).find("a").outerHeight();
		        });
	        	$ul.css({left:$(this).parent('ul:eq(0)').width(),top:$top}).show();
	        		
	        	if($ul.offset().left>$(window).width()-$(this).width()) $ul.css({left:-50,top:$top+20});
	        		
	        }
		},
	        
		function() { 
	        $(this).find('ul:first').hide();
		}
	        
	); 
	     
}

