addslashes = function(str) {
	return (str+'').replace(/[\\"]/g, '\\$&').replace(/\u0000/g, '\\0');
}

var OnKeyRequestBuffer =
    {
        bufferText: false,
        bufferTime: 100,
        function2call : false,
        functionparam2 : null,
        functionparam3 : null,
        functionparam4 : null,

        modified : function(strId, function2call, functionparam2, functionparam3, functionparam4)
        {
        	this.function2call = function2call;
        	this.functionparam2 = functionparam2;
        	this.functionparam3 = functionparam3;
        	this.functionparam4 = functionparam4;
			setTimeout('OnKeyRequestBuffer.compareBuffer("'+strId+'","'+addslashes(xajax.$(strId).value)+'");', this.bufferTime);
        },

        compareBuffer : function(strId, strText)
        {
            if (strText == xajax.$(strId).value && strText != this.bufferText)
            {
                this.bufferText = strText;
                OnKeyRequestBuffer.makeRequest(strId);
            }
        },

        makeRequest : function(strId)
        {
        	if(this.function2call){
        		var call = this.function2call+"('"+xajax.$(strId).value+"','"+this.functionparam2+"','"+this.functionparam3+"','"+this.functionparam4+"');";
        		eval(call);
        	}
        }
    }

