var currentIndex = -1; $(document).ready(function() { $('.tabs li a').click(function() { var linkHref = $(this).attr('href'); if (linkHref != "#") { window.location.href = linkHref; } $('.tabs li').removeClass('active'); $(this).parent().addClass('active'); $('.nav').hide(); var index = $('.tabs li a').index(this); $('.nav').eq(index).show(); return false; }); $('.tabs li a').hover(function() { $('.tabs li').removeClass('active'); $(this).parent().addClass('active'); $('.nav').hide(); var index = $('.tabs li a').index(this); $('.nav').eq(index).show(); return false; }); $('.nav li').has('ul').hover(function() { $(this).addClass('current').children('ul').fadeIn(); }, function() { $(this).removeClass('current').children('ul').hide(); }); //remove all tab LIs $('.tabs li').removeClass('active'); //get url w/o domain var url = window.location.pathname; if (url.indexOf("ViewPage.aspx")) url = url + window.location.search; url = url.replace(/^.*\/\/[^\/]+/, ''); var listItem = $('.nav li:has(a[href="' + url + '"])'); //find the li having the url w/o domain var index = listItem.parent().prevAll().length; //get index of tabs (parent) of li //if url is not found in first-level menu, check in tabs if (listItem.length == 0) { listItem = $('.tabs li:has(a[href="' + url + '"])'); index = listItem.prevAll().length; } //set selected item as active listItem.addClass('active'); //activate main tab and show first level menu $('.tabs li').eq(index).addClass('active'); $('.nav').eq(index).show(); currentIndex = index; //Steven - Removed because it was reverting to the old menu before refresh //show selected menu when mouse is on body of page // $('.platform-body').mouseover(function() { // $('.tabs li').removeClass('active'); // $('.tabs li').eq(currentIndex).addClass('active'); // $('.nav').hide(); // $('.nav').eq(currentIndex).show(); // }); });