$.fn.roll=function(){return this.hover(function(){this.src=this.src.replace(/(\.[^.]+$)/,"_o$1");},function(){this.src=this.src.replace(/_o(\.[^.]+$)/,"$1");});};if(typeof Hoihoi=="undefined"){Hoihoi={};}Hoihoi.Register=(function(){var A=0;return{setup:function(){var B=Hoihoi.Register;$(".unitIkemenList .btn a").toggle(B.add,B.remove).find("img").roll();Hoihoi.Register.init();Hoihoi.Register.update();},init:function(){$.each(window.selected_ikemen,function(){$(".btn a","#ikemen-"+this).click();});},update:function(){var B=(A>=3);$("#blockInputUserInfo .submit input").css({opacity:(B?1:0.25),cursor:(B?"auto":"default")}).get(0).disabled=!B;},add:function(C){$("img",this).attr("src","/img/common/btn_cancel_o.png");var B=$(this).parent().parent();var D=Hoihoi.Register.get_id(B);$(['<p class="ico">','<img src="/img/common/ico_kiss.png" alt="Get済" width="30" height="22"/>',"</p>"].join("")).appendTo(B);$('<input type="hidden" name="ikemen_id['+D+']" value="1"/>').appendTo(this);A++;Hoihoi.Register.update();},remove:function(){$("img",this).attr("src","/img/common/btn_get_o.png");var B=$(this).parent().parent();$("input, .ico",B).remove();A--;Hoihoi.Register.update();},get_id:function(C){var B=$(".img a",C).attr("href");return(/(\d+)/).exec(B)[1];}};})();$(Hoihoi.Register.setup);