$(function ()
{
  
  var myFile = document.location.toString();
  if (myFile.match('#')) { // the URL contains an anchor
    // click the navigation item corresponding to the anchor
    var myAnchor = '#' + myFile.split('#')[1];
    $('a[href="' + myAnchor + '"]').parent().click();
  } else {
    // click the first navigation item
    $('ol#nav li:first').click();
  }
});