function hide(input) {
    $(input).fadeOut(150);

    document.getElementById("topflash").style.zIndex = 300;

}

$(document).ready(function() {

    $("li").hover(
              function() {
				  try {
					  var item = getFirstUl(this);
					  
					  $(item).show();

					  
				  }catch(e){}

              },
              function() {
				   try {
					  var item = getFirstUl(this);
					  $(item).hide();
					}catch(e){}
              }
            );

    $(".menutop").hover(
                    function() {

                        $(this).css("background", "url(../img/menu_grey.gif) repeat-x");
						$(this).css("z-index", 500);
                    },

                    function() {
                        $(this).css("background", "url(../img/menu_red.gif) repeat-x");
						$(this).css("z-index", 5);
                    }
                );
	
});


function getFirstUl(element) {
    var col = element.childNodes;
    for (var i = 0; i < col.length; i++) {
        if (col[i].tagName == "UL") {
            return col[i];
        }
    }
}
