var oTimeout1 = null;
var oTimeout2 = null;
var oTimeout3 = null;

$(function() {

	$("div#btn_large_green").mouseover( function() {
		clearTimeout(oTimeout1);
		oTimeout1 = setTimeout('$("div#btn_large_green").find("div.search_menu").show()', 600);
	}).mouseout( function() {
		clearTimeout(oTimeout1);
		oTimeout1 = setTimeout('$("div#btn_large_green").find("div.search_menu").hide();$("div#btn_large_green").find("div.search_menu_sub").hide()', 300);
	});
	
	$("div#btn_large_brown").mouseover( function() {
		clearTimeout(oTimeout2);
		oTimeout2 = setTimeout('$("div#btn_large_brown").find("div.search_menu").show()', 600);
	}).mouseout( function() {
		clearTimeout(oTimeout2);
		oTimeout2 = setTimeout('$("div#btn_large_brown").find("div.search_menu").hide();$("div#btn_large_brown").find("div.search_menu_sub").hide()', 300);
	});
	
	$("div#btn_large_red").mouseover( function() {
		clearTimeout(oTimeout3);
		oTimeout3 = setTimeout('$("div#btn_large_red").find("div.search_menu").show()', 600);
	}).mouseout( function() {
		clearTimeout(oTimeout3);
		oTimeout3 = setTimeout('$("div#btn_large_red").find("div.search_menu").hide();$("div#btn_large_red").find("div.search_menu_sub").hide()', 300);
	});
	
	$("div.search_menu table.do_action td").mouseover( function() {
		var id = $(this).attr("rel");
		$(this).addClass("hover");
		$("div#search_menu_sub_"+id).show();
	}).mouseout( function() {
		var id = $(this).attr("rel");
		$(this).removeClass("hover");
		$("div.search_menu_sub").hide();
	});
	
	$("div.search_menu_sub table.menu_items td").hover( function() {
		$(this).addClass("hover");
	}, function() {
		$(this).removeClass("hover");
	});
	
	$("div.search_menu table.menu_items td").click( function() {
		var url = $(this).find("a").attr("href");
		document.location.href = url;
	});
	
	$("div.search_menu div.search_menu_sub").each( function(i) {
		var top = ($(this).attr("rel") * 17) - 17;
		$(this).css("top", top+"px");
		
		$(this).mouseover( function() {
			$(this).show();
		});
	});
	
});
