
$(document).ready(
        function(){ 
        
            /* 
                Make first menu panel open
            */

	    $("#menupanels ul li ul").css("display", "block");
	
            $("#menupanels ul li ul#sub2").hide();
            $("#menupanels ul li ul#sub2").fadeTo("fast", 0.0); 

            $("#menupanels ul li ul#sub3").hide();
            $("#menupanels ul li ul#sub3").fadeTo("fast", 0.0);    			
            
            $("#menupanels ul li ul#sub1").show();
            $("#menupanels ul li ul#sub1").fadeTo("slow", 0.8);	

	  		           
            
			$("#menupanels ul li#share").hover(

			
                function(){
				
				    /*close other panels */
				    $("#menupanels ul li ul#sub2").hide();
                    $("#menupanels ul li ul#sub2").fadeTo("fast", 0.0); 

                    $("#menupanels ul li ul#sub3").hide();
                    $("#menupanels ul li ul#sub3").fadeTo("fast", 0.0);  
				
				
                    $("#menupanels ul li ul#sub1").show();
                    $("#menupanels ul li ul#sub1").fadeTo("slow", 0.8);					
				
                 
                    
                    //TODO: Need to identify (IE) the state of the selected tab 
                    // (is the menu visible - if so, exit without doing anything)
					
                    $(".selected a").fadeTo("slow",0.5);
                    $(".selected").fadeTo("slow",0.5);
                },
            
                function(){

                }
            )
		    
			
			$("#menupanels ul li#menu1").hover(

			
                function(){
				
				    /*close other panels */
				    $("#menupanels ul li ul#sub2").hide();
                    $("#menupanels ul li ul#sub2").fadeTo("fast", 0.0); 

                    $("#menupanels ul li ul#sub3").hide();
                    $("#menupanels ul li ul#sub3").fadeTo("fast", 0.0);  
				
                    $("#menupanels ul li ul#sub1").show();                    
                    $("#menupanels ul li ul#sub1").fadeTo("slow", 0.8);
                    
                    //TODO: Need to identify (IE) the state of the selected tab 
                    // (is the menu visible - if so, exit without doing anything)
					
                    $(".selected a").fadeTo("slow",0.5);
                    $(".selected").fadeTo("slow",0.5);
                },
            
                function(){

                  
                }
            )
			
			$("#menupanels ul li#menu3").hover(

			
                function(){
				
				    /*close other panels */
				    $("#menupanels ul li ul#sub1").hide();
                    $("#menupanels ul li ul#sub1").fadeTo("fast", 0.0); 

                    $("#menupanels ul li ul#sub2").hide();
                    $("#menupanels ul li ul#sub2").fadeTo("fast", 0.0);  
				
                    $("#menupanels ul li ul#sub3").show();                    
                    $("#menupanels ul li ul#sub3").fadeTo("slow", 0.8);
                    
                    //TODO: Need to identify (IE) the state of the selected tab 
                    // (is the menu visible - if so, exit without doing anything)
					
                    $(".selected a").fadeTo("slow",0.5);
                    $(".selected").fadeTo("slow",0.5);
                },
            
                function(){
                        
                }
            )
			
            /* Hide and show the opaque background when the menu is in focus */
            $("#menupanels ul li#menu2").hover(

			
                function(){
				
				    /*close other panels */
				    $("#menupanels ul li ul#sub1").hide();
                    $("#menupanels ul li ul#sub1").fadeTo("fast", 0.0); 

                    $("#menupanels ul li ul#sub3").hide();
                    $("#menupanels ul li ul#sub3").fadeTo("fast", 0.0);  
				
				    /* show panel */
                    $("#menupanels ul li ul#sub2").show();                    
                    $("#menupanels ul li ul#sub2").fadeTo("slow", 0.8);
                    
                    //TODO: Need to identify (IE) the state of the selected tab 
                    // (is the menu visible - if so, exit without doing anything)
					
                    $(".selected a").fadeTo("slow",0.5);
                    $(".selected").fadeTo("slow",0.5);
                },
            
                function(){
   
                }
           );
     
		$("#secondarynavnews li").hover(
		
			function(){
				$(this).css("background-color","#64379b");
			},
			
			function(){
				$(this).css("background-color","");
			}
		);

		$("#secondarynavcareers li").hover(
		
			function(){
				$(this).css("background-color","#64379b");
			},
			
			function(){
				$(this).css("background-color","");
			}
		);

		/* Default view */
		$("#consumer_tab .linkslist").css("display","block");
		$("#consumer_tab").css("background-color","#005293");
		$("#consumertab_link").css("color","#fff");
		$("#consumer_pointer").css("display","block");
		
			$(".menupanel_tab").hover(
				function(){
					$(this).css("background-color","#005293");
					$(this).find("a").css("color","#fff");
					$(this).find(".linkslist a").css("color","#000");
					$(this).find(".linkslist").css("display","block");					
					$(this).find(".bluepointer").css("display","block");
					$(this).css("cursor","hand");
					if($(this).attr('id') != "consumer_tab"){
						$("#consumer_tab").css("background-color","#CDCDCD");
						$("#consumertab_link").css("color","#000");						
						$("#consumer_pointer").css("display","none");
					}

				},
				
				function(){
					$(this).css("background-color","#CDCDCD");					
					$(this).find("a").css("color","#000");
					$(this).find(".linkslist").css("display","none");
					$(this).css("cursor","");
					$(this).find(".bluepointer").css("display","none");
					$("#consumer_tab .linkslist").css("display","block");
					$("#consumer_tab").css("background-color","#005293");
					$("#consumertab_link").css("color","#fff");
					$("#consumer_pointer").css("display","block");
				}
			);
				$(".linkslist li").hover(
					function(){				
						$(this).find(".popup_preview").css("display","block");
						//$(this).find(".popup_preview").css("border","solid 1px #000");
					},
					function(){						
						$(this).find(".popup_preview").css("display","none");
						//$(this).find(".popup_preview").css("border","none");
					}
				);			
    });