var OnKeyRequestBuffer =
    {
        bufferText: false,
        bufferTime: 700,

		
		getStr : function(str) 
		{
			//str = str.replace(/\n/g,'');
			//str = str.replace(/"/g, '');
			str = str.replace(/\r\n/g," ");
			str = str.replace(/\n/g, "");
			return str;
		},

        modified : function(strId)
        {
		//xajax_requestBuffer(xajax.$(strId).value);
		var strText = OnKeyRequestBuffer.getStr(xajax.$(strId).value);
            	setTimeout('OnKeyRequestBuffer.compareBuffer("'+strId+'", "'+strText+'");', this.bufferTime);
        },

        compareBuffer : function(strId, strText)
        {
		   var strText1 = OnKeyRequestBuffer.getStr(xajax.$(strId).value);
		   if (strText == strText1 && strText != this.bufferText)                     
            {
                this.bufferText = strText;
                OnKeyRequestBuffer.makeRequest(strId);
            }
        },

        makeRequest : function(strId)
        {
		str = xajax.$(strId).value;
		str = str.replace(/\n/g,'<br />');
		str = str.replace(/\r\n/g,'<br />');
		xajax_requestBuffer(str);
	       //xajax_requestBuffer(xajax.$(strId).value);
        }
    }

/*
This class will only execute the code in the OnKeyRequestBuffer.makeRequest function
if the text in the input with the given id has not changed in a half of a second (500 ms).
So now, instead of calling the xajax function directly in the onkeyup event, we call our buffer class:

<input id="myText" type="text" onkeyup="OnKeyRequestBuffer.modified('myText');" />
*/
