function dropDown(object) {
		if (hoverInd==1) {
				$(object).hide();
				$(object).show().find(".subnav").show().animate({ top:"0" },500,"easeOutExpo");
			};
}
var time = null;
function coolTimer(object) {
		clearTimeout(time);
		time = setTimeout( function(){
			dropDown(object)
		}, 750);
}
function subnavHide(object, subnavDisplay) {

		$(object).animate({
			top:"-155px"
		},250, "easeInExpo", function(){
			$(object).hide().parent().hide();
		});

}

function escapeOrder() {
	$("#order_form").hide();
		$("#shader").animate({
			opacity:0
		}, 500, "easeOutExpo", function(){
			$(this).hide();
	})
}


$(document).ready(function(){
	
	$("#top1").hover(function(){
		hoverInd=1;
		//timeOut(this);
		subnavHide ($(".subnav"));
		var $block = $(this).parent().find(".subnav_container");
		coolTimer($block);
	}, function(){
		hoverInd=0;
	});
	
	$("#top2").hover(function(){
		hoverInd=1;
		//timeOut(this);
		subnavHide ($(".subnav"));
		var $block = $(this).parent().find(".subnav_container");
		coolTimer($block);
	}, function(){
		hoverInd=0;
	});
	
	$("#top3").hover(function(){
		hoverInd=1;
		//timeOut(this);
		subnavHide ($(".subnav"));
		var $block = $(this).parent().find(".subnav_container");
		coolTimer($block);
	}, function(){
		hoverInd=0;
	});
	
	$("#top4").hover(function(){
		hoverInd=1;
		//timeOut(this);
		subnavHide ($(".subnav"));
		var $block = $(this).parent().find(".subnav_container");
		coolTimer($block);
	}, function(){
		hoverInd=0;
	});
	
	$("#top5").hover(function(){
		hoverInd=1;
		//timeOut(this);
		subnavHide ($(".subnav"));
		var $block = $(this).parent().find(".subnav_container");
		coolTimer($block);
	}, function(){
		hoverInd=0;
	});
	
	$("#top6").hover(function(){
		hoverInd=1;
		//timeOut(this);
		subnavHide ($(".subnav"));
		var $block = $(this).parent().find(".subnav_container");
		coolTimer($block);
	}, function(){
		hoverInd=0;
	});
	
	
	$(".subnav").hover(function(){
	}, function(){
		subnavHide(this);
	});
	
	$("#place_order").click(function(){
		$("#shader").css("opacity","0").show().animate({
			opacity:0.7
		}, 500, "easeInExpo", function(){
			$("#order_form").show();
			$("#order_form form input:first").focus();
		});
	});
	
	$("#escape_order").click(function(){
		escapeOrder();
	});
	
	$(document).keydown(function (e) {
 		if (e.keyCode == 27) {
			escapeOrder();
		}
	}); 
	
});
