/*
## #################################################################### ##
##						Event.object.js									##
## ©1998-2006 Copyright Scheepens reclame adviseurs Tilburg Netherlands	##
##																		##
## 		     i:http://www.scheepens.nl  e:info@scheepens.nl 		  	##
## Scheepens Reclame Adviseurs; p.o.box 954; 5000AZ Tilburg; Netherlands##
## #################################################################### ##
## 06.06.2006 versie 1 door Huub										##
## #################################################################### ##
## __CHANGES__															##
## #################################################################### ##
## __TODO__																##
## #################################################################### ##
*/

/* 
## #################################################################### ##

Methoden:
	
	Event.add( object Element, string Eventtype, string CallFunction, bool useCapture );
	
		returns nothing;
	
	Event.get( constant e );
		returns the Element that got invoked
	
## #################################################################### ##
   
voorbeelden:

	Event.add( oDiv, "click", viewSource, false );
	
	var element = Event.get(e);
	
## #################################################################### ##
*/

var Event={
	
	add : function( oElement, sEventType, sFunction, useCapture ){
		// Original found @ sitepoint
		// cross-browser event handling for IE5+, NS6+ and Mozilla 
		// By Scott Andrew 
		if (oElement.addEventListener) {
			oElement.addEventListener(sEventType, sFunction, useCapture); 
			return true; 
		} 
		else if (oElement.attachEvent) { 
			var r = oElement.attachEvent('on' + sEventType, sFunction); 
			return r; 
		} 
		else {
			oElement['on' + sEventType] = sFunction;
		}
	},
	
	get : function( e ){
		var el;
		if (window.event && window.event.srcElement)
			el = window.event.srcElement;
		if (e && e.target)
			el = e.target;
		if (el) 
			return el;
		else 
			return false;
	}
}

