/*
*	Copyright 2005 Connecticut Business Applications, LLC. All rights reserved.
*	@author	Jacques Almeida
*	@version	1.1
*/
function EventObject(e,id){
	this.source=e;
	this.id=id;
	this.type;
	this.target;
	this.keyCode;
	this.button;
	this.clientX;
	this.clientY;
	this.altKey;
	this.ctrlKey;
	this.shiftKey;
	this.timestamp=(new Date()).getMilliseconds();
	if(e.type) this.type=e.type;
	if(e.clientX) this.clientX=e.clientX;
	if(e.clientY) this.clientY=e.clientY;
	if(e.altKey) this.altKey=e.altKey;
	if(e.ctrlKey) this.ctrlKey=e.ctrlKey;
	if(e.shiftKey) this.shiftKey=e.shiftKey;
	if(e.target) this.target=e.target;
	else if(e.srcElement) this.target=e.srcElement;
	if(e.keyCode) this.keyCode=e.keyCode;
	else if(e.charCode) this.keyCode=e.charCode;
	else if(e.which) this.keyCode=e.which;
	if(e.button){
		if(e.target) this.button=e.button;
		else if(e.srcElement)
			switch(e.button){
				case 1:this.button=0;break;
				case 2:this.button=2;break;
				case 4:this.button=1;break;
			}
	}
	this.stopPropagation=function(bool){
		if(bool){
			if(this.source.preventDefault) this.source.preventDefault();
			if(typeof(this.source.returnValue)!="undefined") this.source.returnValue=false;
			if(this.source.stopPropagation) this.source.stopPropagation();
			if(this.source.cancelBubble) this.source.cancelBubble=true;
		}
	};
	this.getTargetValues=proto_getTargetValues;
};
var proto_getTargetValues=function(){
	switch(this.target.type){
		case "select-multiple":
		case "select-one":
			var v=[];
			var o=this.target.options;
			var l=o.length;
			var d=l;
			var i=-1;
			do{if(o[l-d].selected)v[++i]=o[l-d];}while(--d);
			return v;
		case "checkbox":
		case "button":
		case "file":
		case "image":
		case "password":
		case "radio":
		case "reset":
		case "submit":
		case "text":
		case "textarea":
			return [this.target.value];
		default:break;
	}
};
var EventFactory={create:function(e,id){return new EventObject(e,id);}};
