//this function sets the nav appearance
//if cat is present, set highlighting on cat section & expand section dropdowns


function setNav(cat,subcat){
	if(!(isNull(cat)) && cat!=''){
		//alert("cat is " + cat);
		$("#"+cat).addClass("current");
		$("#"+cat+"-subnav").show();
		
		//if subcat is present, also highlight subcat cat div
		if(!(isNull(subcat)) && subcat!=''){
			//alert("subcat is " + subcat);
			$("#"+cat+"-"+subcat).addClass("dropdownSelected");	
		}
	}
	
	//if neither cat nor subcat, select home div
	else{
		$("#Home").addClass("current");
	}	

}

$(document).ready(function() {

	/* add drop down arrows to any expanable category sections */  
	$("div.category").addClass("arrow_down");
  
  	/* show all category sections expanded */
	$("div.category_subsection").show();
 
	/* for each category section, set a toggle event */
	$("div.category").each(function (i){
    
       var $match = $("div.category_subsection").eq(i);
	      
       $(this).toggle(
          function (){
             $("div.category").eq(i).addClass("arrow_right");
             $("div.category").eq(i).removeClass("arrow_down");
		     $match.hide();
          },
          function (){
             $("div.category").eq(i).addClass("arrow_down");
		     $("div.category").eq(i).removeClass("arrow_right");
             $match.show();
          }
       );
       
      $(this).click();
       
	});

	$("div.category:first").click();



});
