$(document).ready(function() {

$("sup").each(function() {
    $(this).replaceWith("<span class='supReplace'>" + $(this).text() + "</span>");
});
	


    $("ul#agpNavigation > li.Active").css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) no-repeat left top");
    $("ul#agpNavigation > li.Active a:first").css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) repeat-x right -26px");
    $("ul#agpNavigation > li.Active a:first span").css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) no-repeat right -52px");

    $("ul#agpNavigation > li").hover(
		function() {
		    $(this).css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) no-repeat left top");
		    $(this).find("a:first").css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) repeat-x right -26px");
		    $(this).find("span:first").css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) no-repeat right -52px");
		    $(this).find("ul:first").slideDown();
		},
		function() {
		    if ($(this).hasClass("Active"))
		    { }
		    else {
		        $(this).css("background", "none");
		        $(this).find("a:first").css("background", "none");
		        $(this).find("span:first").css("background", "none");
		    }

		    $(this).find("ul:first").slideUp("fast");
		}
	);


    $("ul#agpNavigation li").find("ul").find("li:first").find("span").css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) no-repeat right -52px");
    //$("ul#agpNavigation li ul li:first span").css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) no-repeat right -52px");

    $("ul#agpNavigation li").find("ul").find("li:last").css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) no-repeat left -78px");
    //$("ul#agpNavigation li ul li:last").css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) no-repeat left -78px");

    $("ul#agpNavigation li").find("ul").find("li:last").find("span").css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) no-repeat right -129px");
    //$("ul#agpNavigation li ul li:last span").css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) no-repeat right -129px");

    $("ul#agpNavigation li").find("ul").find("li:last").find("a").css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) repeat-x right -104px");
    //$("ul#agpNavigation li ul li:last a").css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) repeat-x right -104px");



    $("ul#agpNavigation li").find("ul").find("li").not(":first").not(":last").hover(
		function() {
		    $(this).css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) no-repeat left -234px");
		    $(this).find("a:first").css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) repeat-x left -234px");
		    $(this).find("span").css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) no-repeat right -234px");
		},
		function() {
		    $(this).css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) no-repeat left -26px");
		    $(this).find("a:first").css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) repeat-x left -26px");
		    $(this).find("span").css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) no-repeat right -26px");
		}
	);

    $("ul#agpNavigation li").find("ul").find("li:first").hover(
		function() {
		    $(this).css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) no-repeat left -234px");
		    $(this).find("a:first").css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) repeat-x left -234px");
		    $(this).find("span:first").css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) no-repeat right -260px");
		},
		function() {
		    $(this).css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) no-repeat left -26px");
		    $(this).find("a:first").css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) repeat-x left -26px");
		    $(this).find("span:first").css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) no-repeat right -52px");
		}
	);

    $("ul#agpNavigation li").find("ul").find("li:last").hover(
		function() {
		    $(this).css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) no-repeat left -156px");
		    $(this).find("a:first").css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) repeat-x left -182px");
		    $(this).find("span:first").css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) no-repeat right -207px");
		},
		function() {
		    $(this).css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) no-repeat left -78px");
		    $(this).find("a:first").css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) repeat-x left -104px");
		    $(this).find("span:first").css("background", "url(/App_Themes/AppleGrowthPartners/images/Navigation_SPRITE.png) no-repeat right -129px");
		}
	);

    $("#agpNavigation li").click(function(e) {
        var des = $(e.target).find("a:first").attr("href");
        window.location = des;
    });

    if ($.browser.msie && $.browser.version.substr(0, 1) < 8) {
        $("ul#agpNavigation li > ul > li").css({ "width": "225px" })
    }

});
