// Quick Chat 2.41
var quick_chat_undefined;
jQuery.quick_chat_cookie=function(a,c,b){if(1<arguments.length&&"[object Object]"!==""+c){b=jQuery.extend({},b);if(null===c||void 0===c)b.expires=-1;if("number"===typeof b.expires){var e=b.expires,f=b.expires=new Date;f.setDate(f.getDate()+e)}c=""+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(b){return b}:
decodeURIComponent;return(e=RegExp("(?:^|; )"+encodeURIComponent(a)+"=([^;]*)").exec(document.cookie))?f(e[1]):null};
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_play_audio=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));1==quick_chat_audio_support&&(quick_chat_play_audio=jQuery.quick_chat_cookie("quick_chat_sound_state")?jQuery.quick_chat_cookie("quick_chat_sound_state"):quick_chat_js_vars.quick_chat_audio_enable);var quick_chat_dest_lang=jQuery.quick_chat_cookie("quick_chat_dest_lang")?jQuery.quick_chat_cookie("quick_chat_dest_lang"):quick_chat_js_vars.quick_chat_default_langugage_code;""!=quick_chat_js_vars.quick_chat_bing_appid&&
jQuery.translate.load(quick_chat_js_vars.quick_chat_bing_appid)}
(function(a){var c={tags:["select","option"],filter:a.translate.isTranslatable,label:a.translate.toNativeLanguage||function(b,c){return a.translate.capitalize(c)},includeUnknown:!1};a.translate.quick_chat_ui=function(){var b={},e="",f="",d="";"string"===typeof arguments[0]?b.tags=a.makeArray(arguments):b=arguments[0];b=a.extend({},c,a.translate.quick_chat_ui.defaults,b);b.tags[2]&&(f="<"+b.tags[2]+">",d="</"+b.tags[2]+">");var i=a.translate.getLanguages(b.filter);b.includeUnknown||delete i.UNKNOWN;
a.each(i,function(a,c){e+="<"+b.tags[1]+" value="+c+">"+f+b.label(c,a)+d+"</"+b.tags[1]+">"});return jQuery('<label class="quick-chat-lang-label" for="quick-chat-lang-select">'+quick_chat_js_vars.quick_chat_select_language_string+"</label><"+b.tags[0]+' name="quick-chat-lang-select" class="quick-chat-lang-select">'+e+"</"+b.tags[0]+">")};a.translate.quick_chat_ui.defaults=a.extend({},c)})(jQuery);
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||"0"==this.selectionStart){var c=this.selectionStart,b=this.selectionEnd,e=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=e}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_update_rooms=function(){for(var a in quick_chat_data)-1==jQuery.inArray(quick_chat_data[a].quick_chat_room_name,quick_chat_rooms)&&quick_chat_rooms.push(quick_chat_data[a].quick_chat_room_name)};
jQuery.quick_chat_update_sound_state=function(){0==quick_chat_play_audio?jQuery("div.quick-chat-sound-link a").css("text-decoration","line-through"):jQuery("div.quick-chat-sound-link a").css("text-decoration","none")};jQuery.quick_chat_user_status_class=function(a){var c="";0==a?c="quick-chat-admin":1==a?c="quick-chat-loggedin":2==a&&(c="quick-chat-guest");return c};
jQuery.quick_chat_single_message_html=function(a,c,b,e){var f=jQuery.quick_chat_stripslashes(a.alias),d=jQuery.quick_chat_user_status_class(a.status),i=jQuery.quick_chat_stripslashes(a.message),g;for(g in quick_chat_smile)var h='<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"),h);d='<div class="quick-chat-history-message-alias-container '+d+'"><div class="quick-chat-history-header">';
1==b&&(d+='<img class="quick-chat-history-gravatar" style="width:'+e+"px; height:"+e+'px;" src="http://0.gravatar.com/avatar/'+a.md5email+"?s="+e+"&d=http://0.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s="+e+'&r=G"/>');d+='<div class="quick-chat-history-alias">';d=f==c||1==quick_chat_js_vars.quick_chat_no_participation?d+f:d+('<a href="" title="'+quick_chat_js_vars.quick_chat_reply_to_string+" "+f+'">'+f+"</a>");d=d+"</div>"+('<div class="quick-chat-history-timestring">'+a.timestring+"</div>");
d+='</div><div class="quick-chat-history-message">'+i+"</div>";if(""!=quick_chat_js_vars.quick_chat_bing_appid||0==quick_chat_js_vars.quick_chat_user_status)d+='<div class="quick-chat-history-links">';""!=quick_chat_js_vars.quick_chat_bing_appid&&(d=d+'<div class="quick-chat-translate-link">'+(' <a style="text-decoration: none;" href="">'+quick_chat_js_vars.quick_chat_translate_string+"</a> "),d+="</div>");0==quick_chat_js_vars.quick_chat_user_status&&(d+='<input class="quick-chat-to-delete-boxes" type="checkbox" name="quick-chat-to-delete[]" value="'+
a.id+'" />');if(""!=quick_chat_js_vars.quick_chat_bing_appid||0==quick_chat_js_vars.quick_chat_user_status)d+="</div>";return d+"</div>"};
jQuery.quick_chat_check_username=function(a,c,b){var e=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:e,
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;0==quick_chat_js_vars.quick_chat_no_participation&&1==c.quick_chat_no_participation&&location.reload();jQuery(b).html("");if(1==c.username_invalid)jQuery(b).addClass("quick-chat-error"),jQuery(b).html(quick_chat_js_vars.quick_chat_username_invalid_string);else if(1==c.username_bad_words)jQuery(b).addClass("quick-chat-error"),
jQuery(b).html(quick_chat_js_vars.quick_chat_username_bad_words_string);else if(1==c.username_exists)jQuery(b).addClass("quick-chat-error"),jQuery(b).html(quick_chat_js_vars.quick_chat_username_exists_string);else if(1==c.username_blocked)jQuery(b).addClass("quick-chat-error"),jQuery(b).html(quick_chat_js_vars.quick_chat_username_blocked_string);else if(0==c.username_exists||0==c.username_blocked||0==c.username_invalid)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;(0==quick_chat_js_vars.quick_chat_no_participation&&1==a.quick_chat_no_participation||
1==quick_chat_js_vars.quick_chat_no_participation&&0==a.quick_chat_no_participation)&&location.reload();if(1==a.quick_chat_success){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,d=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,h=0;typeof c[h]!=typeof quick_chat_undefined;h++)f==c[h].room&&(0==b&&1==quick_chat_play_audio&&d!=jQuery.quick_chat_stripslashes(c[h].alias)&&(quick_chat_audio_element.play(),b=1),jQuery(this).children(".quick-chat-history-container").append(jQuery.quick_chat_single_message_html(c[h],d,i,g)));1==a&&(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,e=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:e,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;(0==quick_chat_js_vars.quick_chat_no_participation&&1==a.quick_chat_no_participation||1==quick_chat_js_vars.quick_chat_no_participation&&0==a.quick_chat_no_participation)&&location.reload();if(0==quick_chat_js_vars.quick_chat_user_status){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="",h=0;typeof a[h]!=typeof quick_chat_undefined;h++){var j=
jQuery.quick_chat_stripslashes(a[h].alias),g=g+('<div class="quick-chat-single-user '+jQuery.quick_chat_user_status_class(a[h].status)+'">');j==e||1==quick_chat_js_vars.quick_chat_no_participation?g+=j:(0==quick_chat_js_vars.quick_chat_user_status&&(g+='<input class="quick-chat-to-ban-boxes" type="checkbox" name="quick-chat-to-ban[]" value="'+a[h].ip+'" data-user-id="'+a[h].id+'"'+(0==jQuery.inArray(a[h].id,b)?' checked="checked"':"")+"/>"),g+='<a href="" title="'+quick_chat_js_vars.quick_chat_reply_to_string+
" "+j+'">'+j+"</a>");"top"==c&&a[h]!==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_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"),d=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="",h=0;typeof messages[h]!=typeof quick_chat_undefined;h++)f+=jQuery.quick_chat_single_message_html(messages[h],d,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;0==quick_chat_js_vars.quick_chat_no_participation&&1==a.quick_chat_no_participation&&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_sound_state());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(13==
code.toString()&&(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"),e=jQuery(this).parents(".quick-chat-container").find("span.quick-chat-username-status");jQuery.quick_chat_check_username(b,a,e)}});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();jQuery(this).fadeTo(100,0,function(){quick_chat_play_audio=
1==quick_chat_play_audio?0:1;jQuery.quick_chat_cookie("quick_chat_sound_state",quick_chat_play_audio,{path:quick_chat_js_vars.quick_chat_cookiepath,domain:quick_chat_js_vars.quick_chat_cookie_domain});jQuery.quick_chat_update_sound_state();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"),e=quick_chat_data[b].quick_chat_scroll_enable;jQuery(this).fadeTo(100,0,function(){0==
e?(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)})});jQuery(".quick-chat-translate-link a").live("click",function(a){a.preventDefault();jQuery(this).fadeTo(100,0,function(){"none"==jQuery(this).css("text-decoration")?(jQuery(this).parents(".quick-chat-history-message-alias-container").find(".quick-chat-history-message").translate("",
quick_chat_dest_lang,{fromOriginal:!0}),jQuery(this).css("text-decoration","line-through")):"line-through"==jQuery(this).css("text-decoration")&&(jQuery(this).parents(".quick-chat-history-message-alias-container").find(".quick-chat-history-message").translate(""),jQuery(this).css("text-decoration","none"));jQuery(this).fadeTo(100,1)})});if(0==quick_chat_js_vars.quick_chat_user_status){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"),
e=[];jQuery(this).parents(".quick-chat-container").find(".quick-chat-history-container input[type=checkbox]:checked").each(function(){e.push(jQuery(this).val())});jQuery(this).fadeTo(100,0,function(){""==e?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,e);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"),
e=[];jQuery(this).parents(".quick-chat-container").find(".quick-chat-users-container input[type=checkbox]:checked").each(function(){e.push(jQuery(this).val())});jQuery(this).fadeTo(100,0,function(){""==e?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,e);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.translate(function(){jQuery.translate.quick_chat_ui("select","option").change(function(){quick_chat_dest_lang=jQuery(this).val();jQuery.quick_chat_cookie("quick_chat_dest_lang",quick_chat_dest_lang,{path:quick_chat_js_vars.quick_chat_cookiepath,domain:quick_chat_js_vars.quick_chat_cookie_domain})}).val(quick_chat_dest_lang).prependTo(".quick-chat-language-container")});
jQuery.quick_chat_update_messages()}});
