$(function(){
	// open or close drawers
	$('#subnav li').click(function(event){
		var isOpen = $(this).hasClass('current');	// see if this drawer is open
		if ( isOpen == false ) {					// this drawer is closed
				//$('#subnav div').slideUp(100);				// close all drawers		
				$('#subnav li').removeClass('current');	// remove all "open" classes		
				$(this).addClass('current');			// add "open" class
				//$(this).children('div').slideDown();	// open this drawer
		}
		event.preventDefault();						// don't follow the link
	});
	// go to selected client
	$('#subnav .by-type select').change(function() {
	
		if ($(this).val().length > 0) {
				window.location = '/portfolio/tags/' + $(this).val() + '/default.aspx';
		}
	});
	// go to selected tag
	$('#subnav .by-client select').change(function() {
	
		if ($(this).val().length > 0) {
			window.location = '/portfolio/clients/' + $(this).val() + '/default.aspx';
		}
		
	});
	// add class "last" to last list item
	$("#pa-portfolio-list .entry:last-child").addClass("last");
});
