﻿// Ryan K Griffith
// <ASP:Menu /> override the hiding of menu when clicking on certain elements

// By default all bubbles are sent through
var bCancelMenuBubble = false;

// Call this function to cancel the immediate next menu bubble
function cancelNextBubble(){ bCancelMenuBubble = true; }

// Fires when body.click occurs, 
// Provides us the opportunity to 
// escape out of the subsequent 
// menu hide that would occur otherwise
function cancelMenuBubbleCheck(){
	if(bCancelMenuBubble){
		bCancelMenuBubble = false;
		return false;
	}
	return true;
}

// Fires once the document has loaded... 
// We dont have a reference to body until then.
function wireupMenuBubbleCheck(){
	document.body.onclick = cancelMenuBubbleCheck;
}

wireupMenuBubbleCheck();
