(function ( window ) {
	
	var $navtabs = $("#nav-tabs").find( "a" ),
		$tabs = $(".product-tabs").find( ".tab" ),
		$prodnav = $("#nav-products"),
		$tog = $prodnav.find( ".toggle" );
	
	$navtabs.bind("click", function ( e ) {
		// Tab on state
		$navtabs.removeClass( "on" );
		$(this).addClass( "on" );
		
		// Show correct tab content
		$tabs.hide();
		$(this.hash).show();
		
		return false;
	});
	
	$tog.bind("mouseover", function ( e ) {
		$prodnav.find( "li" ).removeClass( "on" );
		$prodnav.find( "li" ).removeClass( "sub-on" );
		
		// Get the parent list item
		var $li = $(this).parent( "li" );
		$li.addClass( "on" );
		
		// Show the correct list
		$li.find( "ul" ).slideDown( "fast" );
	});
	
})( window );
