$(document).ready(function(){

	//Hide (Collapse) the toggle containers on load
	$(".toggle_container").hide(); 

	//Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
	$("h2.trigger").click(function(){
		$(this).toggleClass("active").next().slideToggle("slow");
		return false; //Prevent the browser jump to the link anchor
	});

});

$(document).ready( function() {
$('a[rel="external"]').addClass('external').click( function() {
window.open( $(this).attr('href') );
return false;
});
});

$(document).ready( function () {
    var pathname = (window.location.pathname.match(/[^\/]+$/)[0]);
    $("#main-nav ul li a").removeClass("current");
    $("#main-nav ul li a[href='" + pathname  + "']").addClass("current");
});

$(document).ready( function () {
    var pathname = (window.location.pathname.match(/[^\/]+$/)[0]);
    $("#portsub-nav ul li a").removeClass("current");
    $("#portsub-nav ul li a[href='" + pathname  + "']").addClass("current");
});

$(document).ready( function () {
    var pathname = (window.location.pathname.match(/[^\/]+$/)[0]);
    $("#wedsub-nav ul li a").removeClass("current");
    $("#wedsub-nav ul li a[href='" + pathname  + "']").addClass("current");
});

/* menu */
$(document).ready(function(){
$("ul.sub li a:not(:eq(1))").click(function() { //When trigger is clicked...
		
		//Following events are applied to the subnav itself (moving subnav up and down)
$(this).parent().find("ul").slideDown('slow').show(); //Drop down the subnav on click

$(this).parent().hover(function() { 
}, function(){	
$(this).parent().find("ul").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
});

return false;

});
});



$(document).ready(function(){ 
$(".sub li ul").hover(
  function () {
    $(this).parent().addClass("subactive");
  },
  function () {
    $(this).parent().removeClass("subactive");
  }
);
});

$(document).ready(function(){ 
$(".subject dd:nth-child(5)").addClass("margin");

});


