$(document).ready(function()
{
// First we hide all exhibitis
$("#menu ul li.section-title").nextAll().hide();

var menuIsClosed = true;

// then the active exhibit is showed
$("#menu ul").each(function()
{
	var activeMenu = $(this).find("li.active");
	if (activeMenu.size()) {
		menuIsClosed = false;
	}
	activeMenu.prevAll().nextAll().show();
});

//This is the toggle function

$("#menu ul li.section-title").click(function(){
	$(this).nextAll().slideToggle("fast");
});

if (menuIsClosed) {
	if (window.location.search.match('/\?\/architecture\/(.*)/')) {
		$('li:contains("ARCHITECTURE")', '#menu ul').click();
	} else if (window.location.search.match('/\?\/product\-design\/(.*)/')) {
		$('li:contains("PRODUCT DESIGN")', '#menu ul').click();
	} else if (window.location.search.match('/\?\/interior\-design\/(.*)/')) {
		$('li:contains("INTERIOR DESIGN")', '#menu ul').click();
	}
	
	/* else if (window.location.search.match('/\?\/clients\/(.*)/')) {
		$('li:contains("Clients")', '#menu ul').click();
	} else if (window.location.search.match('/\?\/archive\/(.*)/')) {
		$('li:contains("Archive")', '#menu ul').click();
	} else if (window.location.search.match('/\?\/press\/(.*)/')) {
		$('li:contains("Press")', '#menu ul').click();
	} else if (window.location.search.match('/\?\/news\/(.*)/')) {
		$('li:contains("News")', '#menu ul').click();
	}
	*/
}
	
});
