function iniNav() {
	var navarr=n_p.split('_');
	if (navarr.length==1) {		
	  jQuery("#nm_"+navarr[0]).addClass("s");
	  jQuery("#ns_"+navarr[0]).show();
	}
	if (navarr.length==2) {
	  jQuery("#nm_"+navarr[0]).addClass("s");
	  jQuery("#ns_"+navarr[0]).show();
	  aktivnavigation=navarr[0];
	  jQuery("#ns_"+navarr[0]+"_"+navarr[1]).addClass("s");
	}
}
function resNav() {
	 jQuery("ul.nm").children('li').removeClass("s");
	 jQuery("ul.ns").hide();
} 

function resiniNav(){       
	resNav();
	iniNav();	        
}
function tNav(fulltabid){   
	resNav();
	var tabid=fulltabid.split('_')[1];
	jQuery("#nm_"+tabid).addClass("s");
	jQuery("#ns_"+tabid).show();	
	aktivnavigation=tabid;	
}
var hTimer = null;
jQuery(document).ready(function($) {
	$("ul.nm").children('li').hover(
	      function (event) {  
   			 if(hTimer != null){
   				window.clearTimeout(hTimer);
   				hTimer = null;
   		     }   	    	 
   		     var currentid=this.id;
	    	 hTimer = window.setTimeout(function(){ tNav(currentid);}, 200);
	      }, 
	      function () {
			 if(hTimer != null){
				window.clearTimeout(hTimer);
				hTimer = null;
		     }       	      
	      }
	);		
	$("#ns").bind("mouseleave", function(e)	    
	{
	 if(hTimer != null){
		window.clearTimeout(hTimer);
		hTimer = null;
     } 		    
	 hTimer = window.setTimeout(function(){ resiniNav();}, 500);
	});	
	$("#ns").bind("mouseenter", function(e)	    
    {
		 if(hTimer != null){
			window.clearTimeout(hTimer);
			hTimer = null;
	     } 		    
    });	   	    
	$("#nm").bind("mouseleave", function(e)	    
    {
		 if(hTimer != null){
			window.clearTimeout(hTimer);
			hTimer = null;
	     } 		    
		hTimer = window.setTimeout(function(){ resiniNav();}, 500);
    });	 
});    

