$(document).ready(function(){
	$(document).pngFix(); 
//$(".subnav").width($(".subnav").parent().width());
	
	$("li.submenu a.top").each(function () {
		$(this).addClass("inactive");
		$(this).click(function(objEvent) {
			return(false);
		});
		
		
	});

	$(".submenu ul").each(function () {
		if(jQuery.browser.safari) {
			$(this).width($(this).parent().width());
		}
		else {
			$(this).width($(this).parent().width());
		}
	});
	
	
	//$(".flyout").hover(function () {
		//$(this).next("ul").show("slow").stop();
	//	$(this).stop().next("ul").animate({"height": "show"},{duration: "fast"});
	//}, function () {
	//	$(this).stop().next("ul").animate({"height": "hide"},{duration: "fast"});
	//});

  var toggle = function(direction, display, inClass) {
    return function() {
      var self = this;
      var ul = $("ul", this);
	 
      if( ul.css("display") == display && !self["block" + direction] ) {
	    $(this).find("a.top").removeClass("active");
	    $(this).find("a.top").removeClass("inactive");
	    $(this).find("a.top").addClass(inClass);
		$(this).toggleClass("noborder");
		$(this).next("li").toggleClass("noborder");
        self["block" + direction] = true;
        ul["slide" + direction]("fast", function() {
          self["block" + direction] = false;
        });
      }
    };
  }
  
  $(".submenu").hover(toggle("Down", "none", "active"), toggle("Up", "block", "inactive"));
  

	
	
});