"undefined"==typeof CoinHandler&&(CoinHandler={}); (function(){function n(a){var b=a.which;KeyEventUtils.isNumberKey(a)||KeyEventUtils.isBackspaceKey(b)||KeyEventUtils.isDeleteKey(b)||KeyEventUtils.isArrowKey(b)||KeyEventUtils.isTabKey(b)||KeyEventUtils.isEnterKey(b)||WindowEventUtil.stopEvent(a)}function k(){m();if("null"==PageConfig.customizeStake||8!=PageConfig.customizeStake.split(",").length)for(var a=1;8>=a;a++)l.push(CoinType.getInstanceOf(PageConfig.playerCurrency,a).amounts);else l=PageConfig.customizeStake.split(",");CoinHandler.coinClean(); CoinHandler.coinInit()}function r(a){$j.ajax({type:"POST",dataType:"JSON",url:"/member/playerService/setCustomizeStake",data:{newCustomizeStake:a},success:function(b){b?b.error?(NoticeHandler.error(b.error),k()):"SUCCESS"==b.result&&null!=b.customizeStake&&(PageConfig.customizeStake=b.customizeStake,k()):k()},error:function(b){Trace.log(b);k()}})}function t(a){for(var b=a.find("#stakeSet"),c=a.find("#editCustomizeStakeList"),e=c.find("[id^=stakeEdit_]"),d=0;dv}),c.toString()==PageConfig.customizeStake?m():r(c.toString()))}function m(){var a=$j("#coinList");a.find("#editCustomizeStakeList").hide();a.find("#stakeSet").show();a=$j("#coinList");a.find("#closeSet").removeClass("disable");a.find("#coinSave").removeClass("disable")}var f=[],h=0,p=[],q=0,l=[];CoinHandler.init=function(){k();JsCache.get("[id^=coin_]").click(function(){CoinHandler.coinListClick(this)});JsCache.get("#slipSet").click(function(b){if("undefined"== typeof LoginHandler||LoginHandler.userIsLogin())p=f,q=h,JsCache.get("#set_pop").toggle(),$j(document).click(function(){CoinHandler.coinSelectCancel();TopMenuHandler.appendAllAcceptAnyOdds();JsCache.get("#set_pop").hide();$j(document).unbind("click")}),JsCache.get("#set_pop").is(":visible")&&PageConfig.hasAccount&&JsCache.get("#account_pop").hide(),b.stopPropagation()});JsCache.get("#set_pop").click(function(b){b.stopPropagation()});JsCache.get("#closeSet").click(function(){JsCache.get("#closeSet").hasClass("disable")|| (CoinHandler.coinSelectCancel(),JsCache.get("#set_pop").hide())});JsCache.get("#coinSave").click(function(){JsCache.get("#coinSave").hasClass("disable")||CoinHandler.coinSelectSubmit(this)});var a=$j("#coinList");a.find("#edit").unbind("click").click(function(){$j(document).keydown(function(b){KeyEventUtils.isEnterKey(b.which)&&(a.find("#ok").click(),$j(document).unbind("keydown"))});t(a)});a.find("#ok").unbind("click").click(function(){u(a)});a.find("[id^=stakeEdit_]").unbind("click").click(function(){a.find(this).select()}); a.find("[id^=stakeEdit_]").keydown(n);a.find("#userCoin").keydown(n)};CoinHandler.setCoinPreference=function(a,b){$j.ajax({type:"POST",dataType:"JSON",url:"/member/playerService/setCoinPreference",data:{newCoinPreference:a,newUserCoin:b}});PageConfig.coinPreference=a;PageConfig.userCoin=b};CoinHandler.coinClean=function(){for(var a=JsCache.get("#coinList"),b=1;8>=b;b++)a.find("#coin_"+b).removeClass("select");a.find("#userCoin").val("")};CoinHandler.coinInit=function(){f=[];h=0;var a=JsCache.get("#coinList"), b=PageConfig.coinPreference.split(",");$j.each(b,function(c,e){-1==ArrayUtil.indexOf(f,parseInt(e))&&f.push(parseInt(e))});""!=PageConfig.userCoin&&0!=PageConfig.userCoin?(h=PageConfig.userCoin,a.find("#userCoin").val(h)):a.find("#userCoin").val("");for(b=0;b=b;b++)a.find("#coin_"+b).html(l[b-1]);CoinHandler.buildStakePopupList()};CoinHandler.buildStakePopupList=function(){for(var a=$j("[id^=stakePopupList]"),b=0;bb){NoticeHandler.error("DefaultStake can not less than 0");return}if(9999999a&&(a=b)}CoinHandler.setCoinPreference(f.toString(),a);JsCache.get("#set_pop").hide();k()}else NoticeHandler.error(I18N.get("msg.member.coin.amoutsLess"))};CoinHandler.coinSelectCancel=function(a){f=p;h=q;k();1==a&&JsCache.get("#coinList").hide()}})();