var chatRefreshRate=4500;var secondsSinceMessageSent=0;function setGameSpace(space,code){var temp=document.getElementById(space);var temp2=code;if(document.getElementById('setGameSpaceTemp')&&document.getElementById(space)){document.getElementById('setGameSpaceTemp').innerHTML=code;if(document.getElementById(space).innerHTML!=document.getElementById('setGameSpaceTemp').innerHTML){document.getElementById(space).innerHTML=code;}}}
function removeChatMessage(value){if(document.getElementById('chatMessage'+ value)){var camstatsselection=document.getElementById('chatMessage'+ value);camstatsselection.innerHTML='Removed';camstatsselection.parentNode.removeChild(camstatsselection);}}
function updateChatRefreshRateBasedOnUserCount(value){if(value<=30){chatRefreshRate=6000+ value*10;}
else if(value<=60){chatRefreshRate=7400+ value*10;}
else if(value<=90){chatRefreshRate=8500+ value*10;}
else{chatRefreshRate=9500+ value*10;}
if(secondsSinceMessageSent>=500){chatRefreshRate=chatRefreshRate+ 10000;}
if(secondsSinceMessageSent>=700){chatRefreshRate=chatRefreshRate+ 35000;}
if(chatRefreshRate>41000){chatRefreshRate=41000;}
if(secondsSinceMessageSent>=3600){chatRefreshRate=chatRefreshRate+ 25000;}
var temp=(Math.round((chatRefreshRate/1000)*10)/10)+' Seconds/Update**';if(document.getElementById('refreshRate')){document.getElementById('refreshRate').innerHTML=temp;}}
var setChatBoxHeight=298;var setChatBoxWidth=748;var sendReq=getXmlHttpRequestObject();var receiveReq=getXmlHttpRequestObject();var receiveReqOnline=getXmlHttpRequestObject();var lastMessage=0;var lastNewMessage=0;var lastMessageOnline=0;var mTimerOnlineMod=1;var mTimer;var mTimerOnline;var remoteUser='';var lastMessagePrivate=0;var previousRemoteUser='';var temp;var temp2;var temp3;var temp4;var mTimerChatLastReload;var mTimerChatLastReloadSecondsPassing=62;var mTimerChatLastReloadSeconds=162;function decLastChatReloadUpdateSeconds(){clearTimeout(mTimerChatLastReload);document.getElementById('refreshRateSeconds').innerHTML='0:'+ mTimerChatLastReloadSecondsPassing;if(mTimerChatLastReloadSecondsPassing>0){mTimerChatLastReloadSecondsPassing--;document.getElementById('chatUpdateButton').value='Refresh';}else{document.getElementById('chatUpdateButton').value='Refresh ('+ mTimerChatLastReloadSecondsPassing+')';mTimerChatLastReloadSecondsPassing--;clearTimeout(mTimer);getChatText();}
secondsSinceMessageSent++;mTimerChatLastReload=setTimeout('decLastChatReloadUpdateSeconds();',1000);}
function setRemoteUser(RemoteU)
{remoteUser=RemoteU;if(RemoteU==''){temp3='chatTaskBarMain';}else{temp3='chatTaskBar'+ remoteUser;}
document.getElementById(temp3).style.background='#cccccc';document.getElementById(temp3).style.display='';if(RemoteU!=''){temp4='HidechatTaskBar'+ RemoteU;document.getElementById(temp4).style.display='';}
if(previousRemoteUser==''){temp4='div_chat';}else{temp4='chatWindow'+ previousRemoteUser;}
document.getElementById(temp4).style.display='none';if(RemoteU==''){temp2='div_chat';}else{temp2='chatWindow'+ RemoteU;}
document.getElementById(temp2).style.display='block';chatWindowTemp=document.getElementById(temp2);chatWindowTemp.scrollTop=chatWindowTemp.scrollHeight;previousRemoteUser=RemoteU;document.forms['frmmain'].elements['txt_message'].focus();}
function hideRemoteUser(RemoteU){if(RemoteU==''){temp2='div_chat';}else{temp2='chatWindow'+ RemoteU;}
document.getElementById(temp2).style.display='none';temp4='chatTaskBar'+ RemoteU;document.getElementById(temp4).style.display='none';temp4='HidechatTaskBar'+ RemoteU;document.getElementById(temp4).style.display='none';if(previousRemoteUser==''){temp4='div_chat';}else{temp4='chatWindow'+ previousRemoteUser;}
document.getElementById(temp4).style.display='block';chatWindowTemp=document.getElementById(temp4);chatWindowTemp.scrollTop=chatWindowTemp.scrollHeight;}
function startPrivate(userName)
{var temp='chatWindow'+ userName;var chatWindowS=document.getElementById(temp);if(chatWindowS==null){document.getElementById('chatTaskBar').innerHTML+=' <a href="javascript:setRemoteUser(\''+ userName+'\');" class="textSmall" style="" id="chatTaskBar'+ userName+'">'+ userName+'</a><a href="javascript:hideRemoteUser(\''+ userName+'\');" class="textSmall" style="" id="HidechatTaskBar'+ userName+'">X</a>';document.getElementById('chatWindow').innerHTML+='<div id="chatWindow'+ userName+'" style="height: '+ setChatBoxHeight+'px; width: '+ setChatBoxWidth+'; overflow: auto; display: none;"></div>';var chatWindowS=document.getElementById(temp);}
setRemoteUser(userName);}
function stopChat(){clearTimeout(mTimer);clearTimeout(mTimerChatLastReload);}
function startChat(){document.getElementById('txt_message').focus();getChatText();decLastChatReloadUpdateSeconds();}
function getXmlHttpRequestObject(){if(window.XMLHttpRequest){return new XMLHttpRequest();}else if(window.ActiveXObject){return new ActiveXObject("Microsoft.XMLHTTP");}else{document.getElementById('p_status').innerHTML='Status: Cound not create XmlHttpRequest Object.  Upgrade your freaking browser!';}}
function getChatText(){clearTimeout(mTimer);if(receiveReq.readyState==4||receiveReq.readyState==0){receiveReq.open("GET",'getChat.php?chat='+ chatroomid+'&name='+ setChatName+'&chatuserid='+ setChatUserId+'&last='+ lastMessage,true);receiveReq.onreadystatechange=handleReceiveChat;receiveReq.send(null);mTimerChatLastReloadSecondsPassing=mTimerChatLastReloadSeconds;}}
function getChatTextOnline(){if(receiveReqOnline.readyState==4||receiveReqOnline.readyState==0){receiveReqOnline.open("GET",'getChatonline.php?chat='+ chatroomid+'&chatname='+ setChatName+'&chatuserid='+ setChatUserId+'&last=0',true);receiveReqOnline.onreadystatechange=handleReceiveChatOnline;receiveReqOnline.send(null);}}
function sendChatText(){if(document.getElementById('txt_message').value==''){alert("You have not entered a message");return;}
secondsSinceMessageSent=0;var longstring=document.getElementById('txt_message').value;var brokenstring=longstring.split(' ');if(brokenstring[0]=='/nick'){setChatUserName(brokenstring[1]);document.getElementById('txt_message').value='';var chat_div=document.getElementById('div_chat');chat_div.innerHTML+='<i><b>Username changed to '+ brokenstring[1]+'</b></i><br />';chat_div.scrollTop=chat_div.scrollHeight;}
else if((brokenstring[0]=='/msg'||brokenstring[0]=='/message')&&brokenstring[1]){startPrivate(brokenstring[1]);}else{if(sendReq.readyState==4||sendReq.readyState==0){sendReq.open("POST",'getChat.php?chat='+ chatroomid+'&name='+ setChatName+'&chatuserid='+ setChatUserId+'&last='+ lastMessage,true);sendReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded');sendReq.onreadystatechange=handleSendChat;var tempReplace=document.getElementById('txt_message').value;tempReplace=tempReplace.replace(/&/gi,"-----ampersand-----");var param='message='+ tempReplace;param+='&name='+ setChatName+'&chatuserid='+ setChatUserId;param+='&RemoteUsers='+ remoteUser;param+='&chat='+ chatroomid;sendReq.send(param);document.getElementById('txt_message').value='';}}}
function sendChatTextStickName(){if(document.getElementById('stickName').value==''){alert("You have not entered a UserName");return;}
if(sendReq.readyState==4||sendReq.readyState==0){sendReq.open("POST",'getChat.php?chat='+ chatroomid+'&last='+ lastMessage,true);sendReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded');sendReq.onreadystatechange=handleSendChat;var param='message=/stickam+'+ document.getElementById('stickName').value;param+='&name='+ setChatName+'&chatuserid='+ setChatUserId;param+='&RemoteUsers='+ remoteUser;param+='&chat='+ chatroomid;sendReq.send(param);document.getElementById('stickName').value='';}}
function sendChatTextButton(tempV){if(sendReq.readyState==4||sendReq.readyState==0){sendReq.open("POST",'getChat.php?chat='+ chatroomid+'&name='+ setChatName+'&last='+ lastMessage,true);sendReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded');sendReq.onreadystatechange=handleSendChat;var param='message='+ tempV;param+='&name='+ setChatName+'&chatuserid='+ setChatUserId;param+='&chat='+ chatroomid;sendReq.send(param);}}
function handleSendChat(){clearTimeout(mTimer);getChatText();}
function handleReceiveChat(){if(receiveReq.readyState==4){var chat_div=document.getElementById('div_chat');var xmldoc=receiveReq.responseXML;var message_nodes=xmldoc.getElementsByTagName("message");var n_messages=message_nodes.length
for(i=0;i<n_messages;i++){var user_node=message_nodes[i].getElementsByTagName("user");var text_node=message_nodes[i].getElementsByTagName("text");var time_node=message_nodes[i].getElementsByTagName("time");chat_div.innerHTML+='<div id="chatMessage'+ message_nodes[i].getAttribute('id')+'"><a href="chatReport.php?id='+ message_nodes[i].getAttribute('id')+'" target="_blank"><img src="http://www.360pal.com/images/fam/error_delete.png" width="10" height="10" title="Report this message" border="0"></a><b>'+ user_node[0].firstChild.nodeValue+'</b> '+ time_node[0].firstChild.nodeValue+' - '+ replaceURLWithHTMLLinks(text_node[0].firstChild.nodeValue)+'</div>';chat_div.scrollTop=chat_div.scrollHeight;lastMessage=message_nodes[i].getAttribute('id')*1;if(remoteUser!=''){document.getElementById('chatTaskBarMain').style.background='red';}}
var private_nodes=xmldoc.getElementsByTagName("private");var p_messages=private_nodes.length
for(i=0;i<p_messages;i++){var user_node=private_nodes[i].getElementsByTagName("user");var text_node=private_nodes[i].getElementsByTagName("text");var time_node=private_nodes[i].getElementsByTagName("time");var remoteUser_node=private_nodes[i].getElementsByTagName("remoteUser");var temp='chatWindow'+ remoteUser_node[0].firstChild.nodeValue;var chatWindowS=document.getElementById(temp);if(chatWindowS==null){document.getElementById('chatTaskBar').innerHTML+=' <a href="javascript:setRemoteUser(\''+ remoteUser_node[0].firstChild.nodeValue+'\');" class="textSmall" style="" id="chatTaskBar'+ remoteUser_node[0].firstChild.nodeValue+'">'+ remoteUser_node[0].firstChild.nodeValue+'</a><a href="javascript:hideRemoteUser(\''+ remoteUser_node[0].firstChild.nodeValue+'\');" class="textSmall" style="" id="HidechatTaskBar'+ remoteUser_node[0].firstChild.nodeValue+'">X</a>';document.getElementById('chatWindow').innerHTML+='<div id="chatWindow'+ remoteUser_node[0].firstChild.nodeValue+'" style="height: '+ setChatBoxHeight+'px; width: '+ setChatBoxWidth+'px; overflow: auto; display: none;"></div>';var chatWindowS=document.getElementById(temp);}
chatWindowS.innerHTML+='<b>'+ user_node[0].firstChild.nodeValue+'</b>&nbsp;';chatWindowS.innerHTML+='<font class="chat_time">'+ time_node[0].firstChild.nodeValue+'</font>&nbsp;-&nbsp;';chatWindowS.innerHTML+=replaceURLWithHTMLLinksPrivate(text_node[0].firstChild.nodeValue)+'<br />';chatWindowS.scrollTop=chatWindowS.scrollHeight;lastMessagePrivate=private_nodes[i].getAttribute('id')*1;temp2='chatTaskBar'+ remoteUser_node[0].firstChild.nodeValue;if(remoteUser!=remoteUser_node[0].firstChild.nodeValue){document.getElementById(temp2).style.background='red';document.getElementById(temp2).style.display='';temp2='HidechatTaskBar'+ remoteUser_node[0].firstChild.nodeValue;document.getElementById(temp2).style.display='';}
if(lastMessagePrivate>lastMessage){lastMessage=lastMessagePrivate;}}
if(lastMessage>lastNewMessage){lastNewMessage=lastMessage;if(document.getElementById('soundsOnOffJS').value==1){document.getElementById('div_chat_events').innerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://active.macromedia.com/flash4/cabs/swflash.cab#version=4,0,0,0" id="Movie1" width="1" height="1"><param name="movie" value="flash/Ting.swf"><param name="quality" value="high"><param name="bgcolor" value="#CC0000"><embed name="Movie1" src="flash/Ting.swf" quality="high" bgcolor="#CC0000" width="1" height="1" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed></object>';}
else if(document.getElementById('soundsOnOffJS').value==2){document.getElementById('div_chat_events').innerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://active.macromedia.com/flash4/cabs/swflash.cab#version=4,0,0,0" id="Movie1" width="1" height="1"><param name="movie" value="flash/Ting2.swf"><param name="quality" value="high"><param name="bgcolor" value="#CC0000"><embed name="Movie1" src="flash/Ting2.swf" quality="high" bgcolor="#CC0000" width="1" height="1" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed></object>';}
else if(document.getElementById('soundsOnOffJS').value==3){document.getElementById('div_chat_events').innerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://active.macromedia.com/flash4/cabs/swflash.cab#version=4,0,0,0" id="Movie1" width="1" height="1"><param name="movie" value="flash/Ting3.swf"><param name="quality" value="high"><param name="bgcolor" value="#CC0000"><embed name="Movie1" src="flash/Ting3.swf" quality="high" bgcolor="#CC0000" width="1" height="1" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed></object>';}else{}}
var chat_divonline=document.getElementById('div_chatonline');var xmldoconline=receiveReq.responseXML;var message_nodesonline=xmldoconline.getElementsByTagName("onlineUser");var n_messagesonline=message_nodesonline.length
var tempDCO='<div>'+ n_messagesonline+' Users</div>';updateChatRefreshRateBasedOnUserCount(n_messagesonline);for(i=0;i<n_messagesonline;i++){var user_nodeonline=message_nodesonline[i].getElementsByTagName("user");var text_nodeonline=message_nodesonline[i].getElementsByTagName("text");var time_nodeonline=message_nodesonline[i].getElementsByTagName("time");var profile_nodeonline=message_nodesonline[i].getElementsByTagName("profile");var bodyCodes_nodeonline=message_nodesonline[i].getElementsByTagName("bodyCodes");var userPoints_nodeonline=message_nodesonline[i].getElementsByTagName("userPoints");tempDCO+='<table width="190" cellpadding="0" cellspacing="0" border="0"><tr><td width="16">';if(text_nodeonline[0].firstChild.nodeValue==1){var longstring1=profile_nodeonline[0].firstChild.nodeValue;var brokenstring1=longstring1.split('<b>');if(brokenstring1[1]){var longstring2=brokenstring1[1];var brokenstring2=longstring2.split('</b>');if(brokenstring2){if(brokenstring2[0]=='Admin'){tempDCO+='<img src="http://www.360pal.com/images/fam/award_star_gold_1.png" width="16" height="16" align="left" title="Admin - Available">';}
else if(brokenstring2[0]=='Moderator'){tempDCO+='<img src="http://www.360pal.com/images/fam/award_star_gold_2.png" width="16" height="16" align="left" title="Moderator - Available">';}
else if(brokenstring2[0]=='Kicked'){tempDCO+='<img src="http://www.360pal.com/images/fam/cancel.png" width="16" height="16" align="left" title="Kicked - they cannot see the chat">';}
else{tempDCO+='<img src="http://www.360pal.com/images/fam/status_online.png" width="16" height="16" align="left" title="Available">';}}else{tempDCO+='<img src="http://www.360pal.com/images/fam/status_online.png" width="16" height="16" align="left" title="Available">';}}else{tempDCO+='<img src="http://www.360pal.com/images/fam/status_online.png" width="16" height="16" align="left" title="Available">';}}
else if(text_nodeonline[0].firstChild.nodeValue==2){var longstring1=profile_nodeonline[0].firstChild.nodeValue;var brokenstring1=longstring1.split('<b>');if(brokenstring1[1]){var longstring2=brokenstring1[1];var brokenstring2=longstring2.split('</b>');if(brokenstring2){if(brokenstring2[0]=='Admin'){tempDCO+='<img src="http://www.360pal.com/images/fam/award_star_bronze_1.png" width="16" height="16" align="left" title="Admin - Away">';}
else if(brokenstring2[0]=='Moderator'){tempDCO+='<img src="http://www.360pal.com/images/fam/award_star_bronze_2.png" width="16" height="16" align="left" title="Moderator - Away">';}
else{tempDCO+='<img src="http://www.360pal.com/images/fam/status_away.png" width="16" height="16" align="left" title="Away">';}}else{tempDCO+='<img src="http://www.360pal.com/images/fam/status_away.png" width="16" height="16" align="left" title="Away">';}}else{tempDCO+='<img src="http://www.360pal.com/images/fam/status_away.png" width="16" height="16" align="left" title="Away">';}}
else if(text_nodeonline[0].firstChild.nodeValue==3){var longstring1=profile_nodeonline[0].firstChild.nodeValue;var brokenstring1=longstring1.split('<b>');if(brokenstring1[1]){var longstring2=brokenstring1[1];var brokenstring2=longstring2.split('</b>');if(brokenstring2){if(brokenstring2[0]=='Admin'){tempDCO+='<img src="http://www.360pal.com/images/fam/award_star_silver_1.png" width="16" height="16" align="left" title="Admin - Offline">';}
else if(brokenstring2[0]=='Moderator'){tempDCO+='<img src="http://www.360pal.com/images/fam/award_star_silver_2.png" width="16" height="16" align="left" title="Moderator - Offline">';}
else{tempDCO+='<img src="http://www.360pal.com/images/fam/status_offline.png" width="16" height="16" align="left" title="Offline">';}}else{tempDCO+='<img src="http://www.360pal.com/images/fam/status_offline.png" width="16" height="16" align="left" title="Offline">';}}else{tempDCO+='<img src="http://www.360pal.com/images/fam/status_offline.png" width="16" height="16" align="left" title="Offline">';}}
else if(text_nodeonline[0].firstChild.nodeValue==4){tempDCO+='<img src="http://www.360pal.com/images/fam/joystick.png" width="16" height="16" align="left" title="Playing">';}
tempDCO+='</td><td style="overflow: hidden;">';var tempName=user_nodeonline[0].firstChild.nodeValue;var tempNameLastCharIndex=tempName.length- 1;if(tempName.charAt(tempNameLastCharIndex)!='*'){tempDCO+='<a href="http://4hds.com/user.php?username='+ user_nodeonline[0].firstChild.nodeValue+'" target="_blank">';}
tempDCO+='<span ONMOUSEOVER="popupProfile(\''+ profile_nodeonline[0].firstChild.nodeValue+'<br />'+ userPoints_nodeonline[0].firstChild.nodeValue+' Points';if(text_nodeonline[0].firstChild.nodeValue==2){tempDCO+='<br /><b>Away from Chat</b>';}
tempDCO+='\',\'ffffff\')"; ONMOUSEOUT="kill()"><b>'+ user_nodeonline[0].firstChild.nodeValue+'</b></span>';if(tempName.charAt(tempNameLastCharIndex)!='*'){tempDCO+='</a>';}
tempDCO+='</td><td align="right"><a href="javascript:sendChatTextButton(\'/givePoints '+ user_nodeonline[0].firstChild.nodeValue+'\');"><img src="http://www.360pal.com/images/fam/coins_add.png" border="0" alt="Give User a Point" title="Give this user a Point" /></a><a href="javascript:startPrivate(\''+ user_nodeonline[0].firstChild.nodeValue+'\');"><img src="http://www.360pal.com/images/fam/comment_add.png" border="0" alt="Instant Message this User" title="Instant Message this User" /></a></td></tr></table>';lastMessageOnline=(message_nodesonline[i].getAttribute('id'));}
setGameSpace('div_chatonline',tempDCO);var chat_divonline=document.getElementById('camstatsChatUpdatesBoxLatestActions');var xmldoconline=receiveReq.responseXML;var message_nodesonline=xmldoconline.getElementsByTagName("siteActions_4hds");var n_messagesonline=message_nodesonline.length
var tempDCO='';for(i=0;i<n_messagesonline;i++){var catAction_nodeonline=message_nodesonline[i].getElementsByTagName("catAction");var text_nodeonline=message_nodesonline[i].getElementsByTagName("text");tempDCO+='<table width="350" cellpadding="0" cellspacing="0" border="0"><tr><td width="16">';if(catAction_nodeonline[0].firstChild.nodeValue==1){tempDCO+='<img src="http://www.360pal.com/images/fam/thumb_up.png" width="16" height="16" align="left" title="Given a Thumbs Up">';}
else if(catAction_nodeonline[0].firstChild.nodeValue==2){tempDCO+='<img src="http://www.360pal.com/images/fam/thumb_down.png" width="16" height="16" align="left" title="Given a Thumbs Down">';}
else if(catAction_nodeonline[0].firstChild.nodeValue==3){tempDCO+='<img src="http://www.360pal.com/images/fam/link.png" width="16" height="16" align="left" title="Recently Opened">';}
tempDCO+='</td><td style="overflow: hidden;">';tempDCO+=text_nodeonline[0].firstChild.nodeValue+'</td></tr></table>';}
setGameSpace('camstatsChatUpdatesBoxLatestActions',tempDCO);var chat_divonline=document.getElementById('camstatsChatUpdatesBoxFavorites');var xmldoconline=receiveReq.responseXML;var message_nodesonline=xmldoconline.getElementsByTagName("siteActions_4hdsFavorites");var n_messagesonline=message_nodesonline.length
var tempDCO='';for(i=0;i<n_messagesonline;i++){var catAction_nodeonline=message_nodesonline[i].getElementsByTagName("catAction");var text_nodeonline=message_nodesonline[i].getElementsByTagName("text");tempDCO+='<table width="350" cellpadding="0" cellspacing="0" border="0"><tr><td width="20">'+ catAction_nodeonline[0].firstChild.nodeValue;tempDCO+='</td><td style="overflow: hidden;">';tempDCO+=text_nodeonline[0].firstChild.nodeValue+'</td></tr></table>';}
setGameSpace('camstatsChatUpdatesBoxFavorites',tempDCO);var chat_divonline=document.getElementById('camstatsChatUpdatesBoxExitLinks');var xmldoconline=receiveReq.responseXML;var message_nodesonline=xmldoconline.getElementsByTagName("siteActions_4hdsExitLinks");var n_messagesonline=message_nodesonline.length
var tempDCO='';for(i=0;i<n_messagesonline;i++){var catAction_nodeonline=message_nodesonline[i].getElementsByTagName("catAction");var text_nodeonline=message_nodesonline[i].getElementsByTagName("text");tempDCO+='<table cellpadding="0" cellspacing="0" border="0"><tr><td width="16">'+ catAction_nodeonline[0].firstChild.nodeValue;tempDCO+='</td><td style="overflow: hidden;">';tempDCO+=replaceURLWithHTMLLinks(text_nodeonline[0].firstChild.nodeValue)+'</td></tr></table>';}
setGameSpace('camstatsChatUpdatesBoxExitLinks',tempDCO);mTimer=setTimeout('getChatText()',chatRefreshRate);mTimerOnlineMod++;}}
function handleReceiveChatOnline(){if(receiveReqOnline.readyState==4){var chat_divonline=document.getElementById('div_chatonline');var xmldoconline=receiveReqOnline.responseXML;var message_nodesonline=xmldoconline.getElementsByTagName("message");var n_messagesonline=message_nodesonline.length
var tempDCO='';for(i=0;i<n_messagesonline;i++){var user_nodeonline=message_nodesonline[i].getElementsByTagName("user");var text_nodeonline=message_nodesonline[i].getElementsByTagName("text");var time_nodeonline=message_nodesonline[i].getElementsByTagName("time");var profile_nodeonline=message_nodesonline[i].getElementsByTagName("profile");if(text_nodeonline[0].firstChild.nodeValue==1){tempDCO+='<img src="images/chat/userstatus_'+ text_nodeonline[0].firstChild.nodeValue+'.gif" width="7" height="7" align="left" title="Available">';}
else if(text_nodeonline[0].firstChild.nodeValue==2){tempDCO+='<img src="images/chat/userstatus_'+ text_nodeonline[0].firstChild.nodeValue+'.gif" width="7" height="7" align="left" title="Away">';}
else if(text_nodeonline[0].firstChild.nodeValue==3){tempDCO+='<img src="images/chat/userstatus_'+ text_nodeonline[0].firstChild.nodeValue+'.gif" width="7" height="7" align="left" title="Offline">';}
else if(text_nodeonline[0].firstChild.nodeValue==4){tempDCO+='<img src="images/chat/userstatus_'+ text_nodeonline[0].firstChild.nodeValue+'.gif" width="7" height="7" align="left" title="Playing">';}
tempDCO+='<a href="http://www.360pal.com/user.php?username='+ user_nodeonline[0].firstChild.nodeValue+'" target="_blank" ONMOUSEOVER="popupProfile(\''+ profile_nodeonline[0].firstChild.nodeValue+'\',\'ffffff\')"; ONMOUSEOUT="kill()"><b>'+ user_nodeonline[0].firstChild.nodeValue+'</b></a><a href="javascript:startPrivate(\''+ user_nodeonline[0].firstChild.nodeValue+'\');">(PM)</a><br>';chat_divonline.scrollTop=chat_divonline.scrollHeight;lastMessageOnline=(message_nodesonline[i].getAttribute('id'));}
setGameSpace('div_chatonline',tempDCO);}}
function blockSubmit(){sendChatText();return false;}
function resetChat(){if(sendReq.readyState==4||sendReq.readyState==0){sendReq.open("POST",'getChat.php?chat='+ chatroomid+'&last='+ lastMessage,true);sendReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded');sendReq.onreadystatechange=handleResetChat;var param='action=reset';sendReq.send(param);document.getElementById('txt_message').value='';}}
function handleResetChat(){document.getElementById('div_chat').innerHTML='';}
function replaceURLWithHTMLLinks(text){var exp=/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;return text.replace(exp,"<a href=\"$1\" target=\"_blank\"  onClick=\"sendExitLinkChat('$1');\">$1</a>");}
function replaceURLWithHTMLLinksPrivate(text){var exp=/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;return text.replace(exp,"<a href=\"$1\" target=\"_blank\"  onClick=\"sendExitLinkChatPrivate('$1');\">$1</a>");}
