var _shoutApp="";var _shoutAudio=false;var _shoutAudioMute=false;var _shoutAudioStatus="0";var _shoutAudioStop=false;var _shoutColor=1;var _shoutDoc=null;var _shoutFullLoad=0;var _shoutIdle=0;var _shoutLastPost=null;var _shoutMsgs={};var _shoutRRate=2000;var _shoutRRateMax=5000;var _shoutSettings={};var _shoutScrollDown=true;var _shoutScrollInit=false;var _shoutScrollLast=-1;var _shoutScrollTop=0;var _shoutState=0;if(_shoutFullScreen==undefined){var _shoutFullScreen=false}window.onload=function(){_shoutFullLoad=1};function _shoutStart(h,e,f){_shoutDoc=document.getElementById(h);if(document.getElementById("shoutboxMute")!=null&&(f=="1"||f=="2")){var g=document.createElement("embed");g.src="/shout/audio.swf?u=20100815";g.quality="high";g.type="application/x-shockwave-flash";g.width=1;g.height=1;g.swLiveConnect=true;g.wmode="transparent";_shoutDoc.parentNode.insertBefore(g,_shoutDoc);_shoutAudio=g;_shoutAudioStatus=f;if(_shoutGet("isMuted")=="1"||(_shoutGet("isMuted")==""&&f=="1")){_shoutMute()}else{_shoutUnmute()}}_shoutDoc.onscroll=function(b){if(_shoutScrollInit&&_shoutScrollLast!=_shoutDoc.scrollTop&&!_shoutScrollTop&&!_shoutState){var c=_shoutScrollLast-_shoutDoc.scrollTop>0;var a=Math.max(0,_shoutDoc.scrollHeight-_shoutDoc.offsetHeight-_shoutDoc.scrollTop);_shoutScrollDown=(!c&&a<50)||_shoutScrollLast==-1;_shoutScrollLast=_shoutDoc.scrollTop}};_shoutLastPost=new Date().getTime();_shoutApp=e;_shoutRRate=_shoutRRateMax;_shoutScrollBottom();var d=_shoutDoc.innerHTML+"ENDOFFILE";_shoutDoc.innerHTML="";_shoutUpdate(d);setTimeout("_shoutGetContent()",_shoutRRateMax);window.onresize=function(){_shoutResize()};_shoutResize()}function _shoutResize(){if(_shoutFullScreen==true){var b=_shoutScrollHeight()-_shoutWindowHeight();var a=_shoutDoc.offsetHeight-b-2;_shoutDoc.style.height=Math.max(50,(_shoutDoc.offsetHeight-b-2)).toString()+"px";_shoutDoc.style.width=_shoutWindowWidth().toString()+"px";_shoutScrollBottom()}}function _shoutGetContent(c,d){_shoutAjax("/shout/shout"+_shoutApp+".html?"+new Date().getTime(),"_shoutContent(xmlHttp.responseText,"+new Date().getTime()+","+c+","+d+");")}function _shoutContent(h,i,j,g){if(i>=_shoutLastPost&&_shoutState!=1){_shoutUpdate(h,g)}var f=new Date().getTime()-_shoutLastPost;if(f>1000*60*60){if(!_shoutIdle){_shoutDoc.innerHTML+='<br /><div style="background:#FFFFFF;text-align:center"><b><a href="javascript:;" onclick="_shoutRefresh();setTimeout(\'_shoutGetContent()\',_shoutRRateMax);" style="color:#000000">You have been idle for more than 1 hour. Please click here to refresh the chat box.</a></b></div>';_shoutIdle=1;_shoutScrollBottom()}}_shoutRRate+=(Math.ceil((new Date().getTime()-_shoutLastPost)*0.005));_shoutRRate=Math.min(_shoutRRateMax,Math.max(2000,_shoutRRate),_shoutRRate);if(j!==false&&!_shoutIdle){setTimeout("_shoutGetContent()",_shoutRRate)}}function _shoutPost(k,p,l,m,o){var n=document.getElementById(l);var j=document.getElementById(k);o.disabled=true;n.blur();n.disabled=true;j.value=_shoutTrim(j.value);if(j.value==p||j.value==""){alert("Please enter your name.");o.disabled=false;n.disabled=false;j.value="";j.focus();return}n.value=_shoutTrim(n.value);if(m!=""){var i=new RegExp("^"+m,"i");n.value=n.value.replace(i,"")}if(n.value==m||n.value==""){alert("Please enter your message.");o.disabled=false;n.disabled=false;n.value="";n.focus();return}msgVal=n.value;_shoutAjax("/shout/post.php?name="+escape(j.value)+"&msg="+escape(msgVal)+"&nocache="+new Date().getTime(),"_shoutPosted(xmlHttp.responseText,'"+o.id+"','"+l+"','"+m+"');");_shoutLastPost=new Date().getTime()}function _shoutPosted(j,h,i,f){var g=document.getElementById(i);g.disabled=false;document.getElementById(h).disabled=false;if(j.match(/^ERROR=/)){j=j.replace(/ERROR=/,"");alert(j);return}g.value="";g.focus();_shoutAudioPlay();_shoutUpdate(j)}function _shoutAudioPlay(){if(!_shoutAudioMute&&_shoutAudioStop&&_shoutAudio!=""&&typeof(_shoutAudio.GotoFrame)!="undefined"){_shoutAudio.GotoFrame(3);_shoutAudioStop=false}}function _shoutUpdate(s,t){if(_shoutState==1){return}_shoutState=1;if(!s.match(/ENDOFFILE$/)){return}s=_shoutTrim(s.replace(/ENDOFFILE$/,""));if(_shoutEmpty(_shoutMsgs)){_shoutDoc.innerHTML=""}var A=s.split("/-->");var u="";var i="";var y=0;var q={};var v=0;for(var w in A){if(typeof(A[w])!="string"){continue}var z=_shoutTrim(A[w]);var B=z.match(/[0-9]+$/);if(B==null||z==""){continue}var r=_shoutMsgs[B]!=undefined&&_shoutMsgs[B]!="";z=z.replace(/<!--\/SEP[0-9]+/,"");if(y==0){if(r){y=_shoutMsgs[B].match(/shoutBg1/)?1:2}else{y=_shoutColor}_shoutColor=y}if(y==2){z=z.replace(/shoutBg1/g,"shoutBg2")}else{z=z.replace(/shoutBg2/g,"shoutBg1")}var p='<div id="__shout'+B+'">'+z+"</div>";if(r&&_shoutMsgs[B]!=p){document.getElementById("__shout"+B).innerHTML=z}_shoutMsgs[B]=p;y=y==1?2:1;if(!r){_shoutAudioPlay();if(!v){v=2}u+=p}else{if(v==2){v=1}}i+=p;q[B]=p}if(!_shoutEmpty(_shoutMsgs)){for(var B in _shoutMsgs){if(_shoutTrim(_shoutMsgs[B])==""){continue}if(q[B]==undefined){_shoutMsgs[B]="";if(document.getElementById("__shout"+B)!=undefined){document.getElementById("__shout"+B).parentNode.removeChild(document.getElementById("__shout"+B))}}}}if(v==1){_shoutDoc.innerHTML="";u=i}var C=document.createElement("div");C.innerHTML=u;_shoutDoc.appendChild(C);if(_shoutScrollDown){setTimeout("_shoutScroll();_shoutScrollTop = 0;",1)}else{if(t){setTimeout("_shoutDoc.scrollTop = _shoutScrollTop;_shoutScrollTop = 0;",1)}else{_shoutScrollTop=0}}_shoutState=0;_shoutAudioStop=true}function _shoutScroll(){_shoutScrollBottom()}function _shoutScrollBottom(){_shoutDoc.scrollTop=_shoutDoc.scrollHeight;if(_shoutScrollInit==false){if(_shoutFullLoad>0||_shoutDoc.scrollHeight>0){_shoutScrollInit=true}setTimeout("_shoutScrollBottom()",100)}}function _shoutDelete(b){_shoutRefresh(false);_shoutAjax("/shout/delete.php?id="+b,"_shoutDeleted(xmlHttp.responseText);")}function _shoutDeleted(b){if(b.match(/^ERROR=/)){b=b.replace(/ERROR=/,"");alert(b);return}_shoutUpdate(b,true)}function _shoutBan(b){_shoutRefresh(false);_shoutAjax("/shout/delete.php?id="+b+"&ban=1","_shoutBanned(xmlHttp.responseText);")}function _shoutTempBan(b){_shoutRefresh(false);_shoutAjax("/shout/delete.php?id="+b+"&tempban=1","_shoutBanned(xmlHttp.responseText);")}function _shoutBanned(b){if(b.match(/^ERROR=/)){b=b.replace(/ERROR=/,"");alert(b);return}_shoutUpdate(b,true)}function _shoutRefresh(b){_shoutAudioStop=false;_shoutScrollTop=_shoutDoc.scrollTop;_shoutScrollLast=0;_shoutState=2;_shoutIdle=0;_shoutLastPost=new Date().getTime();_shoutMsgs={};_shoutDoc.innerHTML='<div style="padding:4px;text-align:center">REFRESHING...</div>';if(b!==false){_shoutGetContent(false,true)}return false}function _shoutPrefill(b){document.getElementById("shoutboxMsg").value="@"+b+" - ";if(document.getElementById("shoutboxMsg").type=="text"){document.getElementById("shoutboxMsg").focus()}}function _shoutAjax(url,codeSuccess){var xmlHttp;try{xmlHttp=new XMLHttpRequest()}catch(e){try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){alert("Your browser does not support AJAX!");return false}}}xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){eval(codeSuccess)}};xmlHttp.open("GET",url,true);xmlHttp.send(null)}function _shoutEmpty(d){for(var c in d){if(d.hasOwnProperty(c)){return false}}return true}function _shoutTrim(b){return b.replace(/^\s+|\s+$/g,"")}function _shoutMute(){if(!_shoutAudio){return false}document.getElementById("shoutboxMute").style.display="none";document.getElementById("shoutboxUnmute").style.display="";_shoutAudioMute=true;_shoutSet("isMuted","1");return false}function _shoutUnmute(){if(!_shoutAudio){return false}document.getElementById("shoutboxMute").style.display="";document.getElementById("shoutboxUnmute").style.display="none";_shoutAudioMute=false;_shoutSet("isMuted","0");return false}function _shoutGet(b){if(_shoutEmpty(_shoutSettings)){if(document.cookie.length<=0){return""}var a="_shout=";var d=document.cookie.indexOf(a);if(d<0){return""}d+=a.length;cEnd=document.cookie.indexOf(";",d);if(cEnd<0){cEnd=document.cookie.length}var c=document.cookie.substring(d,cEnd).split("|");for(x in c){if(c[x]==""){continue}var e=c[x].split("_");_shoutSettings[e[0]]=e[1]}}if(_shoutSettings[b]!=undefined){return _shoutSettings[b]}else{return""}}function _shoutSet(b,c){_shoutSettings[b]=c;var d="";for(x in _shoutSettings){d+=x+"_"+_shoutSettings[x]+"|"}var a=new Date(new Date().getTime()+(1000*60*60*24*365)).toGMTString();document.cookie="_shout="+d+";path=/;expires="+a}function _shoutWindowHeight(){return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0}function _shoutWindowWidth(){return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||0}function _shoutScrollHeight(){return document.body.scrollHeight||document.body.offsetHeight||0}function _shoutPop(b,a,c,f){var e=(screen.width/2)-(a/2);var d=(screen.height/2)-(c/2);window.open(b,f,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width="+a+",height="+c+",top="+d+",left="+e)};