jQuery(document).ready(function(c){function b(){var d=c("#kbbcode-poll-options").children("div.polloption");return d.length;}function a(){var f=b();f++;var d=c("<div></div>").attr("class","polloption").appendTo("#kbbcode-poll-options");var e=c("<label>").text(Joomla.JText._("COM_KUNENA_POLL_OPTION_NAME")+" "+f+" ");d.append(e);newInput=document.createElement("input");newInput.setAttribute("name","polloptionsID[new"+f+"]");newInput.setAttribute("id","field_option"+f);newInput.setAttribute("class","inputbox inputpollclear");newInput.setAttribute("maxlength","100");newInput.setAttribute("type","text");d.append(newInput);}if(c("#kbutton-poll-add")!=undefined){c("#kbutton-poll-add").click(function(){var e=c("#nb_options_allowed").val();var d=b();if(!e||(d<e&&d>=2)){a();}else{if(!e||d<2){a();a();}else{c("#kpoll-alert-error").show();c("#kbutton-poll-add").hide();}}});}if(c("#kbutton-poll-rem")!=undefined){c("#kbutton-poll-rem").click(function(){var e=c("div.polloption:last");if(e){var d=c("#kpoll-alert-error").is(":visible");if(d){c("#kpoll-alert-error").hide();c("#kbutton-poll-add").show();}e.remove();}});}if(c("#postcatid")!=undefined){c("#postcatid").change(function(){var d=c("select#postcatid option").filter(":selected").val();var e=jQuery.parseJSON(Joomla.getOptions("com_kunena.pollcategoriesid"));if(e[d]!==undefined){c(".pollbutton").show();}else{c(".pollbutton").hide();}});}c("#kpoll_go_results").click(function(){if(c("#poll-results").is(":visible")==true){c("#poll-results").hide();c("#kpoll_hide_results").hide();}else{c("#poll-results").show();c("#kpoll_hide_results").show();c("#kpoll_go_results").hide();}});c("#kpoll_hide_results").click(function(){if(c("#poll-results").is(":visible")==true){c("#poll-results").hide();c("#kpoll_go_results").show();c("#kpoll_hide_results").hide();}else{c("#poll-results").show();c("#kpoll_hide_results").show();c("#kpoll_go_results").hide();}});c("#kpoll-moreusers").click(function(){c("#kpoll-moreusers-div").show();});});