function EnvioMensajeChat(){ new Ajax.Request('proxy-ynnova-chat.php', { method: 'post', parameters: $("FormularioChat").serialize(), onSuccess : function(resp) { var lista = resp.responseText.split(":::"); if(lista[0]=='ok') LeoChat(); else if(lista[0]=='error') alert(unescape(lista[1])) }, onFailure : function(resp) { alert("Hubo un error. Reintente. Si el problema persiste, comuniquese con el webmaster"); }, onLoading : function() { $('txtMensaje').value='(enviando...)'; $('btnEnviar').value='Aguarde...'; $('btnEnviar').disable(); }, onComplete : function() { $('txtMensaje').value=''; $('btnEnviar').value='Enviar'; $('btnEnviar').enable(); if($('txtNick').value!='' && $('txtNick').value!='nick') $('txtNick').writeAttribute('readonly', 'readonly') } }); } function LeoChat(){ new Ajax.Request('proxy-ynnova-chat2.php', { method: 'post', parameters: $("FormularioChat").serialize(), onSuccess : function(resp) { var lista = resp.responseText.split(":::"); if(lista[0]=='ok') $('frmChat').innerHTML=lista[1]; else if(lista[0]=='error') alert(unescape(lista[1])) }, onFailure : function(resp) { alert("Hubo un error. Reintente. Si el problema persiste, comuniquese con el webmaster"); } }); } setInterval("LeoChat()",3000); function PressEnter(e){ var keycode; if (window.event) keycode = window.event.keyCode; else if (e) keycode = e.which; else return true; if (keycode == 13) { EnvioMensajeChat() return false; } else return true; }