var RqSendDataAjx = null; function goSayPresence() { try { RqSendDataAjx = goCmdAjax(null, 'GET', '/PageAlive/SayPresence/', null, null); } catch (e) { //timerSayAlive(); } CheckError(); }; var onTimer = false; var goTimer = false; var timerSend = null; function CheckReTimer() { if (goTimer && !onTimer) { onTimer = true; goTimer = false; clearInterval(timerSend); timerSend = setTimeout("goSayPresence(); onTimer = false; ", 20000); } }; setInterval("CheckReTimer()", 500); function CheckError() { if (RqSendDataAjx.readyState != 4) { setTimeout("CheckError()", 200); return; } if (RqSendDataAjx.status == 200 || RqSendDataAjx.status == 201 || RqSendDataAjx.status == 500) timerSayAlive(); }; function timerSayAlive() { goTimer = true; }; timerSayAlive();