"+e,$("#result").attr("class","fade").html(output).css("opacity","1")}}})}function popularitems(){players=[],$("#team-a > a").each(function(){players.push($(this).data("id"))}),popularitems_with(players)}function selectChampions(ids,answered){answered="undefined"!=typeof answered?answered:!1;var results=search_champs("","champ",!1,!0,!0);boxes=new Array(5);for(var j=0;j'+results[key].name+'

+
'+(0==j?"":'×
')+"");$("#team-a > a").each(function(i){$(this).replaceWith(boxes[i])}),answered&&popularitems(),pushCurrentChampState(answered)}function selectionscreen(i,t){void 0!=currentBox&¤tBox.removeClass("selected"),currentBox=t.parent(),currentBox.addClass("selected");var s=t.parent().siblings(".more");s.parent().siblings(".main-results").children(".more").first().removeClass("opened"),$(".more .search").on("keyup",function(i){for(var results=search_champs($(this).val(),"champ",!1,!0,!0),output="",times=results.length,j=0;times>j;j++)results[j].statistics&&(output+=''+results[j].name+'
');var o=s.children("div").first();o.html(output),o.find("a").on("click",function(i){i.preventDefault(),selection(i,$(this),!0)}),"13"==i.keyCode&&1==times&&o.find("a").first().trigger("click")}),s.children(".search").first().val("").trigger("keyup"),s.addClass("opened").children(".search").first().focus()}function randomchamp(m,c){m="undefined"!=typeof m?m:!1,c="undefined"!=typeof c?c:!1;for(var champ={};champ.statistics!==!0;)champ=search_champs("","champ",!0)[0];return $(''+champ.name+'

+
'+(c?'×
':"")+"")}function selection(i,t,c,b){c="undefined"!=typeof c?c:!1,b="undefined"!=typeof b?b:!1,"undefined"!=typeof t?t.parent().parent().removeClass("opened").children(".search").first().val("").trigger("keyup"):$(".more").removeClass("opened").children(".search").first().val("").trigger("keyup");var replacement;replacement=b?$('

+
'):0==t.data("id")?randomchamp():t.clone().append('+
'),replacement.addClass("fadeInDown"),currentBox.hasClass("main")?replacement.addClass("main"):c&&replacement.append('×
'),currentBox.replaceWith(replacement),replacement.children("div").first().on("click",function(i){i.preventDefault(),selectionscreen(i,$(this))}),replacement.find("div .cross").first().on("click",function(i){i.preventDefault(),currentBox=$(this).parent().parent(),currentBox.removeClass("selected"),selection(i,void 0,!1,!0)}),pushCurrentChampState()}!function(){var players=$.urlParam("champion").toString();/^[0-9A-F]{4}$/i.test(players)?selectChampions([parseInt(players,16)],"true"==$.urlParam("answered")):pushCurrentChampState()}();var currentBox;$(".entity div").on("click",function(i){i.preventDefault(),selectionscreen(i,$(this))}),$(".entity div .cross").on("click",function(i){i.preventDefault(),currentBox=$(this).parent().parent(),currentBox.removeClass("selected"),selection(i,void 0,!1,!0)}),$(".more .cross").click(function(i){i.preventDefault(),currentBox.removeClass("selected"),$(this).parent().removeClass("opened").children(".search").first().val("").trigger("keyup")}),$(".more div a").click(function(i){i.preventDefault(),selection(i,$(this),!0)}),$("#popularitems").click(function(i){i.preventDefault(),popularitems()})});