//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() {
  
  $("#otherTopic").hide();
  $(".other").hide();
  
  $("#topic").change(function () {
    	if($("option:selected",$(this)).text() == 'Other (please specify)'){
    		$("#otherTopic").show();
    		$(".other").show();
    		$("#otherTopic").attr('oz_req', 'true');
    	}	    	
        else{
        	 $("#otherTopic").hide();
        	 $(".other").hide();
        	 $("#otherTopic").removeAttr('oz_req');
  		}	
    
    });
  
	$("#ArchSuite").hide();
    $("#VizSuite").hide();
  
  
  $("#product").change(function () {
    	
    	if($("option:selected",$(this)).text() == 'Select an Autodesk Suite Product'){
    		$("#ArchSuite").hide();
    		$("#VizSuite").hide();
    	
    	}	    	
    	
    	else if($("option:selected",$(this)).text() == 'AutoCAD Revit Architecture Suite'){
    		$("#ArchSuite").show();
    		$("#VizSuite").hide();
    	
    	}	    	
        else if ($("option:selected",$(this)).text() == 'AutoCAD Revit Architecture Visualization Suite'){
        	 $("#ArchSuite").hide();
    		 $("#VizSuite").show();
        }	
  });

 
 

  
  $("div.category").addClass("arrow_right");
  $("div.category_subsection").hide();
 
   $("div.category").each(function (i){
    
       var $match = $("div.category_subsection").eq(i);
       /*
	   var $match1 = $("div.category").eq(0); 
       var $match1a = $("div.category_subsection").eq(0); 
       var $match2 = $("div.category").eq(1);
       var $match2a = $("div.category_subsection").eq(1);
       $match1.removeClass("arrow_right");
       $match1.addClass("arrow_down");
       $match1.show();
       $match1a.show();
       $match2.removeClass("arrow_right");
       $match2.addClass("arrow_down");
       $match2.show();
       $match2a.show();
       */
       
       $(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:eq(0)").click();
   $("div.category:eq(1)").click();
   $("div.category:eq(2)").click();
   $("div.category:eq(3)").click();
   $("div.category:eq(4)").click();
   
  
  
  
    $("div.category_podcast").addClass("arrow_right_podcast");
    $("div.category_podcast").click( function() {
 		$(this).toggleClass("arrow_down_podcast").toggleClass("arrow_right_podcast"); 
 		var tog = $(this).attr("id");
 		var tagg = tog.replace("trigger","toggle");
 		$("#"+tagg).toggle();
 	});
  
 
   

});

function popUp2(URL,MovWidth,MovHeight)
			{
				window.open(URL, 'thirdwin', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width='+MovWidth+',height='+MovHeight);
			}
