var closeMenu = true;
var box = '#button1box';

$(document).ready(function()
{
	// button class clicked
	$(".button").click( function() 
	{
		closeMenu = false;
		
		//  2. Open the box clicked
		openThisBox();
	});
	
	// document clicked
	$(document).click(function() 
	{
		if(closeMenu == true)
		{
			closeOpenBox();
		}
		closeMenu = true;
	});
	
});

function openThisBox()
{
	$(box).show(150);
}	

function closeOpenBox()
{
	$(box).hide();
}

