// Create a cross-browser event object.
// Mozilla passes an event parameter to event handlers.
// IE populates the window.event object.
// Call as:
// var theEvent = new CrossBrowserEvent(evt);
function CrossBrowserEvent(evt) 
{
	this.e = (evt || window.event);
	
	this.src = this.e.target || this.e.srcElement || null;
	this.x = (this.e.pageX || this.e.clientX || 0);
	this.y = (this.e.pageY || this.e.clientY || 0);
	
	if (window.event) {
		// IE
		this.x += document.documentElement.scrollLeft;
		this.y += document.documentElement.scrollTop;
	}
}


// Browser-safe expando attribute reading
function getAttribute(element, attribute) 
{
	var result = "";
	var attrs = element.attributes;
	if (attrs) 
	{
		var intLength = attrs.length;
		for (var intIndex = 0; intIndex < intLength; intIndex++) 
		{
			var a = attrs[intIndex];
			if (a)
			{
				if (a.nodeName == attribute)
				{
					result = a.nodeValue;
					break; 
				}
			}
		}
	}
	return result;
}



