function p5UI__clickedOutsideElement(element, event) {
	// offsetParent - first parentNode with position: (relative | absolute)
	var eventTarget = (event.target)? event.target : event.srcElement;
	while (eventTarget != null) {
		// console.log('Outside:', {'eventTarget': eventTarget, 'eventTarget.offsetParent': eventTarget.offsetParent, 'eventTarget.parentNode': eventTarget.parentNode});
		if (eventTarget === element) return false;
		eventTarget = eventTarget.offsetParent;
	}
	return true;
}

global.p5UI__clickedOutsideElement = p5UI__clickedOutsideElement
