/**
 *
 * @package mChat JavaScript Code mini
 * @version 1.3.2 of 10.09.2009
 * @copyright (c) By Richard McGirr (RMcGirr83) http://rmcgirr83.org
 * @copyright (c) By Shapoval Andrey Vladimirovich (AllCity) ~ http://allcity.net.ru/
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
 **/
var $jQ=jQuery;if(localStorage.getItem("mChatNoSound")=="yes"){$jQ("#mChatUseSound").attr("checked",false)}var mChat={sound:function(file){if(localStorage.getItem("mChatNoSound")=="yes"){return}if($jQ.browser.msie){document.getElementById("mChatSound").innerHTML='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" height="0" width="0" type="application/x-shockwave-flash"><param name="movie" value="'+file+'"></object>'}else{$jQ("#mChatSound").html('<embed src="'+file+'" width="0" height="0" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>')}},toggle:function(id){$jQ("#mChat"+id).slideToggle("normal",function(){if($jQ("#mChat"+id).is(":visible")){$jQ.cookie("mChatShow"+id,"yes")}if($jQ("#mChat"+id).is(":hidden")){$jQ.cookie("mChatShow"+id,null)}})},add:function(){if($jQ("#mChatMessage").val()==""){alert(mChatNoMessageInput);return}$jQ.ajax({url:mChatFile,timeout:10000,type:"POST",async:false,data:$jQ("#mChatForm").serialize(),dataType:"text",success:function(){$jQ("#mChatMessage").val("");mChat.refresh()},error:function(XMLHttpRequest){if(XMLHttpRequest.status==400){alert(mChatFlood)}else{if(XMLHttpRequest.status==403){alert(mChatNoAccess)}else{if(XMLHttpRequest.status==501){alert(mChatNoMessageInput)}}}},beforeSend:function(){window.clearInterval(interval)},complete:function(){interval=setInterval(function(){mChat.refresh()},mChatRefresh)}})},edit:function(id){var message=$jQ("#edit"+id).val();var data=prompt(mChatEditInfo,message);if(data){$jQ.ajax({url:mChatFile,timeout:10000,type:"POST",async:true,data:{mode:"edit",message_id:id,message:data},dataType:"text",success:function(html){$jQ("#mess"+id).fadeOut("slow",function(){$jQ(this).replaceWith(html);$jQ("#mess"+id).css("display","none").fadeIn("slow")})},error:function(XMLHttpRequest){if(XMLHttpRequest.status==403){alert(mChatNoAccess)}else{if(XMLHttpRequest.status==501){alert(mChatNoMessageInput)}}},beforeSend:function(){window.clearInterval(interval)},complete:function(){interval=setInterval(function(){mChat.refresh()},mChatRefresh)}})}},del:function(id){if(confirm(mChatDelConfirm)){$jQ.ajax({url:mChatFile,timeout:10000,type:"POST",async:true,data:{mode:"delete",message_id:id},success:function(){$jQ("#mess"+id).fadeOut("slow",function(){$jQ(this).remove()});mChat.sound(mChatForumRoot+"mchat/del.swf")},error:function(){alert(mChatNoAccess)},beforeSend:function(){window.clearInterval(interval)},complete:function(){interval=setInterval(function(){mChat.refresh()},mChatRefresh)}})}},refresh:function(){if(mChatArchiveMode){if($jQ("#mChatData").find("div:first").not("#mChatArchiveNoMessage").not("#mChatNoMessage").attr("id")==undefined){$jQ("#mChatArchiveNoMessage").show("slow")}return}var mess_id=0;if($jQ("#mChatData").find("div:first").not("#mChatNoMessage").attr("id")!=undefined){mess_id=$jQ("#mChatData").find("div:first").attr("id").replace("mess","")}$jQ.ajax({url:mChatFile,timeout:10000,type:"POST",async:true,data:{mode:"read",message_last_id:mess_id},dataType:"html",success:function(html){if(html!=""){$jQ("#mChatData").prepend(html).find("div:first").not("#mChatNoMessage").css("display","none");$jQ("#mChatData div:first").not("#mChatNoMessage").fadeIn("slow");mChat.sound(mChatForumRoot+"mchat/add.swf");$jQ("#mChatNoMessage").hide()}},error:function(){mChat.sound(mChatForumRoot+"mchat/error.swf")},complete:function(){if($jQ("#mChatData").find("div:first").not("#mChatNoMessage").attr("id")==undefined){$jQ("#mChatNoMessage").show("slow")}}})},stats:function(){if(!mChatCustomWhois){return}$jQ.ajax({url:mChatFile,timeout:10000,type:"POST",async:false,data:{mode:"stats"},dataType:"html",beforeSend:function(){$jQ("#mChatRefreshN").show();$jQ("#mChatRefresh").hide();window.clearInterval(statsinterval)},success:function(stats){$jQ("#mChatStats").fadeOut("slow",function(){$jQ("#mChatStats").html(stats);$jQ("#mChatStats").css("display","none").fadeIn("slow")})},error:function(){mChat.sound(mChatForumRoot+"mchat/error.swf")},complete:function(){statsinterval=setInterval(function(){mChat.stats()},mChatWhoisRefresh)}})}};var interval=setInterval(function(){mChat.refresh()},mChatRefresh);var statsinterval=setInterval(function(){mChat.stats()},mChatWhoisRefresh);if($jQ.cookie("mChatShowSmiles")=="yes"){$jQ("#mChatSmiles:hidden").slideToggle("slow")}if($jQ.cookie("mChatShowBBCodes")=="yes"){$jQ("#mChatBBCodes:hidden").slideToggle("slow")}$jQ("#mChatUseSound").change(function(){if($jQ(this).is(":checked")){localStorage.removeItem("mChatNoSound")}else{localStorage.setItem("mChatNoSound","yes")}});

