function hidesubmenus() 
    {
	$('.submenu').fadeOut(200);
	} 

 $(document).ready(function()
   {
   
   $('.slidetabs a').click(function()
   {
   $target=$(this);
   $('.slidetabs .active').removeClass('active');
   $target.addClass('active');
   $target=$('#' + $target.attr('rel'));
   if ($target.hasClass('slide-active')) {return false;}
   $('.slide-active').fadeOut().removeClass('slide-active');
   $target.fadeIn().addClass('slide-active');
   return false;
   });
   
   $('.navigation a').click(function()
   {
   var $button=$(this);
   var pagescope=$(this).parent().attr('id');
   if ($(this).hasClass('next')) {
        $target=$('.'+pagescope+' .textpage-active').next(); 
		if ($target.length==0) {return false;}
		$button=$('#'+pagescope +' a.active').next();
		}
   else if ($(this).hasClass('prev')) {
       $target=$('.'+pagescope+' .textpage-active').prev();
	   if ($target.length==0) {return false;}
	   $button=$('#'+pagescope +' a.active').prev();
	   }
   else {$target=$('.'+pagescope + ' .' + $(this).attr('rel'));}
   $('.'+pagescope+' .textpage-active').show().fadeOut().removeClass('textpage-active');
   $target.addClass('textpage-active').hide().fadeIn();
   $('#'+pagescope +' a').removeClass('active');
   $button.addClass('active');
   return false;
  });
   
   $('.menuitem .label').mouseover(function()
   {
   clearTimeout($submenuhide);
   var $target = $(this).parent().find('.submenu');
   $('.submenu').removeClass('submenu-current').hide();
   $target.addClass('submenu-current').fadeIn(200);
   });
   
   $('.submenu .submenu-titlewrap').mouseout(function()
   {
   $submenuhide=setTimeout('hidesubmenus();',50); 
   });
   
   $('.submenu .box').mouseout(function()
   {
   $submenuhide=setTimeout('hidesubmenus();',50); 
   });
   
   $('.submenu .submenu-titlewrap').mouseover(function()
   {
   clearTimeout($submenuhide); 
   });
   
   $('.submenu .box').mouseover(function()
   {
   clearTimeout($submenuhide);  
   });  
   
   var $submenuhide=setTimeout('hidesubmenus();',50);
   });
