
var mh2SBwidth='200px';var mh2SBheight='400px';var mh2SBspeed=2;var mh2SBpause=1;var mh2SBdataready=false;var mh2SBGEThttp='';var mh2SBPUThttp='';var mh2SBbasedir='';var mh2SBGetPHP='';var mh2EmotePath='';var mh2temptext='';var mh2SBmarquee='';var mh2SBspeed=2;var mh2SBpause=1;var mh2SBnewshout=0;var mh2SBdirection=0;var mh2SBRefresh=0;var mh2refresh=false;var lengthtest1=0;var lengthtest2=0;var runningspeed=0;var pausespeed=0;var actualheight=0;var direction=1;var refreshtimer=0;var scrolltimer=0;function _mh2_setOptions(p_livepath,p_path,p_speed,p_pause,p_newshouts,p_scrolldirection,p_refresh){mh2SBbasedir=base64_decode(p_livepath);mh2EmotePath=p_path;mh2SBGetPHP=mh2SBbasedir+'mh2shoutbox.getshouts.php?&mh2emotes=';mh2SBPutPHP=mh2SBbasedir+'mh2shoutbox.putshouts.php';mh2SBmarquee=document.getElementById("mh2vmarquee");mh2SBspeed=p_speed;mh2SBpause=p_pause;mh2SBnewshout=p_newshouts;mh2SBdirection=p_scrolldirection;mh2SBRefresh=p_refresh;runningspeed=mh2SBspeed;pausespeed=((mh2SBpause==0)?mh2SBspeed:0);direction=mh2SBdirection;mh2SBGEThttp=getHTTPObject();mh2SBPUThttp=getHTTPObject();if((mh2SBnewshout==2)&&(mh2SBRefresh<=0))mh2SBnewshout=0;if(window.addEventListener)window.addEventListener("load",initializemarquee,false);else if(window.attachEvent)window.attachEvent("onload",initializemarquee);else if(document.getElementById)window.onload=initializemarquee();}function initializemarquee(){mh2SBmarquee=document.getElementById("mh2vmarquee");mh2SBmarquee.style.top=0;marqueeheight=document.getElementById("mh2marqueecontainer").offsetHeight;actualheight=mh2SBmarquee.offsetHeight;mh2temptext='';if(window.opera||navigator.userAgent.indexOf("Netscape/7")!=-1){mh2SBmarquee.style.height=marqueeheight+'px';mh2SBmarquee.style.overflow='scroll';return;}setTimeout('scrolltimer = setInterval("mh2scrollmarquee()",30)',500);if((mh2SBnewshout==2)&&(mh2SBRefresh>0))refreshtimer=setInterval("_mh2getshouts()",(mh2SBRefresh*1000));}function _mh2receivetext(){if(mh2SBGEThttp.readyState==4){mh2temptext=mh2SBGEThttp.responseText;lengthtest2=mh2temptext.length;if((mh2SBnewshout==1)&&(lengthtest1!=lengthtest2)&&(mh2temptext.length>0))mh2refresh=true;mh2SBGEThttp.close;}}function _mh2getshouts(){if((mh2SBGEThttp.readyState==0)||(mh2SBGEThttp.readyState==4)){mh2SBGEThttp.open('GET',mh2SBGetPHP+mh2EmotePath,true);mh2SBGEThttp.onreadystatechange=_mh2receivetext;mh2SBGEThttp.send(null);}}function mh2scrollmarquee(){if(direction==0){if((mh2SBdirection!=direction)&&(parseInt(mh2SBmarquee.style.top)<=(actualheight*(-1)+8))){document.getElementById("mh2errordisp").innerHTML='End of Data';}else{if(parseInt(mh2SBmarquee.style.top)>(actualheight*(-1)+8))mh2SBmarquee.style.top=parseInt(mh2SBmarquee.style.top)-runningspeed+'px';else{mh2SBmarquee.style.top=parseInt(marqueeheight)+8+'px';mh2refresh=true;}}}else{if((mh2SBdirection!=direction)&&(parseInt(mh2SBmarquee.style.top)>marqueeheight-8)){document.getElementById("mh2errordisp").innerHTML='End of Data';}else{if(parseInt(mh2SBmarquee.style.top)<=marqueeheight-8)mh2SBmarquee.style.top=parseInt(mh2SBmarquee.style.top)+runningspeed+'px';else{mh2SBmarquee.style.top=(actualheight*(-1))+'px';mh2refresh=true;}}}if((mh2refresh==true)&&(mh2SBnewshout==1))mh2refresh=true;if((mh2SBdirection==direction)&&(((direction==0)&&(parseInt(mh2SBmarquee.style.top)>(actualheight*(-1)+8))&&(mh2refresh==true))||((direction==1)&&(parseInt(mh2SBmarquee.style.top)<marqueeheight-8)&&(mh2refresh==true))||((mh2refresh==true)&&(mh2SBnewshout==1)))){if(mh2temptext.length>0)mh2SBmarquee.innerHTML=mh2temptext;mh2SBmarquee=document.getElementById("mh2vmarquee");actualheight=mh2SBmarquee.offsetHeight;mh2temptext='';mh2refresh=false;lengthtest1=lengthtest2;if(direction==0)mh2SBmarquee.style.top=parseInt(marqueeheight)+8+'px';else
mh2SBmarquee.style.top=(actualheight*(-1))+'px';if((mh2SBnewshout==0)||(mh2SBRefresh<=0))_mh2getshouts();}}function _mh2postshout(p_uid){var uname=document.getElementById("mh2uname").value;var theshout=document.getElementById("mh2sb_input").value;var tempurl='mh2uid='+p_uid+'&mh2uname='+base64_encode(uname)+'&mh2shout='+base64_encode(theshout);theshout.replace(/\r|\n|\r\n/g,"");if((theshout.length>0)&&(uname.length>0)){mh2SBPUThttp.open('POST',mh2SBPutPHP,true);mh2SBPUThttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');mh2SBPUThttp.onreadystatechange=_mh2closeshout;mh2SBPUThttp.send(tempurl);}else{if(theshout.length==0){document.getElementById("mh2sb_input").value='';document.getElementById("mh2errordisp").innerHTML='No Input';}if(uname.length==0)document.getElementById("mh2errordisp").innerHTML='No Name';}}function _mh2closeshout(){mh2SBPUThttp.close;document.getElementById("mh2sb_input").value='';_mh2countchars();if((mh2SBnewshout==0)||(mh2SBRefresh<=0))_mh2getshouts();}function _mh2countchars(p_max){var counttext;var uname
uname=document.getElementById("mh2uname").value;counttext=document.getElementById("mh2sb_input").value;if(uname.length==0)document.getElementById("mh2errordisp").innerHTML='No Name';else
document.getElementById("mh2errordisp").innerHTML='';if(p_max>0){if(counttext.length>p_max){document.getElementById("mh2sb_input").value=counttext.substring(0,p_max);document.getElementById("mh2countshout").innerHTML='<span class="mh2sb_errors">MAXIMUM<span>';return;}}if(counttext.length>0)document.getElementById("mh2countshout").innerHTML=counttext.length+((p_max>0)?'/'+p_max:'');else
document.getElementById("mh2countshout").innerHTML='';}function _mh2checkenter(p_event,p_userid){if(p_event.keyCode==13)_mh2postshout(p_userid);}function _mh2switchdirection(){if(direction==1)direction=0;else
direction=1;document.getElementById("mh2errordisp").innerHTML='';}function _mh2speed(p_type){if(p_type=='pause'){if(runningspeed==0)runningspeed=mh2SBspeed;else
runningspeed=0;}if(p_type=='faster'){if(mh2SBspeed<10){mh2SBspeed=mh2SBspeed+1;runningspeed=mh2SBspeed;}}if(p_type=='slower'){if(mh2SBspeed>1){mh2SBspeed=mh2SBspeed-1;runningspeed=mh2SBspeed;}}document.getElementById("mh2speed").innerHTML='( '+parseInt(runningspeed)+' )';}function _mh2emoticons(){var currentstate;currentstate=document.getElementById("mh2emoticons").style.display;if(currentstate=='block')document.getElementById("mh2emoticons").style.display='none';else
document.getElementById("mh2emoticons").style.display='block';}function _mh2useemoticon(p_variable){document.getElementById("mh2sb_input").value+=' '+base64_decode(p_variable)+' ';document.getElementById("mh2emoticons").style.display='none';_mh2countchars();document.getElementById("mh2sb_input").focus();}function getHTTPObject(){var xmlhttp;try
{var xmlhttp=new XMLHttpRequest();}catch(error){try
{var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(error){return false;}}return xmlhttp;}function base64_encode(data){var b64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var o1,o2,o3,h1,h2,h3,h4,bits,i=ac=0,enc="",tmp_arr=[];data=utf8_encode(data);do{o1=data.charCodeAt(i++);o2=data.charCodeAt(i++);o3=data.charCodeAt(i++);bits=o1<<16|o2<<8|o3;h1=bits>>18&0x3f;h2=bits>>12&0x3f;h3=bits>>6&0x3f;h4=bits&0x3f;tmp_arr[ac++]=b64.charAt(h1)+b64.charAt(h2)+b64.charAt(h3)+b64.charAt(h4);}while(i<data.length);enc=tmp_arr.join('');switch(data.length%3){case 1:enc=enc.slice(0,-2)+'==';break;case 2:enc=enc.slice(0,-1)+'=';break;}return enc;}function base64_decode(data){var b64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var o1,o2,o3,h1,h2,h3,h4,bits,i=ac=0,dec="",tmp_arr=[];data+='';do{h1=b64.indexOf(data.charAt(i++));h2=b64.indexOf(data.charAt(i++));h3=b64.indexOf(data.charAt(i++));h4=b64.indexOf(data.charAt(i++));bits=h1<<18|h2<<12|h3<<6|h4;o1=bits>>16&0xff;o2=bits>>8&0xff;o3=bits&0xff;if(h3==64){tmp_arr[ac++]=String.fromCharCode(o1);}else if(h4==64){tmp_arr[ac++]=String.fromCharCode(o1,o2);}else{tmp_arr[ac++]=String.fromCharCode(o1,o2,o3);}}while(i<data.length);dec=tmp_arr.join('');dec=utf8_decode(dec);return dec;}function utf8_encode(string){string=(string+'').replace(/\r\n/g,"\n");var utftext="";var start,end;var stringl=0;start=end=0;stringl=string.length;for(var n=0;n<stringl;n++){var c1=string.charCodeAt(n);var enc=null;if(c1<128){end++;}else if((c1>127)&&(c1<2048)){enc=String.fromCharCode((c1>>6)|192)+String.fromCharCode((c1&63)|128);}else{enc=String.fromCharCode((c1>>12)|224)+String.fromCharCode(((c1>>6)&63)|128)+String.fromCharCode((c1&63)|128);}if(enc!=null){if(end>start){utftext+=string.substring(start,end);}utftext+=enc;start=end=n+1;}}if(end>start){utftext+=string.substring(start,string.length);}return utftext;}function utf8_decode(str_data){var tmp_arr=[],i=ac=c1=c2=c3=0;str_data+='';while(i<str_data.length){c1=str_data.charCodeAt(i);if(c1<128){tmp_arr[ac++]=String.fromCharCode(c1);i++;}else if((c1>191)&&(c1<224)){c2=str_data.charCodeAt(i+1);tmp_arr[ac++]=String.fromCharCode(((c1&31)<<6)|(c2&63));i+=2;}else{c2=str_data.charCodeAt(i+1);c3=str_data.charCodeAt(i+2);tmp_arr[ac++]=String.fromCharCode(((c1&15)<<12)|((c2&63)<<6)|(c3&63));i+=3;}}return tmp_arr.join('');}