﻿///<reference path="jquery-1.2.6-vsdoc.js"/>
	
//Starts when DOM is ready
$(function(){
		    
	//For each Quick Launch navigation sub menu: 
	$("table.ms-navSubMenu2").each(function(){
	
		//Find any navigation items under the sub menu that have been selected.
		var selectedNavItems = $(this).find("a.hydro-selectednav");
		
		//Find the corresponding navigation header of the current sub menu being processed
		var menuHeader = $(this).parents("tr:eq(0)").prev("tr").find("table.hydro-selectednavheader:eq(0)");  
		//alert(selectedNavItems);      	
	    
		if ($(menuHeader).hasClass("hydro-selectednavheader") || selectedNavItems.length > 0) 
		{
			$(this).show();
			
			$("table.ms-navSubMenu3").each(function(){	
				if($(this).parents("tr:eq(0)").prev("tr").children("td > table").find(".hydro-selectednav").hasClass("hydro-selectednav"))
				{
					$(this).parents("tr:eq(0)").show();
				}
				else
				{
				   	$(this).parents("tr:eq(0)").hide();	
				}		    
			 });
			
		}
		else
		{ 
			//otherwise, hide the submenu
			$(this).parents("tr:eq(0)").hide();				
		}	
					  
		$("table.hydro-selectednav1").parents("table.ms-navSubMenu3:eq(0)").parents("tr:eq(0)").show();//.html());
		$("table.hydro-selectednav1").parents("table.ms-navSubMenu3:eq(0)").parents("tr:eq(0)").prev("tr:eq(0)").parents("tr:eq(0)").show();
		$("table.hydro-selectednav1").parents("table.ms-navSubMenu3:eq(0)").parents("tr:eq(0)").siblings().find("table.ms-navSubMenu3").parents("tr:eq(0)").hide();
		
		$("table.hydro-selectednav1").parents("table.ms-navSubMenu3:eq(0)").parents("tr:eq(0)").siblings().each(function(){
			$(this).find("table.ms-navSubMenu3").parents("tr:eq(0)").hide();
		});

		
		
//		$("table.hydro-selectednav1").parents("table.ms-navSubMenu3:eq(0)").parents("tr:eq(0)").prev("tr:eq(0)").parents("tr:eq(0)").prev("tr:eq(0)").show();
//		$("table.hydro-selectednav1").parents("table.ms-navSubMenu3:eq(0)").parents("tr:eq(0)").prev("tr:eq(0)").siblings(".ms-navSubMenu3").html();

		
	});
    		
    //When a user clicks a navigation header, the user should be taken directly
    //to the site link. The javascript event handler to hide/display the submenus
    //should not be triggered.
   	$("a.ms-navheader").click(function(e){

    	e.stopPropagation();
    });

  	

	//When the user hovers over the navigation header, it would be nice
	//to have an indicator that they can click on the header. Usually,
	//browsers use the hand icon to indicate clickable items.
    $("table.ms-navheader").hover(function(e){
        $(this).css("cursor", "hand");
    }, function(e){
        $(this).css("cursor", "default");
    });

    //Finally, this adds a click event handler for the navigation header table
/*
    $("table.ms-navheader").click(function(e)
    {		    
        var subMenu = $(this).parents("tr:eq(0)").next("tr").find("table.ms-navSubMenu2:eq(0)");
        if (subMenu.length > 0)
        {
        	//only if we have a submenu should we hide the other submenus and show the current one.
	        $("table.ms-navSubMenu2").hide("slow");
			subMenu.show("slow");
		}
		
    });
*/
});

$(document).ready(function(){

	$(function(){
		 $('tr[id*=ForumRow]:even').attr('class','ms-toolbarContainer bgRowWhite');
		 $('tr[id*=ForumRow]:odd').attr('class','ms-toolbarContainer bgRowGary'); 
		 $('tr[id*=TopicRow]:even').attr('class','ms-toolbarContainer bgRowWhite');
		 $('tr[id*=TopicRow]:odd').attr('class','ms-toolbarContainer bgRowGary'); 
		 
	     $('div a[id*=ForumName]').attr('class','textBold'); 
	     
	     $('div span[id*=DataPager]').attr('class','DataPagerStyle'); 
		 $('div a[id*=LastPoster]').each(function(){
			$(this).parents("div:eq(0)").attr('class','LastPoster'); 
  			$(this).parents("div:eq(1)").attr('class','LastPoster'); 

	     });

		 $('td img[id*=TopicImage]').wrap('<div class="Wrapper1" />');
	  	 $('td a[id*=TopicTitle]').wrap('<div class="Wrapper2" />');
		 $('td a[id*=TopicStarter]').each(function(){	
			$(this).parents("div:eq(0)").attr('class','Wrapper3');
				 
	  	 });
	 });
  });



