	var menu_active = false;

      		
	function hideMenu() {
		if(!menu_active) {
			$().find('#subnavi').hide();
		}
	}
	
	$(document).ready(function() {

		$().find('.has_submenu').each(function() {
      			$(this).bind("click mouseenter", function(event) {
      				$().find('#subnavi').show();
					
					menu_active = true;
					
      				sIFR.replace(the_sans, {
						selector: '.thesans_navi',
						css: ['.sIFR-root { color: #ffffff;}',
							'a { text-decoration: none }',
							'a:link { color: #ffffff }',
							'a:hover { color: #ffffff }'],
						wmode: 'transparent'
						});

      				event.preventDefault();

      			});
      			
      			$(this).bind("mouseleave", function(event) {
      				menu_active = false;
      				window.setTimeout("hideMenu()", 300);
      			});
      			
      	});
      	
      	$().find('#subnavi').each(function() {
      		$(this).bind("mouseenter", function(event) {
      			menu_active = true;
      		});

      		$(this).bind("mouseleave", function(event) {
      			menu_active = false;
      			window.setTimeout("hideMenu()", 300);

      		}); 
      	});
      		

      	
	});
