// JavaScript Document
var logeo = function(archivo,usuario,password,funcion){
	var oClase = this;
	this.req = new Request(oClase);
	this.archivo = archivo;
	this.funcion = funcion;
	this.usuario = usuario;
	this.password = password;
	this.logearse = function(){
		var error = ""; 
		if(this.usuario.value == "Usuario")error = "Ingrese el usuario.<br />";
		if(this.password.value == "")error += "Ingrese el password.";		
		if(error == ""){
			var valores = "accion|=|logeo|&|usuario|=|"+this.usuario.value+"|&|password|=|"+this.password.value;
			this.req.pedir(this.archivo, valores);
		}
		else{
			if(this.funcionFalla)this.funcionFalla(error);	
		}
	}
	this.deslogearse = function(){
		var valores = "accion|=|deslogeo";
		this.req.pedir(this.archivo, valores);
	}
	this.onRequestLoad = function(){
		if(this.funcion)this.funcion(this.req.respuestaHTML);
	}
}

