// event-handling module
// *******************************************************

// declare com_bbwd as an object
if(!com_bbwd){
	var com_bbwd = {}; // shorthand declaration
} else if(!com_bbwd && typeof(com_bbwd) != "object"){
	throw new Error("bbwd is not an Object type");
}

// create sub-object EVENTS and declare properties all at once
com_bbwd.EVENTS = {
	NAME: "Event handling module",
	VERSION: 1.0,
	// cross-browser event registration (add event to node)
	addEventHandler: function(oNode,sEvt,fFunction,bCaptures){
		if(typeof(window.event) != "undefined"){
			oNode.attachEvent("on" + sEvt, fFunction);
		}else{
			oNode.addEventListener(sEvt, fFunction, bCaptures);
		}
	},
	// cross-browser event de-registration (remove event from node)
	removeEventHandler: function(oNode,sEvt,fFunction,bCaptures){
		if(typeof(window.event) != "undefined"){
			oNode.detachEvent("on" + sEvt, fFunction);
		}else{
			oNode.removeEventListener(sEvt, fFunction, bCaptures);
		}
	},
	// cross-browser way of getting target of event
	fGetEventTarget: function(evt){
		if(window.event != null){
			return window.event.srcElement;
		}else{
			return evt.target;
		}
	},
	stopEvent: function(evt){
		if(window.event){
			window.event.cancelBubble = true;
		}else{
			evt.stopPropegation();
		}
	},
	preventDefault: function(evt){
		if(window.event){
			window.event.returnValue = false;
		}else{
			evt.preventDefault();
		}
	}
}