var previewActive=false;function kPreviewHelper(a){if(jQuery("#kbbcode-message").val()!=null){jQuery.ajax({type:"POST",url:jQuery("#kpreview_url").val(),async:false,dataType:"json",data:{body:jQuery("#kbbcode-message").val()},success:function(b){jQuery("#kbbcode-preview").html(b.preview);}});}}jQuery(document).ready(function(b){b("#tabs_kunena_editor a:first").tab("show");b("#tabs_kunena_editor a:last").click(function(g){g.preventDefault();var f=b("#kbbcode-preview");var d=b("#kbbcode-message");f.css("display","block");d.hide();kPreviewHelper();f.attr("class","kbbcode-preview-bottom controls");var c=d.css("height");f.css("height",d.css("height"));});b("#tabs_kunena_editor a:not(:last)").click(function(c){b("#kbbcode-preview").hide();b("#kbbcode-message").css("display","inline-block");b("#markItUpKbbcode-message").css("display","inline-block");});b("#tabs_kunena_editor a:last").click(function(c){b("#kbbcode-message").hide();b("#markItUpKbbcode-message").hide();});if(b("#kemojis_allowed").val()==1){var a="";if(b("#kbbcode-message").length>0&&b(".qreply").length==0){a="#kbbcode-message";}else{if(b(".qreply").length>0){a=".qreply";}}if(a!=undefined){b(a).atwho({at:":",displayTpl:"<li data-value='${key}'>${name} <img src='${url}' height='20' width='20' /></li>",insertTpl:"${name}",callbacks:{remoteFilter:function(c,d){if(c.length>0){b.ajax({url:b("#kurl_emojis").val(),data:{search:c},success:function(e){d(e.emojis);}});}}}});}}if(b.fn.sisyphus!=undefined){b("#postform").sisyphus({locationBased:true,timeout:5});}b("#kshow_attach_form").click(function(){if(b("#kattach_form").is(":visible")){b("#kattach_form").hide();}else{b("#kattach_form").show();}});b("#postcatid").change(function(){var c=b("select#postcatid option").filter(":selected").val();var d=b("#kurl_topicons_request").val();b("#subject").attr("required","required");if(b("#kanynomous-check").length>0){if(arrayanynomousbox[c]!==undefined){b("#kanynomous-check").show();b("#kanonymous").prop("checked",true);}else{b("#kanynomous-check").hide();b("#kanonymous").prop("checked",false);}}b.ajax({type:"POST",url:d,async:false,dataType:"json",data:{catid:c},success:function(f){b("#iconset_topic_list").remove();var e=b("<div>",{id:"iconset_topic_list"});b("#iconset_inject").append(e);b.each(f,function(i,j){if(j.type!="system"){if(j.id==0){var g=b("<input>",{type:"radio",id:"radio"+j.id,name:"topic_emoticon",value:j.id}).prop("checked",true);}else{var g=b("<input>",{type:"radio",id:"radio"+j.id,name:"topic_emoticon",value:j.id});}var k=b("<span>",{"class":"kiconsel"}).append(g);if(kunena_topicicontype=="B2"){var h=b("<label>",{"class":"radio inline","for":"radio"+j.id}).append(b("<span>",{"class":"icon icon-topic icon-"+j.b2,border:"0",al:""}));}else{if(kunena_topicicontype=="fa"){var h=b("<label>",{"class":"radio inline","for":"radio"+j.id}).append(b("<i>",{"class":"fa glyphicon-topic fa-2x fa-"+j.fa,border:"0",al:""}));}else{var h=b("<label>",{"class":"radio inline","for":"radio"+j.id}).append(b("<img>",{src:j.path,border:"0",al:""}));}}k.append(h);b("#iconset_topic_list").append(k);}});}});});if(b.fn.datepicker!=undefined){b("#datepoll-container .input-append.date").datepicker({orientation:"top auto"});}});