/**
/*  events.js
/*  gets properties of any event and cancel bubble upon construction with optional param.

/*  Ben Ipsen  2005. No Copyright. No license. Just Love. 
/*  Use wisely and for the greater good.  
/*
/*  docs: http://benipsen.com/elementary/
**/

function EventInfo(e, cancel){
		
		if (!e) var e = window.event;		
	  
		if (e.target) this.source = e.target;
		else if (e.srcElement) this.source = e.srcElement;
		if (this.source && this.source.nodeType == 3)
			this.source = this.source.parentNode;
			
		if (e.pageX || e.pageY) {
			this.xmouse = e.pageX;
			this.ymouse = e.pageY;
		}
		else if (e.clientX || e.clientY) {
			this.xmouse = e.clientX + document.body.scrollLeft;
			this.ymouse = e.clientY + document.body.scrollTop;
		}		
		if(cancel){
			e.cancelBubble = true;
			if (e.stopPropagation) e.stopPropagation();
		}	
}

//register listeners for window/document events cross-browser
//register listeners cross browser
function addWindowEventListener(eventName, callback, bubble){
	if(window.addEventListener){          
			window.addEventListener(eventName, callback, bubble);
	} else {
		//ie
		document.attachEvent('on' + eventName, callback);
	}                                                  
}