
function markActiveLink() {

    //Look through all the links in the sidebar
   $("#menu li a").filter(function() {

      //Take the current URL and split it into chunks at each slash
      var currentURL = window.location.toString().split("/");

      //return true if the bit after the last slash is the current page name
      return $(this).attr("href") == currentURL[currentURL.length-1];

    //when the filter function is done, you're left with the links that match.
    }).addClass("active");

   //Afterwards, look back through the links. If none of them were marked,
   //mark your default one.
   if($("#menu li a").hasClass("active") == false) {
      $("#menu li h2:nth-child(2) a").addClass("active");
    }
	
	 //var activeElement = $('#menu li a.active').parent().find("ul").slideDown('normal');
	 var activeElement = $('#menu li a.active').parent().find("ul").show();
	 
	 var activeSubElement = $('#menu li ul li a.active').parent().parent().parent().find("ul").show();
	 var activeSubElementLink = $('#menu li ul li a.active ').parent().parent().parent().children().eq(0).addClass("active");
	
	 
 }





function initMenu() {
	
	var active = $('#header').attr('class');
	
	
	
  $('#menu ul').hide();
  

  $('#menu li a').click(
    function() {
      var checkElement = $(this).next();
      if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
       // return false;
        }
      if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
        $('#menu ul:visible').slideUp('normal');
        checkElement.slideDown('normal');
        //return false;
        }
      }
    );
  }
  
  
  
$(document).ready(function() {
	
											initMenu();
											$('.shortcut').corner();
											$('.infobox').corner();
											$('a.ext').attr('target','_blank');
											markActiveLink();	
											});
