function taskNavLevel(l1,l2,l3,l4) { if(l2) { //we have a secondary click, which implies we also have a primary nav selected //we may or may not have l3 or l4 though, so they are handled separately below $("#division-menu").load(config.SFIABDIRECTORY+"/nav.php?level=1&id="+l1,null,function() { $("#division-menu").show(); // $("#tertiarymenu_accordion").accordion("destroy"); $("#topic-menu").load(config.SFIABDIRECTORY+"/nav.php?level=2&id="+l2,null,function() { // $("#tertiarymenu_accordion").accordion({clearStyle: true, collapsible: true, active: false}); //"option", "collapsible", true); $("#topic-menu").show(); $(".primarynav-selected").removeClass("primarynav-selected"); $("#primary_nav_"+l1).addClass("primarynav-selected"); $(".secondarynav-selected").removeClass("secondarynav-selected"); $("#secondary_nav_"+l2).addClass("secondarynav-selected"); //if we have a 3rd level nav, open up the accordion to the appropriate place if(l3) { // $("#tertiarymenu_accordion").accordion("activate",$("#tertiary_nav_"+l3)); } //if we have a 4th level nav, set the selected class on the appropriate item in the list if(l4) { $(".tertiarylinknav-selected").removeClass("tertiarylinknav-selected"); $("#tertiarylink_nav_"+l4).addClass("tertiarylinknav-selected"); } }); }); } else { //only the primary link clicked, so show the secondary, and thats it. $("#division-menu").load(config.SFIABDIRECTORY+"/nav.php?level=1&id="+l1,null,function() { $(".primarynav-selected").removeClass("primarynav-selected"); $("#primary_nav_"+l1).addClass("primarynav-selected"); //show the secondary $("#division-menu").show(); //and hide the tertiary // $("#topic-menu").hide(); }); } }