var _IDCONTROL = null;

function SimpleAjaxCall(){
	this.caller = null;	
	this.version = "1.0";	
	this.caller = new AjaxCall();	
	//funciones
	this.setCaller 			= setCaller;
	this.getCaller			= getCaller;
	this.requestMensajeGET 	= requestMensajeGET;
	this.requestMensajePOST = requestMensajePOST;
	this.getVersion			= getVersion;
	this.defaultFunction	= defaultFunction;	
	/////////////////
	//extras
	this.ActualizarTexto 	= ActualizarTexto;
	this.funcion_actualizacion_texto = funcion_actualizacion_texto;	
	this.setFuncionActualizacionTexto = setFuncionActualizacionTexto;
}
function getCaller(){
	return this.caller;	
}
function setFuncionActualizacionTexto(f){
	this.funcion_actualizacion_texto = f;
}
function funcion_actualizacion_texto(str,isError){
	if(!isError){	
		_IDCONTROL.value = str;
	}
}

function ActualizarTexto(url,id,parametros){
	if(id==undefined){
		alert("No se definio el control");
		return;
	}
	_IDCONTROL = id;
	texto = _IDCONTROL.value;	
	this.requestMensajeGET(url,_IDCONTROL.name + "=" + texto + "&" + parametros,this.funcion_actualizacion_texto);
}
function requestMensajeGET(url,parametros,funcion_referencia){
	this.caller.setURL(url);
	this.caller.setMetodo("GET");
	this.caller.setParametros(parametros);
	if(funcion_referencia==null || funcion_referencia ==undefined || funcion_referencia == ""){
		funcion_referencia = this.defaultFunction;
	}
	this.caller.setDelegado(funcion_referencia);
	this.caller.useDefaultHandler();
	this.caller.Llamar();	
}
function requestMensajePOST(url,formulario,funcion_referencia){
	this.caller.setURL(url);
	this.caller.setMetodo("POST");
	this.caller.setFormulario(formulario);
	this.caller.setDelegado(funcion_referencia);
	this.caller.useDefaultHandler();
	this.caller.Llamar();	
}
function setCaller(ca){this.caller = ca; }
function defaultFunction(str,isError){
	//nada
}
function getVersion(){ return this.version; }