jQuery().ready(function(){
	
	jQuery('#menu3').Accordion({
		active: '.selected',
		alwaysOpen: false,
		header: '.head',
		navigation: true,
		event: 'click',
		autoheight: true,
		animated: 'easeslide'
	});
	
	jQuery('#menu4').Accordion({
		active: '.selected',
		alwaysOpen: false,
		header: '.head',
		navigation: true,
		event: 'click',
		autoheight: true,
		animated: 'easeslide'
	});

	$(document).ready(function() {
	
		var obj = null;
		
		$("#floating_menu").corner("6px");
		
		$("a.media").media({width:650, height:600});
		
		$("#searchfield").keyup(function() {
			
			$("span.name").removeClass("hilite");
			var term = $(this).attr("value");
			if(term.length > 2)
			{
				$("span.name:contains('" + term + ")").addClass("hilite");
			}
				
		});
		
		var current = $("#menu2").find("a").filter(function() { return this.href == location.href; });
		current.addClass("current");
		
		$("#menu2 li").hover(
			
			function(){ 
				$(this).children("ul").show();
			 }, 
			function(){ 
				$(this).children("ul").hide(); 
			} 
		);

		$('#menu3 > li > ul > li').hover(function() {
			if (obj) {
				obj.find('ul').fadeOut('slow');
				obj = null;
			} //if
			
			$(this).find('ul').fadeIn('slow');
		}, function() {
			obj = $(this);
			setTimeout(
				"checkHover()",
				400);
		});
		
		$('#menu4 > li > ul > li').hover(function() {
			if (obj) {
				obj.find('ul').fadeOut('slow');
				obj = null;
			} //if
			
			$(this).find('ul').fadeIn('slow');
		}, function() {
			obj = $(this);
			setTimeout(
				"checkHover()",
				400);
		});
		
		function checkHover() {
			if (obj) {
				obj.find('ul').fadeOut('fast');	
			} //if
		} //checkHover

		
	});
	
	$.fn.hoverClass = function(c) {
		return this.each(function(){
			$(this).hover( 
				function() { $(this).addClass(c);  },
				function() { $(this).removeClass(c); }
			);
		});

	};
	
});
