// Quick Chat 2.33
var quick_chat_undefined;
if(typeof quick_chat_js_vars!=typeof quick_chat_undefined){var quick_chat_users_interval,quick_chat_smile=quick_chat_l10n_after.quick_chat_smile_array,quick_chat_data=quick_chat_l10n_after.quick_chat_data_array,quick_chat_rooms=[],quick_chat_audio_support=0,quick_chat_audio_element=document.createElement("audio");quick_chat_audio_element.canPlayType&&(quick_chat_audio_element.canPlayType('audio/ogg; codecs="vorbis"')?(quick_chat_audio_element.setAttribute("src",quick_chat_js_vars.quick_chat_url+"sounds/message-sound.ogg"),
quick_chat_audio_element.setAttribute("preload","auto"),quick_chat_audio_support=1):quick_chat_audio_element.canPlayType("audio/mpeg;")?(quick_chat_audio_element.setAttribute("src",quick_chat_js_vars.quick_chat_url+"sounds/message-sound.mp3"),quick_chat_audio_element.setAttribute("preload","auto"),quick_chat_audio_support=1):quick_chat_audio_element.canPlayType('audio/wav; codecs="1"')&&(quick_chat_audio_element.setAttribute("src",quick_chat_js_vars.quick_chat_url+"sounds/message-sound.wav"),quick_chat_audio_element.setAttribute("preload",
"auto"),quick_chat_audio_support=1))}
jQuery.quick_chat_cookie=function(a,c,b){if(arguments.length>1&&String(c)!=="[object Object]"){b=jQuery.extend({},b);if(c===null||c===void 0)b.expires=-1;if(typeof b.expires==="number"){var d=b.expires,f=b.expires=new Date;f.setDate(f.getDate()+d)}c=String(c);return document.cookie=[encodeURIComponent(a),"=",b.raw?c:encodeURIComponent(c),b.expires?"; expires="+b.expires.toUTCString():"",b.path?"; path="+b.path:"",b.domain?"; domain="+b.domain:"",b.secure?"; secure":""].join("")}b=c||{};f=b.raw?function(c){return c}:
decodeURIComponent;return(d=RegExp("(?:^|; )"+encodeURIComponent(a)+"=([^;]*)").exec(document.cookie))?f(d[1]):null};
jQuery.fn.quick_chat_insert_at_caret=function(a){return this.each(function(){if(document.selection)this.focus(),sel=document.selection.createRange(),sel.text=a,this.focus();else if(this.selectionStart||this.selectionStart=="0"){var c=this.selectionStart,b=this.selectionEnd,d=this.scrollTop;this.value=this.value.substring(0,c)+a+this.value.substring(b,this.value.length);this.focus();this.selectionStart=c+a.length;this.selectionEnd=c+a.length;this.scrollTop=d}else this.value+=a,this.focus()})};
jQuery.quick_chat_preg_quote=function(a){return a.replace(RegExp("[.*+?|()\\[\\]{}\\\\]","g"),"\\$&")};jQuery.quick_chat_stripslashes=function(a){a=a.replace(/\\'/g,"'");a=a.replace(/\\"/g,'"');a=a.replace(/\\\\/g,"\\");return a=a.replace(/\\0/g,"\x00")};jQuery.quick_chat_user_status_class=function(a){var c="";a==0?c="quick-chat-admin":a==1?c="quick-chat-loggedin":a==2&&(c="quick-chat-guest");return c};
jQuery.quick_chat_single_message_html=function(a,c,b,d){var f=jQuery.quick_chat_stripslashes(a.alias),h=jQuery.quick_chat_user_status_class(a.status),i=jQuery.quick_chat_stripslashes(a.message),g;for(g in quick_chat_smile)var e='<div class="quick-chat-smile-message quick-chat-smile quick-chat-smile-'+quick_chat_smile[g]+'" title="'+g+'"></div>',i=i.replace(RegExp(jQuery.quick_chat_preg_quote(g),"g"),e);h='<div class="quick-chat-history-message-alias-container '+h+'"><div class="quick-chat-history-header">';
b==1&&(h+='<img class="quick-chat-history-gravatar" style="width:'+d+"px; height:"+d+'px;" src="http://0.gravatar.com/avatar/'+a.md5email+"?s="+d+"&d=http://0.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s="+d+'&r=G"/>');quick_chat_js_vars.quick_chat_user_status==0&&(h+='<input class="quick-chat-to-delete-boxes" type="checkbox" name="quick-chat-to-delete[]" value="'+a.id+'" />');h+='<div class="quick-chat-history-alias">';h+=f==c||quick_chat_js_vars.quick_chat_no_participation==1?f:'<a href="" title="'+
quick_chat_js_vars.quick_chat_reply_to_string+" "+f+'">'+f+"</a>";h+='</div><div class="quick-chat-history-timestring">'+a.timestring+"</div>";h+='</div><div class="quick-chat-history-message">'+i+"</div></div>";return h};
jQuery.quick_chat_check_username=function(a,c,b){var d=quick_chat_data[a].quick_chat_room_name,f=quick_chat_data[a].quick_chat_username;typeof quick_chat_data[a].quick_chat_username_timeout!=typeof quick_chat_undefined&&clearTimeout(quick_chat_data[a].quick_chat_username_timeout);quick_chat_data[a].quick_chat_username_timeout=setTimeout(function(){jQuery.ajax({type:"POST",url:quick_chat_js_vars.quick_chat_ajaxurl,data:{action:"quick-chat-ajax-username-check",username_check:c,username_old:f,room_name:d,
quick_chat_username_check_nonce:quick_chat_js_vars.quick_chat_username_check_nonce},cache:!1,dataType:"json",success:function(c){quick_chat_js_vars.quick_chat_username_check_nonce=c.quick_chat_username_check_nonce;quick_chat_js_vars.quick_chat_no_participation==0&&c.quick_chat_no_participation==1&&location.reload();jQuery(b).html("");if(c.username_invalid==1)jQuery(b).addClass("quick-chat-error"),jQuery(b).html(quick_chat_js_vars.quick_chat_username_invalid_string);else if(c.username_bad_words==1)jQuery(b).addClass("quick-chat-error"),
jQuery(b).html(quick_chat_js_vars.quick_chat_username_bad_words_string);else if(c.username_exists==1)jQuery(b).addClass("quick-chat-error"),jQuery(b).html(quick_chat_js_vars.quick_chat_username_exists_string);else if(c.username_blocked==1)jQuery(b).addClass("quick-chat-error"),jQuery(b).html(quick_chat_js_vars.quick_chat_username_blocked_string);else if(c.username_exists==0||c.username_blocked==0||c.username_invalid==0)jQuery(b).html(""),quick_chat_data[a].quick_chat_username=c.username},beforeSend:function(){jQuery(b).html("");
jQuery(b).removeClass("quick-chat-error");jQuery(b).html(quick_chat_js_vars.quick_chat_username_check_wait_string)},error:function(){}});quick_chat_data[a].quick_chat_username_timeout=quick_chat_undefined},1500)};
jQuery.quick_chat_update_messages=function(){jQuery.post(quick_chat_js_vars.quick_chat_ajaxurl,{action:"quick-chat-ajax-update-messages",quick_chat_last_timestamp:quick_chat_js_vars.quick_chat_last_timestamp,quick_chat_rooms:quick_chat_rooms,quick_chat_update_messages_nonce:quick_chat_js_vars.quick_chat_update_messages_nonce},function(a){quick_chat_js_vars.quick_chat_update_messages_nonce=a.quick_chat_update_messages_nonce;(quick_chat_js_vars.quick_chat_no_participation==0&&a.quick_chat_no_participation==
1||quick_chat_js_vars.quick_chat_no_participation==1&&a.quick_chat_no_participation==0)&&location.reload();if(a.quick_chat_success==1){var c=a.quick_chat_messages;quick_chat_js_vars.quick_chat_last_timestamp=c[c.length-1].unix_timestamp;jQuery(".quick-chat-container").each(function(){for(var b=0,a=jQuery(this).attr("data-chat-id"),f=quick_chat_data[a].quick_chat_room_name,h=quick_chat_data[a].quick_chat_username,i=quick_chat_data[a].quick_chat_gravatars,g=quick_chat_data[a].quick_chat_gravatars_size,
a=quick_chat_data[a].quick_chat_scroll_enable,e=0;typeof c[e]!=typeof quick_chat_undefined;e++)f==c[e].room&&c[e].alias!="quick_chat"&&(b==0&&quick_chat_audio_support&&quick_chat_js_vars.quick_chat_audio_enable==1&&h!=jQuery.quick_chat_stripslashes(c[e].alias)&&(quick_chat_audio_element.play(),b=1),jQuery(this).children(".quick-chat-history-container").append(jQuery.quick_chat_single_message_html(c[e],h,i,g)));a==1&&(b=jQuery(this).children(".quick-chat-history-container"),jQuery(b).animate({scrollTop:jQuery(b)[0].scrollHeight},
500))})}jQuery.quick_chat_update_messages()},"json")};
jQuery.quick_chat_update_users=function(){quick_chat_users_interval=setInterval(function(){jQuery(".quick-chat-container").each(function(){var a=jQuery(this).attr("data-chat-id"),c=quick_chat_data[a].quick_chat_userlist_position,b=quick_chat_data[a].quick_chat_room_name,d=quick_chat_data[a].quick_chat_username,f=jQuery(this);jQuery.post(quick_chat_js_vars.quick_chat_ajaxurl,{action:"quick-chat-ajax-update-users",to_update_room_name:b,to_update_user_name:d,quick_chat_update_users_nonce:quick_chat_js_vars.quick_chat_update_users_nonce},
function(a){quick_chat_js_vars.quick_chat_update_users_nonce=a.quick_chat_update_users_nonce;(quick_chat_js_vars.quick_chat_no_participation==0&&a.quick_chat_no_participation==1||quick_chat_js_vars.quick_chat_no_participation==1&&a.quick_chat_no_participation==0)&&location.reload();if(quick_chat_js_vars.quick_chat_user_status==0){var b=[];jQuery(f).find(".quick-chat-users-container input[type=checkbox]:checked").each(function(){b.push(jQuery(this).attr("data-user-id"))})}for(var a=a.quick_chat_users_list,
g="",e=0;typeof a[e]!=typeof quick_chat_undefined;e++){var j=jQuery.quick_chat_stripslashes(a[e].alias);g+='<div class="quick-chat-single-user '+jQuery.quick_chat_user_status_class(a[e].status)+'">';j==d||quick_chat_js_vars.quick_chat_no_participation==1?g+=j:(quick_chat_js_vars.quick_chat_user_status==0&&(g+='<input class="quick-chat-to-ban-boxes" type="checkbox" name="quick-chat-to-ban[]" value="'+a[e].ip+'" data-user-id="'+a[e].id+'"'+(jQuery.inArray(a[e].id,b)==0?' checked="checked"':"")+"/>"),
g+='<a href="" title="'+quick_chat_js_vars.quick_chat_reply_to_string+" "+jQuery.quick_chat_stripslashes(a[e].alias)+'">'+jQuery.quick_chat_stripslashes(a[e].alias)+"</a>");c=="top"&&a[e]!==a[a.length-1]&&(g+=",");g+="</div>"}jQuery(f).children(".quick-chat-users-container").html(g)},"json")})},quick_chat_js_vars.quick_chat_timeout_refresh_users)};jQuery.quick_chat_update_rooms=function(){for(var a in quick_chat_data)jQuery.inArray(quick_chat_data[a].quick_chat_room_name,quick_chat_rooms)==-1&&quick_chat_rooms.push(quick_chat_data[a].quick_chat_room_name)};
jQuery.quick_chat_delete_messages=function(a,c){var b=quick_chat_data[a].quick_chat_room_name;jQuery.post(quick_chat_js_vars.quick_chat_ajaxurl,{action:"quick-chat-ajax-delete",to_delete_ids:c,to_delete_room_name:b,quick_chat_delete_nonce:quick_chat_js_vars.quick_chat_delete_nonce},function(c){quick_chat_js_vars.quick_chat_delete_nonce=c.quick_chat_delete_nonce;jQuery(".quick-chat-container").each(function(){var f=jQuery(this).attr("data-chat-id"),h=quick_chat_data[f].quick_chat_username,i=quick_chat_data[a].quick_chat_gravatars,
g=quick_chat_data[a].quick_chat_gravatars_size;if(quick_chat_data[f].quick_chat_room_name==b){messages=c.quick_chat_messages;for(var f="",e=0;typeof messages[e]!=typeof quick_chat_undefined;e++)messages[e].alias!="quick_chat"&&(f+=jQuery.quick_chat_single_message_html(messages[e],h,i,g));jQuery(this).children(".quick-chat-history-container").html(f)}})})};
jQuery.quick_chat_ban_users=function(a,c){var b=jQuery.find('div[class=quick-chat-container][data-chat-id="'+a+'"]');jQuery.post(quick_chat_js_vars.quick_chat_ajaxurl,{action:"quick-chat-ajax-ban",to_ban_ips:c,quick_chat_ban_nonce:quick_chat_js_vars.quick_chat_ban_nonce},function(a){quick_chat_js_vars.quick_chat_ban_nonce=a.quick_chat_ban_nonce;jQuery(b).find(".quick-chat-users-container input[type=checkbox]").each(function(){jQuery(this).attr("checked",!1)})})};
jQuery.quick_chat_new_message=function(a,c){jQuery.post(quick_chat_js_vars.quick_chat_ajaxurl,{action:"quick-chat-ajax-new-message",message:c,room:quick_chat_data[a].quick_chat_room_name,quick_chat_new_message_nonce:quick_chat_js_vars.quick_chat_new_message_nonce},function(a){quick_chat_js_vars.quick_chat_new_message_nonce=a.quick_chat_new_message_nonce;quick_chat_js_vars.quick_chat_no_participation==0&&a.quick_chat_no_participation==1&&location.reload()})};
jQuery(window).load(function(){if(typeof quick_chat_js_vars!=typeof quick_chat_undefined){jQuery(".quick-chat-history-container").each(function(){jQuery(this).animate({scrollTop:jQuery(this)[0].scrollHeight},250)});quick_chat_audio_support&&jQuery("div.quick-chat-sound-link").css("display","block");jQuery.quick_chat_update_rooms();jQuery.quick_chat_update_users();jQuery(".quick-chat-message").bind("keypress",function(a){code=a.keyCode?a.keyCode:a.which;if(code.toString()==13&&(a.preventDefault(),
a=jQuery.trim(jQuery(this).val()),a!="")){var b=jQuery(this).parents(".quick-chat-container").attr("data-chat-id");jQuery(this).val("");jQuery.quick_chat_new_message(b,a)}});jQuery("input.quick-chat-send-button").bind("click",function(a){a.preventDefault();a=jQuery.trim(jQuery(this).prev().val());if(a!=""){var b=jQuery(this).parents(".quick-chat-container").attr("data-chat-id");jQuery(this).prev().val("");jQuery.quick_chat_new_message(b,a)}jQuery(this).prev().focus()});jQuery(".quick-chat-alias").bind("keyup",
function(){var a=jQuery.trim(jQuery(this).val());if(a!=""){var b=jQuery(this).parents(".quick-chat-container").attr("data-chat-id"),d=jQuery(this).parents(".quick-chat-container").find("span.quick-chat-username-status");jQuery.quick_chat_check_username(b,a,d)}});jQuery("div.quick-chat-smile").bind("click",function(){var a=jQuery(this).parents(".quick-chat-container").find(".quick-chat-message");jQuery(this).fadeTo(100,0,function(){jQuery(a).quick_chat_insert_at_caret(jQuery(this).attr("title"));jQuery(this).fadeTo(100,
1)})});jQuery("div.quick-chat-history-alias a, div.quick-chat-single-user a").live("click",function(a){a.preventDefault();var b=jQuery(this).parents(".quick-chat-container").find(".quick-chat-message");jQuery(this).fadeTo(100,0,function(){jQuery(b).quick_chat_insert_at_caret("@"+jQuery(this).text()+": ");jQuery(this).fadeTo(100,1)})});jQuery("div.quick-chat-sound-link a").bind("click",function(a){a.preventDefault();quick_chat_js_vars.quick_chat_audio_enable=quick_chat_js_vars.quick_chat_audio_enable==
1?0:1;jQuery("div.quick-chat-sound-link a").each(function(){jQuery(this).fadeTo(100,0,function(){quick_chat_js_vars.quick_chat_audio_enable==0?jQuery(this).css("text-decoration","line-through"):jQuery(this).css("text-decoration","none");jQuery.quick_chat_cookie("quick_chat_sound_state",quick_chat_js_vars.quick_chat_audio_enable,{path:quick_chat_js_vars.quick_chat_cookiepath,domain:quick_chat_js_vars.quick_chat_cookie_domain});jQuery(this).fadeTo(100,1)})})});jQuery("div.quick-chat-scroll-link a").bind("click",
function(a){a.preventDefault();var b=jQuery(this).parents(".quick-chat-container").attr("data-chat-id"),d=quick_chat_data[b].quick_chat_scroll_enable;jQuery(this).fadeTo(100,0,function(){d==0?(quick_chat_data[b].quick_chat_scroll_enable=1,jQuery(this).css("text-decoration","none")):(quick_chat_data[b].quick_chat_scroll_enable=0,jQuery(this).css("text-decoration","line-through"));jQuery(this).fadeTo(100,1)})});if(quick_chat_js_vars.quick_chat_user_status==0){jQuery("div.quick-chat-delete-link a").bind("click",
function(a){a.preventDefault();var b=jQuery(this).parents(".quick-chat-container").attr("data-chat-id"),d=[];jQuery(this).parents(".quick-chat-container").find(".quick-chat-history-container input[type=checkbox]:checked").each(function(){d.push(jQuery(this).val())});jQuery(this).fadeTo(100,0,function(){d==""?alert(quick_chat_js_vars.quick_chat_delete_what_string):confirm(quick_chat_js_vars.quick_chat_delete_confirm_string)&&jQuery.quick_chat_delete_messages(b,d);jQuery(this).fadeTo(100,1)})});jQuery("div.quick-chat-ban-link a").bind("click",
function(a){a.preventDefault();var b=jQuery(this).parents(".quick-chat-container").attr("data-chat-id"),d=[];jQuery(this).parents(".quick-chat-container").find(".quick-chat-users-container input[type=checkbox]:checked").each(function(){d.push(jQuery(this).val())});jQuery(this).fadeTo(100,0,function(){d==""?alert(quick_chat_js_vars.quick_chat_ban_who_string):confirm(quick_chat_js_vars.quick_chat_ban_confirm_string)&&jQuery.quick_chat_ban_users(b,d);jQuery(this).fadeTo(100,1)})});var a=!1;jQuery("div.quick-chat-select-all-link a").live("click",
function(c){c.preventDefault();jQuery(this).fadeTo(100,0,function(){jQuery(this).parents(".quick-chat-container").find(".quick-chat-history-container input[type=checkbox]").attr("checked",!a);a=!a;jQuery(this).fadeTo(100,1)})})}jQuery.quick_chat_update_messages()}});
