Web.Components.Inputs = function () {
	this.Objetos 	= Web.Library.Instances.create('Objects');
	this.Documents 	= Web.Components.Instances.create('Documents');
	this.fl_retorno = 1;
	this.str_type   = 'text';
	this.str_name   = "";
	this.obj_events = {};

	this.create = function (strObj,criarEm) {
		var objObj, criar, nome, tipo, Events;
		nome     = this.Objetos.getNonEmpty(this.getName(), strObj);
		tipo	 = (this.getType().toLowerCase() == 'text') ? 'INPUT' : 'TEXTAREA';
		objObj 	 = this.Objetos.getObj(strObj, tipo);
		criar    = (typeof objObj == 'string') ? true : false;
		criarEm  = (criarEm != null && typeof this.Objetos.getObj(criarEm) == 'object') ? this.Objetos.getObj(criarEm) : criarEm;
		criarEm  = (criarEm != null) ? criarEm : this.Objetos.getBody();
		Events   = this.getEvents();
		
		if (criar) {
			if (this.getType().toLowerCase() != 'textarea') {
				switch(this.getType().toLowerCase()) {
					case 'submit':
					case 'button':
					case 'reset':
							objObj = this.Documents.newButton(strObj, this.getType(), null, null);
						break;
						
					default:
							objObj = this.Documents.newInput(strObj, this.getType(), null, null);
						break;
				}
			} else {
				objObj = this.Documents.newTextArea(strObj, null, null);
			}
			
			objObj.setAttribute('id', nome);
			objObj.setAttribute('name', nome);

			criarEm.appendChild(objObj);
		}
		
		if (typeof Events == 'object') {
			for (x in Events) {
				if (Events[x] == '______array' || Events[x] == '') continue;
				this.Objetos.register(objObj, Events[x][0], Events[x][1]);
			}
		}
		
		objObj['objObj'] = this;
		
		this.setInput(objObj);
		this.setInputID(strObj);
		this.setCreateAT(criarEm);
		
		return (this.getRetorno() == 2) ? this : objObj;
	}
	
	this.setAttributes = function (argumentos) {
		this.Objetos.setAttributes(this.getInput(), argumentos);
	}
	
	this.getObjObj = function () { return this.obj_input; }
	this.setObjObj = function (valor) { this.obj_input = valor; }
	
	this.getName = function () { return this.str_name; }
	this.setName = function (valor) { this.str_name = valor; }
	
	this.getInput = function () { return this.obj_input; }
	this.setInput = function (valor) { this.obj_input = valor; }
	
	this.getInputID = function () { return this.input_id; }
	this.setInputID = function (valor) { this.input_id = valor; }
	
	this.getType = function () { return this.str_type; }
	this.setType = function (valor) { this.str_type = valor; }
	
	this.getCreateAT = function () { return this.create_at; }
	this.setCreateAT = function (valor) { this.create_at = valor; }

	this.getRetorno = function () { return this.fl_retorno; }
	this.setRetorno = function (valor) { this.fl_retorno = valor; }
	
	this.getEvents = function () { return this.obj_events; }
	this.setEvents = function (valor) { this.obj_events = valor; }
}
