/* trigger: 		   whatever triggers the modal box
 * modalBoxTopmostWrapper: the root wrapper of the modal box
 */

$(trigger).click(function(event){
	
    /* show modal box */

    $(document).bind("click.confirmation", function(e){
        if( $(e.target).parents(modalBoxTopmostWrapper).length ) // stop if clicking the confirmation box
            return;
		
	/* close modal box */
		
        $(document).unbind("click.confirmation");
    });
    event.stopPropagation(); // to prevent click.confirmation from firing immediately
});