function findPosX(obj) { var curleft = 0; if (obj.offsetParent) { while (obj.offsetParent) { curleft += obj.offsetLeft obj = obj.offsetParent; } } else if (obj.x) curleft += obj.x; return curleft; } function findPosY(obj) { var curtop = 0; if (obj.offsetParent) { while (obj.offsetParent) { curtop += obj.offsetTop obj = obj.offsetParent; } } else if (obj.y) curtop += obj.y; return curtop; } function setLoadingImg(obj) { reX=findPosX(obj) reY=findPosY(obj) reW=obj.offsetWidth reH=obj.offsetHeight imX=reX+reW/2-10 imY=reY+reH/2-10 document.getElementById('loadingImg').style.left=imX+"px" document.getElementById('loadingImg').style.top=imY+"px" obj.className="transp" document.getElementById('loadingImg').style.display="block" } lastID=0 roomID=0 function initChat() { getChatPosts() } function getChatPosts() { xajax_chat(lastID, roomID) } var t function setChatTimeout() { t=setTimeout("getChatPosts()",2000); } function getChatPosts() { xajax_chat(lastID, roomID) } function newP() { //clearTimeout(t) newPost=document.chatForm.post.value document.chatForm.post.value="" if (newPost) { xajax_newPost(newPost, roomID) } } function scrollBottom() { document.getElementById('chatBody').scrollTop=document.getElementById('chatBody').scrollHeight } function checkEnternewP(e) { keychar = (e.which) ? e.which : e.keyCode if (keychar==13) { newP() } }