$(function(){
    $(".submenu2").each(function(i){
        $(this).parent().children("a").append("<img src='images/menu-submenu-white.gif' width='5' height='6' border='0' style='margin-left:5px' />");
    });
    $("#addmenu li").hover(function(){
            if($(this).parent().attr("id") == "addmenu")
                switch ($(this).children("a").attr("id")) {
                    case "am_scenic":
                        $(this).children("a").css({backgroundPosition: "0px -37px"})
                        break;
                    case "am_activity":
                        $(this).children("a").css({backgroundPosition: "-91px -37px"})
                        break;
                    case "am_taylor":
                        $(this).children("a").css({backgroundPosition: "-182px -37px"})
                        break;
                    case "am_resorts":
                        $(this).children("a").css({backgroundPosition: "-273px -37px"})
                        break;
                    case "am_excursions":
                        $(this).children("a").css({backgroundPosition: "-364px -37px"})
                        break;
                    case "am_booking":
                        $(this).children("a").css({backgroundPosition: "-455px -37px"})
                        break;
                    default:
                        break;
                }
        $(this).children().filter(".submenu, .submenu2").fadeIn("fast");
        $(this).children().find("ul.submenu2").css({left:$(this).find(".submenu").width() +"px"});
        if($(this).parent(".submenu2")) $(this).parent(".submenu2").parent().children("a").css({"background-color":"#4e9ed9"});
    },
    function(){
        if($(this).parent().attr("id") == "addmenu")
                switch ($(this).children("a").attr("id")) {
                    case "am_scenic":
                        $(this).children("a").css({backgroundPosition: "0px 0px"})
                        break;
                    case "am_activity":
                        $(this).children("a").css({backgroundPosition: "-91px -0px"})
                        break;
                    case "am_taylor":
                        $(this).children("a").css({backgroundPosition: "-182px -0px"})
                        break;
                    case "am_resorts":
                        $(this).children("a").css({backgroundPosition: "-273px -0px"})
                        break;
                    case "am_excursions":
                        $(this).children("a").css({backgroundPosition: "-364px -0px"})
                        break;
                    case "am_booking":
                        $(this).children("a").css({backgroundPosition: "-455px -0px"})
                        break;
                    default:
                        break;
                }
        $(this).children().filter(".submenu, .submenu2").fadeOut("fast");
        if($(this).parent(".submenu2")) $(this).parent(".submenu2").parent().children("a").css({"background-color":""});
    }
);

		$(".submenu > li:first-child > a").css("border-top","0px");
		$(".submenu2 > li:first-child > a").css("border-top","0px");		
		$(".submenu > li:last-child > a").css("border-bottom","0px");
		$(".submenu2 > li:last-child > a").css("border-bottom","0px");
});
