
var _IDCONTROL = null;
function SimpleAjaxCall(){
    this.caller = null;	
    this.version = "2.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;
    var texto = _IDCONTROL.value;	
    this.requestMensajeGET(url,_IDCONTROL.name + "=" + texto + "&" + parametros,this.funcion_actualizacion_texto);
}
function requestMensajeGET(url,parametros,funcion_referencia,delimitador){
    this.caller.setURL(url);
    this.caller.setMetodo("GET");
    this.caller.setParametros(parametros);
    if(delimitador != undefined){
        this.caller.setDelimitador(delimitador);
    }
    if(funcion_referencia==null || funcion_referencia ==undefined || funcion_referencia == ""){
        funcion_referencia = this.defaultFunction;
    }
    //alert(parametros);
    this.caller.setDelegado(funcion_referencia);
    this.caller.useDefaultHandler();
    this.caller.Llamar();	
}
function requestMensajePOST(url,formulario,funcion_referencia,delimitador){
    this.caller.setURL(url);
    this.caller.setMetodo("POST");
    this.caller.setFormulario(formulario);
    if(delimitador != undefined){
        this.caller.setDelimitador(delimitador);
    }
    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; }

function get(url,param,callback_function,delimitador){
    var s = new SimpleAjaxCall();
    s.requestMensajeGET(url,param,callback_function,delimitador); 
}
function post(url,param,callback_function,delimitador){
    var s = new SimpleAjaxCall();
    s.requestMensajePOST(url,param,callback_function,delimitador); 
}