var $j = jQuery.noConflict();

$j(document).ready(function(){

			// remove link background images since we're re-doing the hover interaction below 
            // (doing it this way retains the CSS default hover states for non-javascript-enabled browsers)
            // we also want to only remove the image on non-selected nav items, so this is a bit more complicated
            $j(".nav").children("li").each(function() {
                var current = "nav current-" + ($j(this).attr("class"));
                var parentClass = $j(".nav").attr("class");
                if (parentClass != current) {
                    $j(this).children("a").css({backgroundImage:"none"});
                }
            });	
    
    
            // create events for each nav item
            attachNavEvents(".nav", "p1");
			attachNavEvents(".nav", "p2");
			attachNavEvents(".nav", "p3");
			attachNavEvents(".nav", "p4");
			attachNavEvents(".nav", "p5");
			attachNavEvents(".nav", "p6");
			attachNavEvents(".nav", "p7");
			attachNavEvents(".nav", "p8");
			attachNavEvents(".logo");

        
    
            function attachNavEvents(parent, myClass) {
                
				$j(parent + " ." + myClass).mouseover(function() {
                    $j(this).append('<div class="nav-' + myClass + '"></div>');
                    $j("div.nav-" + myClass).css({display:"none"}).fadeIn(400);
                }).mouseout(function() {
                    $j("div.nav-" + myClass).fadeOut(200, function() {
                        $j(this).remove();
                    });
                }).mousedown(function() {
                    $j("div.nav-" + myClass).attr("class", "nav-" + myClass + "-click");
                }).mouseup(function() {
                    $j("div.nav-" + myClass + "-click").attr("class", "nav-" + myClass);
                });
            }
			
			
			$j(".leftnav a").not(".leftnav .selected a").hover(function() {
			  $j(this).stop().animate({paddingLeft: "12px"}, 400);
			}, function() {
			  $j(this).stop().animate({paddingLeft: "0px"}, 200);
			});
			

			
			$j(".logo").hover(function(){
			$j(this).stop().fadeTo(400, 0.7); // This should set the opacity to 100% on hover
			},function(){
			$j(this).stop().fadeTo(200, 1.0); // This should set the opacity back to 60% on mouseout
			});


    		$j( "#footer a.more").hover(function(){
			$j(this).stop().fadeTo(400, 0.7); // This should set the opacity to 100% on hover
			},function(){
			$j(this).stop().fadeTo(200, 1.0); // This should set the opacity back to 60% on mouseout
			});
        });