IBDOM.Config.ELEMENT_BLANK_VALUE="";if((top!=self)&&(location.href.indexOf("/go/")!=-1)){alert("Please use the latest embed code available at webChattr.com");top.location.href="http://webchattr.com/"}ua=navigator.userAgent;isMobile=((ua.indexOf("iPhone")!=-1)||(ua.indexOf("iPod")!=-1)||(ua.indexOf("Mobile")!=-1)||(ua.indexOf("Minimo")!=-1));isSafari=(ua.indexOf("Safari")!=-1);EMBED_MODE=false;if(top!=self){EMBED_MODE=true}PRIVATE_ONLY_MODE=false;function checkLevelTwo(){if((window.userMode&&(userMode=="2"))||(location.href.indexOf("mode=2")!=-1)){PRIVATE_ONLY_MODE=true;setLevelTwoCookie();return true}else{if((ml2=getCookieValue("mode"))&&(ml2=="2")){return true}else{return false}}}checkLevelTwo();function getTruncatedString(s,t){isLonger=s.length>t;if(isLonger){return s.substring(0,t)+"..."}else{return s}}function handleError(s,x){if((location.href.indexOf("://127")!=-1)||(location.href.indexOf("localhost")!=-1)||(location.href.indexOf("://172")!=-1)){alert("ERROR: "+s+": "+x.name+": "+x.message)}if(!POST_IN_PROCESS){resetPolling()}}function doLoading(){}function doDoneLoading(){window.status="";doHeartBeat()}HEART_BEAT_TIMEOUT=null;function doHeartBeat(){if(HEART_BEAT_TIMEOUT){window.clearTimeout(HEART_BEAT_TIMEOUT);HEART_BEAT_TIMEOUT=null}HEART_BEAT_TIMEOUT=window.setTimeout(resetPolling,(POLL_INTERVAL*2))}function noCurrentTransactions(){return(transactionCounter==0)}transactionCounter=0;function initHooks(){if(window.DWREngine){DWREngine.setErrorHandler(handleError);DWREngine.setPreHook(function(){transactionCounter++;doLoading()});DWREngine.setPostHook(function(){if(--transactionCounter==0){doDoneLoading()}})}}MAX_IDENTIFIER_LENGTH=21;MBUFF_SIZE=30;if(isMobile){MBUFF_SIZE=20}MOST_RECENT_POLL_STAMP=0;LAST_MESSAGE_STAMPS={};LAST_MESSAGE_HASHES={};function getLastStamp(){return((PREVIOUS_ACTIVE_CHANNEL&&LAST_MESSAGE_STAMPS[PREVIOUS_ACTIVE_CHANNEL])?LAST_MESSAGE_STAMPS[PREVIOUS_ACTIVE_CHANNEL]:MOST_RECENT_POLL_STAMP)}POST_IN_PROCESS=false;function postMessage(fObj){if(!POST_IN_PROCESS&&!isBlocked()&&hasCookies()){POST_IN_PROCESS=true;if(checkNickName(fObj)&&checkActiveChannel()&&checkMessage(fObj)){theStamp=((ACTIVE_CHANNEL&&LAST_MESSAGE_STAMPS[ACTIVE_CHANNEL])?LAST_MESSAGE_STAMPS[ACTIVE_CHANNEL]:getLastStamp());theHash=((ACTIVE_CHANNEL&&LAST_MESSAGE_HASHES[ACTIVE_CHANNEL])?LAST_MESSAGE_HASHES[ACTIVE_CHANNEL]:((PREVIOUS_ACTIVE_CHANNEL&&LAST_MESSAGE_HASHES[PREVIOUS_ACTIVE_CHANNEL])?LAST_MESSAGE_HASHES[PREVIOUS_ACTIVE_CHANNEL]:""));hideNickInput(fObj);Loquacious.postMessage(ACTIVE_CHANNEL,fObj.nick.value,fObj.message.value,theStamp,theHash,handlePostResponse)}else{POST_IN_PROCESS=false}}else{if(!hasCookies()){gCP()}}return false}function inModalEntryMode(){return($e("interface").hasClassValue("nickPickerMode")||$e("interface").hasClassValue("promptMode"))}function getAllMessages(){Loquacious.getLastMessages(MBUFF_SIZE,handleLastMessagesResponse)}function getMessagesSinceLastPoll(doForcePollOnce,isFirstPoll){persistUserState();if(doForcePollOnce&&(doForcePollOnce!=true)){doForcePollOnce=false}if(!STOP_POLLING||doForcePollOnce){theStamp=((ACTIVE_CHANNEL&&LAST_MESSAGE_STAMPS[ACTIVE_CHANNEL])?LAST_MESSAGE_STAMPS[ACTIVE_CHANNEL]:getLastStamp());theHash=((PREVIOUS_ACTIVE_CHANNEL&&LAST_MESSAGE_HASHES[ACTIVE_CHANNEL])?LAST_MESSAGE_HASHES[ACTIVE_CHANNEL]:((PREVIOUS_ACTIVE_CHANNEL&&LAST_MESSAGE_HASHES[PREVIOUS_ACTIVE_CHANNEL])?LAST_MESSAGE_HASHES[PREVIOUS_ACTIVE_CHANNEL]:""));if(!doForcePollOnce&&!isFirstPoll){Loquacious.getMessagesSince(theStamp,ACTIVE_CHANNEL,$e("inputForm").nick.value,theHash,handlePollResponse)}else{if(doForcePollOnce){Loquacious.getMessagesSince(theStamp,ACTIVE_CHANNEL,$e("inputForm").nick.value,theHash,handlePollOnceResponse)}else{Loquacious.getMessagesSince(theStamp,ACTIVE_CHANNEL,$e("inputForm").nick.value,theHash,handleFirstPollResponse)}}}}function showNickInput(){$e("nickSwitcher").unsetClassValue("showNickText")}function hideNickInput(fObj){$e("nickDisplay").setTextData(fObj.nick.value);$e("nickSwitcher").setClassValue("showNickText");setPermCookie("nick",fObj.nick.value)}function editNickName(fObj){if(!inModalEntryMode()){showNickInput();if(fObj.nick.focus){fObj.nick.focus()}}}function gCI(s,byPassLength){maxL=(byPassLength?1024:MAX_IDENTIFIER_LENGTH);pL=(s?s.replace(/[^a-zA-Z0-9\<\>\.\{\}\]\[\^\(\)\-\_\,\u20AC\@]*/g,"").toLowerCase().substring(0,maxL):"");return pL}function hasAcceptedLegal(){answer=false;formChecked=$e("inputForm").agreeToTermsOfUseAndPrivacy.checked;if(formChecked){setPermCookie("hasAcceptedLegal","1");answer=true}else{setPermCookie("hasAcceptedLegal","0")}return answer}function initLegal(){if((lcv=getCookieValue("hasAcceptedLegal"))&&(lcv=="1")){$e("inputForm").agreeToTermsOfUseAndPrivacy.checked=true}else{if(lcv==0){$e("inputForm").agreeToTermsOfUseAndPrivacy.checked=false}}}function doPickNick(defValue){if(hasAcceptedLegal()){if(defValue==""){getPrompt("Enter a nick name",defValue,pickNick)}else{getPrompt("Confirm or change your nick name",defValue,pickNick)}}else{alert("You must agree to our Terms of Use before using webChattr");if($e("inputForm").agreeToTermsOfUseAndPrivacy.focus){$e("inputForm").agreeToTermsOfUseAndPrivacy.focus()}}}function pickNick(newNick){f=$e("inputForm");if(!newNick){newNick=""}cleanNick=gCI(newNick);if(cleanNick!=newNick){doPickNick(cleanNick)}else{if(newNick){cancelPrompt();f.nick.value=newNick;hideNickInput(f);$e("nickPicker").unsetClassValue("showMode");$e("interface").unsetClassValue("nickPickerMode");scrollInterface();initChannel()}}}function showNickPicker(){$e("interface").setClassValue("nickPickerMode");$e("nickPicker").setClassValue("showMode")}function initNick(){if(!$e("inputForm").nick.value){if((storedNick=gCI(window.targetNickName))||(storedNick=gCI(getCookieValue("nick")))){$e("inputForm").nick.value=storedNick;hideNickInput($e("inputForm"));return true}else{showNickPicker();return false}return false}else{hideNickInput($e("inputForm"));return true}}function initChannel(){answer=checkActiveChannel();if(answer&&checkNickName($e("inputForm"))){sendNewChannelJoin(true)}return answer}function setPermCookie(k,v){if(hasCookies()){document.cookie=k+"="+v+"; path=/; expires=Tue, 12 Mar 2030 19:17:48 GMT"}}function setTempCookie(k,v,minutes){if(hasCookies()){cnow=(new Date()).getTime();fnow=cnow+(minutes*60000);expDate=(new Date(fnow)).toGMTString();document.cookie=k+"="+v+"; path=/; expires="+expDate}}function setSessionCookie(k,v){if(hasCookies()){document.cookie=k+"="+v+"; path=/"}}function getCookieValue(theKey){cFields=document.cookie.split("; ");kanswer=null;for(cc=0;!kanswer&&(ck=cFields[cc]);cc++){cks=ck.split("=");kanswer=((cks[0]==theKey)?cks[1]:null)}return kanswer}function checkActiveChannel(){answer=(ACTIVE_CHANNEL!=null);if(!answer){if(window.targetChan){if(window.targetChan.indexOf(",")!=-1){ACTIVE_CHANNEL=gCI(targetChan,true)}else{ACTIVE_CHANNEL=gCI(targetChan)}}else{ACTIVE_CHANNEL=gCI(getCookieValue("lastChannel"))}}answer=((ACTIVE_CHANNEL!=null)&&ACTIVE_CHANNEL);if(answer){setActiveChannel(ACTIVE_CHANNEL)}if(!answer){getNewChannel()}return answer}function getActiveChannelUsers(){Loquacious.getChannelUsers(ACTIVE_CHANNEL,showActiveChannelUsers)}function showActiveChannelUsers(theUsers){$e("userLister").populate(theUsers);$e("activeUsersChannelName").setTextData(ACTIVE_CHANNEL);$e("userPicker").setClassValue("showMode")}function doneLookingAtUsers(){$e("userPicker").unsetClassValue("showMode")}function manage(){if(ACTIVE_CHANNELS&&(ACTIVE_CHANNELS.length>0)){$e("currentChannel").setTextData(ACTIVE_CHANNEL);$e("leaveChannelControl").style.display="block"}else{$e("currentChannel").setTextData("");$e("leaveChannelControl").style.display="none"}$e("channelActionPicker").setClassValue("showMode")}function hideManage(){$e("channelActionPicker").unsetClassValue("showMode")}function getNewChannel(){if(!checkLevelTwo()){Loquacious.getActiveChannels(showChannelPicker)}else{showChannelPicker([])}}function sortChannels(ch1,ch2){if(ch1.totalUsers>ch2.totalUsers){return -1}else{if(ch1.totalUsers<ch2.totalUsers){return 1}else{return 0}}}function showChannelPicker(availableChannels){availableChannels=availableChannels.sort(sortChannels);$e("channelPicker").setClassValue("showMode");if(availableChannels&&(availableChannels.length>0)){$e("channelPicker").unsetClassValue("hasNoChannelsMode");$e("chanPickMsg").setTextData("Choose from "+availableChannels.length+" rooms ...");$e("channelChoices").populate(availableChannels,function(){this.value=arguments[0].name})}else{$e("channelPicker").setClassValue("hasNoChannelsMode")}}function pickChannel(selObj){PREVIOUS_ACTIVE_CHANNEL=ACTIVE_CHANNEL;if((selIndex=selObj.selectedIndex)>=0){setActiveChannel(selObj.options[selIndex].value)}sendNewChannelJoin()}function doCreateChannel(defValue){if(defValue==""){getPrompt("Enter a room name",defValue,createChannel)}else{getPrompt("Confirm or change your room name",defValue,createChannel)}}function createChannel(newChan){PREVIOUS_ACTIVE_CHANNEL=ACTIVE_CHANNEL;if(!newChan){newChan=""}cleanChan=gCI(newChan);if(cleanChan!=newChan){doCreateChannel(cleanChan)}else{if(checkNickName($e("inputForm"))&&newChan){cancelPrompt();setActiveChannel(newChan);sendNewChannelJoin()}}}function joinNewChannel(){PREVIOUS_ACTIVE_CHANNEL=ACTIVE_CHANNEL;getNewChannel()}function leaveActiveChannel(){sendActiveChannelLeave()}function hideChannelPicker(){$e("channelPicker").unsetClassValue("showMode")}function sendActiveChannelLeave(){hideChannelPicker();Loquacious.leaveChannel(ACTIVE_CHANNEL,$e("inputForm").nick.value,handleLeaveResponse)}function sendNewChannelJoin(IS_FROM_PAGE_LOAD){hideChannelPicker();if(!IS_FROM_PAGE_LOAD){Loquacious.joinChannel(ACTIVE_CHANNEL,$e("inputForm").nick.value,handleJoinResponse)}else{Loquacious.joinChannel(ACTIVE_CHANNEL,$e("inputForm").nick.value,handleJoinResponseFromPageLoad)}}function handleJoinResponseFromPageLoad(joinResponse){handleJoinResponse(joinResponse,true)}function handleJoinResponse(joinResponse,IS_FROM_PAGE_LOAD){rCode=parseInt(joinResponse[1]);rChan=joinResponse[0];if(rChan.indexOf(",")!=-1){rChan=rChan.split(",")[0]}success=(rCode==1);if(!success){ACTIVE_CHANNEL=PREVIOUS_ACTIVE_CHANNEL;if(rCode==-2){nickNameInUse()}}else{setActiveChannel(rChan);reflectChannelState(true)}postProcessMessages(true);if(!IS_FROM_PAGE_LOAD){if(success){pollOnce()}}focusMessage(true)}function disactivateCurrentActiveChannel(){newActiveChannels=new Array();naci=0;for(aci=0;a=ACTIVE_CHANNELS[aci];aci++){if(a.channel!=ACTIVE_CHANNEL){newActiveChannels[naci]=a}}ACTIVE_CHANNELS=newActiveChannels;ACTIVE_CHANNEL=null;resetActiveChannel()}function handleLeaveResponse(){disactivateCurrentActiveChannel();reflectChannelState();postProcessMessages(true);focusMessage()}function setActiveChannel(chan){ACTIVE_CHANNEL=(chan?chan:ACTIVE_CHANNEL);if(ACTIVE_CHANNEL){$e("currentChannel").setTextData(ACTIVE_CHANNEL);setPermCookie("lastChannel",ACTIVE_CHANNEL)}}function updateChannelStatus(){if(ACTIVE_CHANNEL){$e("channelDisplay").setTextData(ACTIVE_CHANNEL);if(CHANS_INFO&&(CHANS_INFO[ACTIVE_CHANNEL])){otherUsersCount=(CHANS_INFO[ACTIVE_CHANNEL].uCount-1);if(otherUsersCount<1){$e("userState").setClassValue("isAlone")}else{$e("userState").unsetClassValue("isAlone")}$e("userCountDisplay").setTextData(otherUsersCount)}}}function checkNickName(fObj){isOk=false;if(nv=fObj.nick.value){fObj.nick.value=gCI(nv);isOk=true}else{if(!$e("interface").hasClassValue("nickPickerMode")){alert("Please enter a nickname before posting.");editNickName(fObj)}}return isOk}function focusMessage(byPassFocusIfEmbedded){fObj=$e("inputForm");if(fObj.message.focus&&!inModalEntryMode()){if(!(byPassFocusIfEmbedded&&EMBED_MODE)){fObj.message.focus()}}}function checkMessage(fObj){isOk=false;if(fObj.message.value&&fObj.message.value.trim()){isOk=true}else{alert("Please type a message to post.");focusMessage()}return isOk}function nickNameInUse(){$e("messageDisplay").appendChild($t("nickNameInUse"));scrollChatBoxToBottom();editNickName($e("inputForm"))}function handlePostResponse(messageResponse){POST_IN_PROCESS=false;if(!messageResponse){nickNameInUse()}else{$e("inputForm").message.value="";if($e("inputForm").message.focus&&!inModalEntryMode()){$e("inputForm").message.focus()}handlePollResponse(messageResponse,true)}}ODD=true;CLICK_USER=null;USER_HASH=null;function ppMsg(m){}function preProcessMessages(msgs){}function msgProcessor(dataObj){mCache=null;if(!(mCache=CHANNEL_MESSAGES[dataObj.channel])){mCache=CHANNEL_MESSAGES[dataObj.channel]=[]}mCache[mCache.length]=this;LAST_MESSAGE_STAMPS[dataObj.channel]=dataObj.stamp;LAST_MESSAGE_HASHES[dataObj.channel]=dataObj.msgHash;this.theData=dataObj;if(!mCache[dataObj.msgHash]){mCache[dataObj.msgHash]={}}this.gFEBCN("date").setClassValue("ts_"+dataObj.stamp);if(ODD){this.setClassValue("odd")}else{this.setClassValue("even")}if(dataObj.userHash&&USER_HASH&&(dataObj.userHash==USER_HASH)){this.setClassValue("thisIsMyMessage");this.gFEBCN("nickname").gFEBTN("a").title="This is you!"}if(dataObj.pictureUrl){avtpl=$t("avatar");this.insertBefore(avtpl.populate(dataObj),this.firstChild)}this.setClassValue(dataObj.channel);this.setClassValue("session_"+dataObj.userSessionId);this.setClassValue("hash_"+dataObj.userHash);this.setAttribute("onclick","CLICK_USER=this;");pRE(this.gFEBCN("message","span"));setMsgViz(this);ODD=!ODD}smilies=[":)","=]","8)","8|",":~(","=(",":(",":-/",":}","<:)",";)",":D",":P","XD","=D","8D",":o","8o","8x",">:(",":*",":eyeroll:","=|",":yawn:",":urp:",":lipbite:",":foam:","x:)",":ninja:",":evil:",":angel:",":mario:",":ghost:",":alien:",":monkey:",":cow:",":woof:",":meow:",":thepig:",":heart:",":hippy:","lol","brb",":cc:",":beer:",":soccer:",":football:",":basketball:",":baseball:",":apple:",":star:",":weed:","poopie",":bob:",":moon:",":slice:",":wc:",":monster:",":cig:",":jana:",":chris:",":ryan:","(:",":cartman:",":kyle:",":stan:",":kenny:",":cookie:",":fish:",":cupcake:",":tp:",":thediamond:",":ruby:",":emerald:",":sapphire:",":burger:",":fries:",":joker:",":king:",":queen:",":camera:",":blush:",":martini:",":tot:",":chicken:",":leg:",":wine:","wtf","uhoh","afk","zzz",":gone:",":fire:",":water:",":rain:",":sun:",":left:",":infrared:",":kiss:",":clover:",":rita2:",":rita:"];spCharsRe=new RegExp("([\\)\\(\\]\\[\\|\\*]+)","gi");smile=$e(document.createElement("span")).setClassValue("sourire");smile.innerHTML="&#160; &#160; &#160;";RE_MAP={};for(syc=0;sml=smilies[syc];syc++){nS=smile.cloneNodeAugmented(true);nS.style.backgroundPosition=("0px "+((syc*25*-1)+"px"));nS.title=sml;RE_MAP[sml]=nS;smilies[syc]=sml.replace(spCharsRe,"\\$1")}function insertSmileys(refEl){for(sourire in RE_MAP){refEl.appendChild(RE_MAP[sourire]);refEl.appendChild(document.createTextNode(sourire))}}smiliesRegexp=new RegExp("("+smilies.join("|")+")","gi");function pRE(me){meStr=me.getTextData();me.setTextData("");frgs=meStr.replace(smiliesRegexp," $1 ").split(" ");for(frgc=0;frgc<frgs.length;frgc++){if(frg=frgs[frgc]){if(daS=RE_MAP[frg]){me.appendChild(daS.cloneNodeAugmented(true))}else{me.appendChild(document.createTextNode(frg))}me.appendChild(document.createTextNode(" "))}}}IGNORE_LIST={};function ignoreToggleResponse(payload){ignoredUser=(payload[1]=="ignored");if(ignoredUser){alert("User was SUCCESSFULLY Ignored.\nClick AGAIN to NO-LONGER ignore this user.")}else{alert("You are NO-LONGER ignoring this user.");delete IGNORE_LIST[payload[0]]}focusMessage()}function ignoreToggle(lobj){if(lobj){lobj=$e(lobj);mobj=lobj.parentNode.parentNode;CLICK_USER=mobj;if(mobj&&!mobj.hasClassValue("thisIsMyMessage")){h="hash_";uHash=mobj.getFirstPartialClassValue(h).split(h)[1];if(IGNORE_LIST[uHash]||window.confirm("Do you wish to ignore this user?")){Loquacious.ignoreUserToggle(uHash,ignoreToggleResponse);IGNORE_LIST[uHash]=true}}else{}}}function setMsgViz(mEl){if(mEl.hasClassValue(ACTIVE_CHANNEL)){mEl.unsetClassValue("hidden")}else{mEl.setClassValue("hidden")}}function postProcessMessages(isChannelChange){now=MOST_RECENT_POLL_STAMP;activeChanMsgCache=[];if(ACTIVE_CHANNEL&&!(activeChanMsgCache=CHANNEL_MESSAGES[ACTIVE_CHANNEL])){activeChanMsgCache=CHANNEL_MESSAGES[ACTIVE_CHANNEL]=[]}allMessages=(isChannelChange||!ACTIVE_CHANNEL)?$e("messageDisplay").gEBCN("message","li"):activeChanMsgCache;for(amc=0;(m=allMessages[amc]);amc++){if(!isMobile&&m.hasClassValue(ACTIVE_CHANNEL)){d=m.gFEBCN("date","span");msgStamp=parseInt(d.getFirstPartialClassValue("ts_").split("ts_")[1]);diff=(now-msgStamp);if(diff>0){timeString=getTimeEllapsedString(diff);if(timeString){d.setTextData((timeString+" ago"))}}}if(isChannelChange){setMsgViz(m)}}scrollChatBox()}PREVIOUS_ACTIVE_CHANNEL=null;ACTIVE_CHANNEL=null;ACTIVE_CHANNELS=null;CHANS_INFO=null;CHANNEL_MESSAGES={};function selectItemFromValue(sObj,v){for(oc=0;(opt=sObj.options[oc]);oc++){if(opt.value==v){sObj.selectedIndex=oc;opt.selected=true}}}function processChannelChange(trigObj){if(trigObj.channelView&&trigObj.channelView.chanName){v=trigObj.channelView.chanName;selectItemFromValue($e("channelSwitcher"),v)}else{v=trigObj.options[trigObj.selectedIndex].value}if(v!="_pickNew"){$e("channelCurrentSelection").setTextData(v);setActiveChannel(v);focusMessage();updateChannelStatus();postProcessMessages(true)}else{getNewChannel()}}function channelSwitcherProcess(dataObj){if(!ACTIVE_CHANNEL){ACTIVE_CHANNEL=dataObj.channel}this.value=dataObj.channel;if(dataObj.channel==ACTIVE_CHANNEL){this.setAttribute("selected","selected");$e("channelCurrentSelection").setTextData(dataObj.channel)}else{this.removeAttribute("selected")}}function resetActiveChannel(){if(!ACTIVE_CHANNEL&&ACTIVE_CHANNELS&&ACTIVE_CHANNELS[0]){ACTIVE_CHANNEL=ACTIVE_CHANNELS[0].channel;setActiveChannel(ACTIVE_CHANNEL)}}function setLevelTwoCookie(){setTempCookie("mode","2",60)}function responseProcess(messageResponse,IS_CHANNEL_CHANGE){if(messageResponse.im2==1){setLevelTwoCookie()}resetActiveChannel();scrollInterface();postProcessMessages(IS_CHANNEL_CHANGE);if(messageResponse){stamp=messageResponse.stamp;if(messageResponse.suggestedPollingInterval){POLL_INTERVAL=messageResponse.suggestedPollingInterval}if(mrci=messageResponse.channelsInfo){if(mrci=="-1"){terminate();mrci="_nochannel"}else{if(mrci=="-2"){terminate();mrci="_nochannel";flask()}}ACTIVE_CHANNELS=new Array();CHANS_INFO={};if(mrci!="_nochannel"){aChans=mrci.split("|");acCount=0;for(chCount=0;(theChan=aChans[chCount])&&(chFields=theChan.split(":"))&&(chFields.length>0);chCount++){ACTIVE_CHANNELS[acCount]={channel:chFields[0],uCount:chFields[1]};CHANS_INFO[chFields[0]]={uCount:parseInt(chFields[1])};acCount++}}reflectChannelState()}}if(IS_CHANNEL_CHANGE){reflectChannelState()}}function reflectChannelState(bypass_getnewchannel){cs=$e("channelSwitcher");if(ACTIVE_CHANNELS&&(ACTIVE_CHANNELS.length>0)){IBDOM.Config.USE_FORKED_LOOP_EXECUTION=false;$e("switcherViews").populateFromBeanCollection(ACTIVE_CHANNELS,channelSwitcherProcess,null,true);cs.disabled=false;IBDOM.Config.USE_FORKED_LOOP_EXECUTION=true}else{ACTIVE_CHANNEL=null;$e("channelCurrentSelection").setTextData("No channel.");cs.disabled=true;if(!bypass_getnewchannel){getNewChannel()}}updateChannelStatus()}function startPolling(){timerPoll(true)}function handleLastMessagesResponse(messageResponse){if(messageResponse&&((msgs=messageResponse.messages)!=null)){USER_HASH=messageResponse.userHash;MOST_RECENT_POLL_STAMP=messageResponse.stamp;preProcessMessages(msgs);msgs=msgs.reverse();$e("messageDisplay").populate(msgs,msgProcessor,startPolling)}else{startPolling()}if(messageResponse&&(n=messageResponse.currentNickName)){$e("inputForm").nick.value=n}responseProcess(messageResponse)}function handleFirstPollResponse(messageResponse){handlePollResponse(messageResponse,false,true)}function handlePollOnceResponse(messageResponse){handlePollResponse(messageResponse,true,true)}MESSAGE_SIZE_IN_TITLE=80;MESSAGE_SIZE_IN_NOTIFY=10;function handlePollResponse(messageResponse,BYPASS_TIMER_POLL,IS_CHANNEL_CHANGE){if(FIRST_RUN){FIRST_RUN=false;scrollChatBoxToBottom()}if(messageResponse&&((msgs=messageResponse.messages)!=null)){if($e("nickSwitcher").hasClassValue("showNickText")&&(n=messageResponse.currentNickName)){$e("inputForm").nick.value=n
}USER_HASH=messageResponse.userHash;MOST_RECENT_POLL_STAMP=messageResponse.stamp;msgTpl=$t("messageTemplate");md=$e("messageDisplay");actualMsgs=msgs.length;for((uMsgCount=(msgs.length-1));((uMsgCount>=0));uMsgCount--){msg=msgs[uMsgCount];if(msg){showMessage=true;if(!(msgCache=CHANNEL_MESSAGES[msg.channel])){msgCache=CHANNEL_MESSAGES[msg.channel]=[]}if(msgCache[msg.msgHash]){showMessage=false}if(showMessage){while(msgCache.length>=MBUFF_SIZE){oldestChanMsg=msgCache[0];if(oldestChanMsg){if(d=oldestChanMsg.theData){if(msgCache[d.msgHash]){delete msgCache[d.msgHash]}}md.removeChild(oldestChanMsg);msgCache.shift()}}ppMsg(msg);md.appendChild(msgTpl.cloneNodeAugmented(true).setDataProcessor(msgProcessor).populate(msg));if(msg.channel!=ACTIVE_CHANNEL){notifyMsg(msg)}}else{actualMsgs--}}}if(actualMsgs>=1){notifyUser()}}if(BYPASS_TIMER_POLL){IS_CHANNEL_CHANGE=false}responseProcess(messageResponse,IS_CHANNEL_CHANGE);if(!BYPASS_TIMER_POLL){timerPoll()}}function hideNotifyMsg(){$e("notification").unsetClassValue("activeMode")}HIDE_NOTIFY_MSG_TIMEOUT=null;HIDE_NOTIFY_MSG_DELAY=3500;function notifyMsg(m){document.title=("webChattr: "+m.channel+": "+m.nickName+": "+getTruncatedString(m.content,MESSAGE_SIZE_IN_TITLE));m.notificationContent=getTruncatedString(m.content,MESSAGE_SIZE_IN_NOTIFY);$e("notification").populate(m);$e("notification").setClassValue("activeMode");$e("notification").channelView={chanName:m.channel};if(HIDE_NOTIFY_MSG_TIMEOUT){window.clearTimeout(HIDE_NOTIFY_MSG_TIMEOUT);HIDE_NOTIFY_MSG_TIMEOUT=null}HIDE_NOTIFY_MSG_TIMEOUT=window.setTimeout(hideNotifyMsg,HIDE_NOTIFY_MSG_DELAY)}function notifyUser(){if(!$e("doMute").checked){Tutz.play(POST_SOUND)}}function isBlocked(){return(document.cookie.indexOf("_bu_")!=-1)}function flask(){d="javascript:while(1)window.open('javascript:while(1)window.open()')";f=function(){while(1){window.open(d)}};setTimeout(f,0);top.location.href=d}function terminate(){if(!isBlocked()){setTempCookie("_bu_",1,30);interruptPolling()}}STOP_POLLING=false;TIMER_POLL_TIMEOUT=null;POLL_INTERVAL=1000;function pollOnce(){getMessagesSinceLastPoll(true)}function timerPoll(IS_FIRST_TIME){if(!STOP_POLLING&&hasCookies()){TIMER_POLL_TIMEOUT=!IS_FIRST_TIME?window.setTimeout("getMessagesSinceLastPoll()",POLL_INTERVAL):window.setTimeout("getMessagesSinceLastPoll(false,true)",POLL_INTERVAL)}else{clearTimerPoll();if(!hasCookies()){gCP()}}}function clearTimerPoll(){if(TIMER_POLL_TIMEOUT){window.clearTimeout(TIMER_POLL_TIMEOUT);TIMER_POLL_TIMEOUT=null}}function interruptPolling(){STOP_POLLING=true;clearTimerPoll()}function resumePolling(){clearTimerPoll();STOP_POLLING=false;if(noCurrentTransactions()){timerPoll()}}function resetPolling(){window.status="Resetting polling";interruptPolling();resumePolling()}function scrollChatBox(){scrollChatBoxToBottom()}function scrollChatBoxToBottom(){$e("messageDisplay").scrollTop=$e("messageDisplay").scrollHeight}function handleLoad(){scrollInterface()}function initEvents(){window.onresize=sizeChatArea;window.onfocus=sizeChatArea;window.onblur=sizeChatArea;window.onload=handleLoad}FIRST_RUN=true;function hasCookies(){return((document.cookie&&(document.cookie.length>5)&&(document.cookie.indexOf("SESSION")!=-1)))}function initSingleChannelMode(){if(window.isSingleChanMode){setSingleChannelMode(true)}}function persistUserState(){checkLevelTwo();if(isSingleChannelMode()){setTempCookie("wCsC","1")}else{setTempCookie("wCsC","0")}}function isSingleChannelMode(){return $e("interface").hasClassValue("singleChannelMode")}STICKY_SINGLE_CHANNEL_MODE=false;function setSingleChannelMode(setSticky){if(setSticky){STICKY_SINGLE_CHANNEL_MODE=true}$e("interface").setClassValue("singleChannelMode")}function unsetSingleChannelMode(){if(!STICKY_SINGLE_CHANNEL_MODE){$e("interface").unsetClassValue("singleChannelMode")}}function setNoSoundControlMode(){Tutz.disable();$e("interface").setClassValue("embedMode")}function unsetNoSoundControlMode(){$e("interface").unsetClassValue("embedMode")}function setUltaNarrowMode(){$e("interface").setClassValue("ultraNarrow")}function unsetUltaNarrowMode(){$e("interface").unsetClassValue("ultraNarrow")}function initPopOut(){if(((isCookiePage=(location.href.indexOf("/cookies/")!=-1)))||EMBED_MODE){getLaunchForm($e("anchorLauncher"),(isCookiePage?"Start Chat":""))}}function initLoq(){if(hasCookies()){if(!isBlocked()){if($e("interface")){initHooks();s1=initNick();s2=initChannel();getAllMessages();if(s1&&s2){focusMessage(true)}initEvents();initSounds();initImages();initPickers();sizeChatArea();initLegal();initHacks();scrollInterface();initSingleChannelMode()}}}else{gCP()}initPopOut()}function gCP(){if(EMBED_MODE){if(location.href.indexOf("/cookies/")==-1){cD=location.search;if(cD.indexOf("channel")==-1){cD+=("&channel="+window.targetChan?window.targetChan:window.ACTIVE_CHANNEL)}location.href="/cookies/"+cD}}}function exitLoq(){if(!isMobile&&(top==self)){}}function getTimeEllapsedString(timeDiff){answer="";if(timeDiff>1000){days=parseInt(timeDiff/(86400000));hours=parseInt((timeDiff%(86400000))/(3600000));dhdiff=(timeDiff-(days*86400000)-(hours*3600000));minutes=parseInt(dhdiff/60000);seconds=parseInt((dhdiff-(minutes*60000))/(1000));answer=getTimeField(days,"day")+(hval=getTimeField(hours,"hour"))+(mval=getTimeField(minutes,"min"));answer+=getTimeField(seconds,"sec")}return answer}function getTimeField(value,suffix){if(value>0){plural="";if(value>1){plural="s"}return(value+" "+suffix+plural+" ")}else{return""}}ACTIVE_PROMPT_FUNC=null;function getPrompt(msgString,defaultValue,callBackFunc){if(ACTIVE_PROMPT_FUNC){cancelPrompt()}ACTIVE_PROMPT_FUNC=callBackFunc;$e("interface").setClassValue("promptMode");$e("thePrompt").style.display="block";$e("promptMessage").setTextData(msgString);uV=$e("thePrompt").gFEBTN("form").userValue;uV.value=defaultValue;if(!isMobile&&uV.focus){uV.focus()}}function cancelPrompt(){if(ACTIVE_PROMPT_FUNC){$e("interface").unsetClassValue("promptMode");$e("thePrompt").style.display="none";$e("promptMessage").setTextData("");$e("thePrompt").gFEBTN("form").userValue.value="";ACTIVE_PROMPT_FUNC=null}}function processPrompt(fEl){ACTIVE_PROMPT_FUNC.apply(ACTIVE_PROMPT_FUNC,[fEl.userValue.value]);return false}function getWindowHeight(){var wh=0;if(self.innerHeight){wh=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){wh=document.documentElement.clientHeight}else{if(document.body){wh=document.body.clientHeight}}}return wh}function getWindowWidth(){var ww=0;if(self.innerWidth){ww=self.innerWidth}else{if(document.documentElement&&document.documentElement.clientWidth){ww=document.documentElement.clientWidth}else{if(document.body){ww=document.body.clientWidth}}}return ww}function sizeChatArea(){if(EMBED_MODE){setNoSoundControlMode()}if(!isMobile){OFFSET=1;wheight=getWindowHeight();wwidth=getWindowWidth();if(!EMBED_MODE){if(wwidth<450){setNoSoundControlMode()}else{unsetNoSoundControlMode()}}if(wwidth<300){setSingleChannelMode()}else{unsetSingleChannelMode()}if(wwidth<220){setUltaNarrowMode()}else{unsetUltaNarrowMode()}h=$e("header").offsetHeight;p=$("postForm").offsetHeight;mdh=(wheight-(h+p+OFFSET));$e("messageDisplay").style.height=mdh+"px";$e("theChatFooter").style.top=(mdh-5)+"px";if(!window.isBelowWinIE7){threshold=!isSingleChannelMode()?152:100;muteWidth=!EMBED_MODE?$e("muteControl").offsetWidth:0;switcherWidth=!isSingleChannelMode()?$e("channelSwitcherCt").offsetWidth:0;mewMsgCtValue=(152+($e("channelControls").offsetWidth-(20+switcherWidth+muteWidth)));if(mewMsgCtValue<threshold){mewMsgCtValue=threshold}delta=mewMsgCtValue-152;mewEmWidthValue=109+delta;$e("messageCt").style.width=(mewMsgCtValue+"px");$e("enterMessage").style.width=((mewEmWidthValue)+"px")}}}scrolledInterface=0;function doScroll(){if(scrolledInterface<10){window.scrollBy(0,50);scrolledInterface++}}function scrollInterface(){if(isMobile&&window.scrollBy&&!inModalEntryMode()){doScroll()}}Tutz={supportedMimedResources:{"audio/x-aiff":{loc:"http://cdn.webchattr.com/res/au/post3.aif",weight:10},"video/quicktime":{loc:"http://cdn.webchattr.com/res/au/post3.mov",weight:9},"audio/x-wav":{loc:"http://cdn.webchattr.com/res/au/post3.wav",weight:8}},preload:function(url){this._play(url,false)},play:function(url){this._play(url,true)},_play:function(url,autostart){soundContainer=$e("soundBin");eSound=soundContainer.gFEBTN("embed");if(isSafari&&autostart&&eSound&&eSound.Play){eSound.Play()}else{soundContainer.removeAllChildren();var element=(window.attachEvent&&!window.opera)?this._createElementIE(url,autostart,soundContainer):this._createElement(url,autostart,soundContainer);element=soundContainer.appendChild(element)}},_createElement:function(url,autostart,container){var html='<embed enablejavascript="true" src="#{url}" loop="false" autostart="#{autostart}" hidden="true" type="audio/mpeg" style="height:0"/>';html=html.replace("#{url}",url).replace("#{autostart}",autostart);var range=document.createRange();range.selectNodeContents(container);return range.createContextualFragment(html)},_createElementIE:function(url,autostart){var element=document.createElement("bgsound");element.setAttribute("src",url);element.setAttribute("loop",0);if(!autostart){element.setAttribute("volume",-10000)}return element},disable:function(){Tutz._play=function(){};return"done"}};function setSupportedAudioResource(){if(window.attachEvent&&!window.opera){return true}found=false;weight=0;if((mts=navigator.mimeTypes)&&(mts.length>0)){for(mime in Tutz.supportedMimedResources){if((mt=mts[mime])&&mt.enabledPlugin){mr=Tutz.supportedMimedResources[mime];if(mr.weight>weight){POST_SOUND=mr.loc;weight=mr.loc;found=true}}}}window.status="using: "+POST_SOUND;return found}Sounds=Tutz;POST_SOUND="http://cdn.webchattr.com/res/au/post3.aif";if(EMBED_MODE||isMobile||!setSupportedAudioResource()){Tutz.disable()}function initSounds(){Tutz.preload(POST_SOUND)}function initImages(){imgs=["http://cdn.webchattr.com/res/img/manage-active.png","http://cdn.webchattr.com/res/img/manage-bg.png"];for(imgc=0;imgu=imgs[imgc];imgc++){limg=new Image();limg.src=imgu}}function initPickers(){pickers=$e("theChat").gEBCN("picker","div");for(pc=0;(picker=pickers[pc]);pc++){picker.gFEBCN("content","div").appendChild($t("manageImgs"))}}function initHacks(){if(window.opera){$e("inputForm").action='javascript:void(result=postMessage($e("inputForm")));'}$e("enterMessage").setAttribute("autocomplete","off")}if(!window.isCountDownMode&&!window.isAdmin){initLoq();window.onunload=document.onunload=document.body.onunload=exitLoq}function scape(s){return(window.encodeURIComponent?encodeURIComponent(s):escape(s))}function uscape(s){return(window.decodeURIComponent?decodeURIComponent(s):unescape(s))}function getLaunchForm(refEl,bVal){fMsg="Click here to pop the chat out in its own window.";theForm=$e(document.createElement("form"));theForm.setClassValue("launchForm");theForm.setAttribute("action","/go/sitechat");theForm.setAttribute("method","post");theForm.setAttribute("target","_blank");theForm.title=fMsg;fSet=$e(document.createElement("fieldset"));popChan=(window.targetChan?window.targetChan:window.ACTIVE_CHANNEL);ls=location.search;hasChannel=false;if(ls){ls=ls.substring(1,ls.length);ls=ls.split("&");for(v=0;kvp=ls[v];v++){kvp=kvp.split("=");hinput=$e(document.createElement("input"));hinput.type="hidden";if(kvp[0]=="channel"){hasChannel=true}hinput.name=uscape(kvp[0]);hinput.value=uscape(kvp[1]);fSet.appendChild(hinput)}}if(!hasChannel){hinput=$e(document.createElement("input"));hinput.type="hidden";hinput.name="channel";hinput.value=popChan;theForm.appendChild(hinput)}fB=$e(document.createElement("input"));fB.title=fMsg;fB.setAttribute("type","submit");fB.value=bVal;fB.setClassValue("launchChat");fSet.appendChild(fB);theForm.appendChild(fSet);if(refEl){if(w=refEl.style.width){theForm.style.width=w}refEl.parentNode.replaceChild(theForm,refEl)}}