// ---------------------------------------// Author: Miguel Jette// Created: September 25th, 2006//// Last Modified: September 25th, 2006.// ---------------------------------------/* * expandcontent *  This function expands the right tabcontent. *  It is mainly called from the tabs that doesn't open actual links.*   But the function is also called when reloading a page and the sublinks needs to be loaded as well. */function expandcontent(linkobj){    var ulid=linkobj.parentNode.parentNode.id; //id of UL element    var ullist=document.getElementById(ulid).getElementsByTagName("li"); //get list of LIs corresponding to the tab contents    for (var i=0; i<ullist.length; i++){        ullist[i].className="";  //deselect all tabs        document.getElementById(ullist[i].getElementsByTagName("a")[0].getAttribute("rel")).style.display="none"; //hide all tab contents    }    linkobj.parentNode.className="selected";  //highlight currently clicked on tab    document.getElementById(linkobj.getAttribute("rel")).style.display="block"; //expand corresponding tab content}/* * initializetabcontent *  This function is called everytime you reload the page. *  It first looks at the location, and figures out which tab needs to be expanded. *  Then, it parses through your main menu (li's) and appends an 'onclick' event to the right links (The one's that have rel != empty). */function initializetabcontent(){    // First, we check where we are using the location in the adress bar    var loc = window.location.pathname;    // Now, depending on the location, we select the right li object to expand it's tab
    // Tests    if(loc.match("/test") || loc.match("free_test") || loc.match("test_reviews") || loc.match("help") || loc.match("help_contact")){        var liobj = document.getElementById("navTests");    }
    // Study    else if(loc.match("study_guide") || loc.match("study_guide_2007") || loc.match("practice_questions") || loc.match("order") || loc.match("reviews")){        var liobj = document.getElementById("navStudy");    }    // About    else if(loc.match("about_the_test") || loc.match("book_your_test") || loc.match("what_to_study") || loc.match("after_your_test") || loc.match("latest_info")){        var liobj = document.getElementById("navAbout");    }    // News    else if(loc.match("news")){ //        var liobj = document.getElementById("navNews");    }    else{ // Home        var liobj = document.getElementById("navHome");    }    var linkobj = liobj.getElementsByTagName("a")[0];    expandcontent(linkobj);    //for (var i=0; i<arguments.length; i++){ //loop through passed UL ids    //    var ulobj=document.getElementById(arguments[i])     //   var ulist=ulobj.getElementsByTagName("li") //array containing the LI elements within UL     //   for (var x=0; x<ulist.length; x++){ //loop through each LI element     //       var ulistlink=ulist[x].getElementsByTagName("a")[0]            // If it has submenus, do something about it     //       if (ulistlink.getAttribute("rel") != "empty"){     //           ulistlink.onclick=function(){     //               expandcontent(this);	 //				window.location = this;     //              return false;     //         }     //    }   //     } //end inner for loop   // } //end outer for loop}