if (typeof (console) == 'undefined') { console = function () { }; console.log = function () { }; } String.prototype.trim = function () { return this.replace(/(^\s*)|(\s*$)/gi, ""); } function get_only_num(str){ var regex = /[^0-9]/g; // 숫자가 아닌 문자열을 매칭하는 정규식 var result = str.replace(regex, ""); // 원래 문자열에서 숫자가 아닌 모든 문자열을 빈 문자로 변경 return parseInt(result); } function is_numeric(v, o) { var chk = v.replace(/[^.0-9]/g, ''); if (v != chk) { window.alert('숫자 또는 . 만 입력해주세요.'); o.value = chk; return false; } } function is_numericbar(v, o) { var chk = v.replace(/[^-.0-9]/g, ''); if (v != chk) { window.alert('숫자 또는 . - 만 입력해주세요.'); o.value = chk; return false; } } function is_onlynumeric1(v, o) { var chk = v.replace(/[^0-9,]/g, ''); if (v != chk) { window.alert('숫자만 입력해주세요.'); o.value = chk; return false; } } function is_onlynumeric(v, o) { var chk = v.replace(/[^0-9]/g, ''); if (v != chk) { window.alert('숫자만 입력해주세요.'); o.value = chk; return false; } } function is_banknumeric(v, o) { var chk = v.replace(/[^-0-9]/g, ''); if (v != chk) { window.alert('숫자 또는 - 만 입력해주세요.'); o.value = chk; return false; } } function telValidator(args) { const msg = '유효하지 않는 전화번호입니다.'; // IE 브라우저에서는 당연히 var msg로 변경 if (/^[0-9]{2,3}-[0-9]{3,4}-[0-9]{4}/.test(args)) { return true; } // alert(msg); return false; } function phoneNumber(value) { if (!value) { return ""; } value = value.replace(/[^0-9]/g, ""); let result = []; let restNumber = ""; // 지역번호와 나머지 번호로 나누기 if (value.startsWith("02")) { // 서울 02 지역번호 result.push(value.substr(0, 2)); restNumber = value.substring(2); } else if (value.startsWith("1")) { // 지역 번호가 없는 경우 // 1xxx-yyyy restNumber = value; } else { // 나머지 3자리 지역번호 // 0xx-yyyy-zzzz result.push(value.substr(0, 3)); restNumber = value.substring(3); } if (restNumber.length === 7) { // 7자리만 남았을 때는 xxx-yyyy result.push(restNumber.substring(0, 3)); result.push(restNumber.substring(3)); } else { result.push(restNumber.substring(0, 4)); result.push(restNumber.substring(4)); } return result.filter((val) => val).join("-"); } // 정수형 숫자에서 Comma 제거 function unComma_int(input) { var inputString = new String; var outputString = new String; var outputNumber = new Number; var counter = 0; if (input == '') { return 0 } inputString = String(input); outputString = ''; for (counter = 0; counter < inputString.length; counter++) { outputString += (inputString.charAt(counter) != ',' ? inputString.charAt(counter) : ''); } outputNumber = parseFloat(outputString); return (outputNumber); } // 정수형 천단위 콤마 삽입 function Comma_int(input, obj) { input = unComma_int(input); var inputString = new String; var outputString = new String; var counter = 0; var decimalPoint = 0; var end = 0; var modval = 0; inputString = input.toString(); outputString = ''; decimalPoint = inputString.indexOf('.', 1); if (decimalPoint == -1) { end = inputString.length - (inputString.charAt(0) == '0' ? 1 : 0); for (counter = 1; counter <= inputString.length; counter++) { var modval = counter - Math.floor(counter / 3) * 3; outputString = (modval == 0 && counter < end ? ',' : '') + inputString.charAt(inputString.length - counter) + outputString; } } else { end = decimalPoint - (inputString.charAt(0) == '-' ? 1 : 0); for (counter = 1; counter <= decimalPoint; counter++) { outputString = (counter == 0 && counter < end ? ',' : '') + inputString.charAt(decimalPoint - counter) + outputString; } for (counter = decimalPoint; counter < decimalPoint + 3; counter++) { outputString += inputString.charAt(counter); } } return (outputString); } // 레벨에 _ 추가 function addUnderbar4Level(input) { if (input == '') { return 0 } inputString = String(input); outputString = inputString.charAt(0) + '_' + inputString.charAt(1); return (outputNumber); } function checkPointorMoney(v) { var pt = /[0-9]+0{2}/; return pt.test(v); } function checkEmail(v) { var pt = /[a-zA-Z\d\-\.]+@([a-zA-Z\d\-]+(\.[a-zA-Z\d\-]{2,4})+)/; return pt.test(v); } function checkIDPass(v) { var chk = v.replace(/[^a-zA-Z0-9]/g, ''); var pt = /[a-zA-Z0-9]{4,24}/; if(v){ if( v.length <4 || v.length>24 ){ return false; }else{ return true; } } if (v == chk && pt.test(v)) return true; else return false; } function LogIn() { var f = document.HiddenActionForm; var login_id = document.getElementById("login_id"); var login_pass = document.getElementById("login_pass"); //var remember = document.getElementById("remember"); if (login_id.value == "" ) { alert("'회원아이디'를 2~20자리로 입력해주세요.(영문대,소문자 및 숫자만 허용)"); login_id.focus(); } else if (login_pass.value == "" ) { alert("'비밀번호'를 2~20자리로 입력해주세요.(영문대,소문자 및 숫자만 허용)"); login_pass.focus(); } else { f.HAF_Value_0.value = "MemberLogin"; f.HAF_Value_1.value = login_id.value; f.HAF_Value_2.value = login_pass.value; f.HAF_Value_3.value = ''; f.HAF_Value_3.value = false; f.method = "POST"; f.action = "/action/member_action.php"; f.submit(); } ; } function LogIn_admin() { var f = document.HiddenActionForm; var login_id = document.getElementById("login_id"); var login_pass = document.getElementById("login_pass"); if (login_id.value.trim() == "" || !checkIDPass(login_id.value.trim())) { alert("'회원아이디'를 2~10자리로 입력해주세요.(영문대,소문자 및 숫자만 허용)"); login_id.focus(); } else if (login_pass.value.trim() == "" || !checkIDPass(login_pass.value.trim())) { alert("'비밀번호'를 2~10자리로 입력해주세요.(영문대,소문자 및 숫자만 허용)"); login_pass.focus(); } else { f.HAF_Value_0.value = "AdminLogin"; f.HAF_Value_1.value = login_id.value.trim(); f.HAF_Value_2.value = login_pass.value.trim(); f.method = "POST"; f.action = "/action/member_action.php"; f.submit(); } ; } function LogIn_seller() { var f = document.HiddenActionForm; var login_id = document.getElementById("login_id"); var login_pass = document.getElementById("login_pass"); if (login_id.value.trim() == "" || !checkIDPass(login_id.value.trim())) { alert("'회원아이디'를 2~10자리로 입력해주세요.(영문대,소문자 및 숫자만 허용)"); login_id.focus(); } else if (login_pass.value.trim() == "" || !checkIDPass(login_pass.value.trim())) { alert("'비밀번호'를 2~10자리로 입력해주세요.(영문대,소문자 및 숫자만 허용)"); login_pass.focus(); } else { f.HAF_Value_0.value = "SellerLogin"; f.HAF_Value_1.value = login_id.value.trim(); f.HAF_Value_2.value = login_pass.value.trim(); f.method = "POST"; f.action = "/action/member_action.php"; f.submit(); } ; } function LogOut() { location.href = "/action/member_logout.php"; var f = document.HiddenActionForm; f.HAF_Value_0.value = "MemberLogout"; f.method = "POST"; f.action = "/action/member_action.php"; f.submit(); } function LogOut_admin() { var f = document.HiddenActionForm; f.HAF_Value_0.value = "AdminLogout"; f.method = "POST"; f.action = "/action/member_action.php"; f.submit(); } function LogOut_seller() { location.href = "/action/seller_logout.php"; } function ChargeRequestCancel(k) { if (confirm("충전 요청을 취소하시겠습니까?")) { var f = document.HiddenActionForm; f.HAF_Value_0.value = "RequestMoneyChargeCancel"; f.HAF_Value_1.value = k; f.method = "POST"; f.action = "/action/money_action.php"; f.submit(); } ; } function BoardReplyWrite(b_key) { var f = document.HiddenActionForm; var comment = document.getElementById("comment"); if (comment.value.trim() == "") { alert("내용을 입력해 주세요."); comment.focus(); } else if (confirm("등록하시겠습니까?")) { f.HAF_Value_0.value = "BoardReplyWrite"; f.HAF_Value_1.value = b_key; f.HAF_Value_2.value = comment.value.trim().replace(/\n/g, "
"); if (document.getElementById('writer')) { if (document.getElementById('writer').value != 'admins') f.HAF_Value_10.value = document.getElementById('writer').value; } f.method = "POST"; f.action = "/action/board_action.php"; f.submit(); } ; } function BoardReplyDelete(b_key, br_key) { var f = document.HiddenActionForm; if (confirm("삭제하시겠습니까?")) { f.HAF_Value_0.value = "BoardReplyDelete"; f.HAF_Value_1.value = b_key; f.HAF_Value_2.value = br_key; f.method = "POST"; f.action = "/action/board_action.php"; f.submit(); } ; } function BoardReplyModify(b_key, br_key) { var f = document.HiddenActionForm; if (confirm("수정하시겠습니까?")) { f.HAF_Value_0.value = "BoardReplyModify"; f.HAF_Value_1.value = b_key; f.HAF_Value_2.value = br_key; f.HAF_Value_3.value = document.getElementById("br_regdate_" + b_key + "_" + br_key).value; f.HAF_Value_4.value = document.getElementById("br_content_" + b_key + "_" + br_key).value; f.method = "POST"; f.action = "/action/board_action.php"; f.submit(); } ; } function BoardDelete(b_key, vars, auth) { var f = document.HiddenActionForm; if (confirm("삭제하시겠습니까?")) { f.HAF_Value_0.value = "BoardDelete"; f.HAF_Value_1.value = b_key; f.HAF_Value_2.value = vars; f.HAF_Value_3.value = auth; f.method = "POST"; f.action = "/action/board_action.php"; f.submit(); } ; } function BoardGameResultWrite(bg_key) { var f = document.HiddenActionForm; if (confirm("베팅정보를 등록하시겠습니까?")) { f.HAF_Value_0.value = "BoardGameResultWrite"; f.HAF_Value_1.value = bg_key; f.method = "POST"; f.action = "/action/board_action.php"; f.submit(); } ; } ; function BoardBankInfoMemoSend( ) { var f = document.HiddenActionForm; if (confirm("계좌문의 쪽지를 요청하시겠습니까?")) { f.HAF_Value_0.value = "BoardBankInfoMemoSend"; f.method = "POST"; f.action = "/action/board_action.php"; f.submit(); } ; } ; function SetMaxBettingMoney() { var min_bet_money = $('#f_min_bet_money').val(); var s_min_bet_money = Comma_int($('#f_min_bet_money').val()); var max_win_money = $('#f_max_win_money').val(); var s_max_win_money = Comma_int($('#f_max_win_money').val()); var max_bet_money = $('#f_max_betting_money').val(); var s_max_bet_money = Comma_int($('#f_max_betting_money').val()); var max_win_money_special = $('#f_max_win_money_special').val(); var s_max_win_money_special = Comma_int($('#f_max_win_money_special').val()); var max_bet_money_special = $('#f_max_bet_money_special').val(); var s_max_bet_money_special = Comma_int($('#f_max_bet_money_special').val()); var MaxBettingMoney = max_bet_money; var MaxQuotaMoney = max_win_money; console.log("MaxBettingMoney:"+MaxBettingMoney); var UserQuotaMoneyOrg = parseInt(document.getElementById("UserQuotaMoneyOrg").value); if(UserQuotaMoneyOrg MaxBettingMoney) BettingPrice = MaxBettingMoney; console.log("MaxBettingMoney:"+MaxBettingMoney); document.getElementById("BettingMoney").value = Comma_int(BettingPrice); document.getElementById("BettingQuotaMoney").innerHTML = Comma_int(parseInt(BettingQuota.innerHTML * BettingPrice)); } ; function CalcCart(price) { if (price != "") { var BettingQuota = document.getElementById("BettingQuota"); var BettingQuotaMoney = document.getElementById("BettingQuotaMoney"); var BettingPrice = parseInt(parseFloat(BettingQuota.innerHTML) * Number(unComma_int(price))); if (BettingPrice > 3000000) BettingPrice = 3000000; var BettingPriceComma = Comma_int(BettingPrice, BettingQuotaMoney); BettingQuotaMoney.innerHTML = BettingPriceComma; } ; } function GameCartDelete(cgl_key) { if (cgl_key != "") { var BettingMoney = unComma_int(document.getElementById("BettingMoney").value); var urls = '/action/ajax_cart_action.php'; var parm = '&action=DeleteCart&cgl_key=' + cgl_key + '&g_price=' + BettingMoney; new ajax.xhr.Request(urls, parm, GameCartCallback, "GET"); } ; } function GameCartAllDelete() { var BettingMoney = unComma_int(document.getElementById("BettingMoney").value); var urls = '/action/ajax_cart_action.php'; var parm = '&action=AllDeleteCart&g_price=' + BettingMoney; new ajax.xhr.Request(urls, parm, GameCartCallback, "GET"); } function GameCartInsert(g_key, g_result, g_div, g_type1) { if (g_key != "") { if (g_div.cgl_key && g_div.cgl_key != "") { //마우스온오버시 색상변환 //var g_div_bg = document.getElementById( g_div.id + "_BG" ); //g_div.bgColor = "#303030"; //카트에서 삭제시 해당셀 background-color 원복 //g_div_bg.value = "#303030"; //카트에서 삭제시 해당셀 background-color 원복 g_div.style.backgroundColor = "#1B1B1B"; GameCartDelete(g_div.cgl_key); g_div.cgl_key = ""; } else { var BettingMoney = unComma_int(document.getElementById("BettingMoney").value); var urls = '/action/ajax_cart_action.php'; var parm = '&action=InsertCart&g_key=' + g_key + '&g_result=' + g_result + '&g_price=' + BettingMoney + '&g_type1=' + g_type1; new ajax.xhr.Request(urls, parm, GameCartCallback, "GET"); } } ; } function GameCartLoading() { var urls = '/action/ajax_cart_action.php'; var parm = '&action=Loading'; new ajax.xhr.Request(urls, parm, GameCartCallback, "GET"); } ; function GameCartCallback(req) { if (req.readyState == 4) { if (req.status == 200) { if (req.responseText.substr(0, 6) == "[INFO]") { //승무패 조합식 조건에 위배되는 경고 문구 출력시(ajax_cart_action.php 310줄) alert(req.responseText); } else { GameCartRefresh(req.responseText); GameCartAllListBlank(); GameCartCheckedListLoading(); } } else { //alert("에러 발생: "+req.status); } } } function GameCartRefresh(_html) { var alwayStalker = document.getElementById("alwayStalker"); alwayStalker.innerHTML = _html; } //function GameCartCheckedList( g_key , g_result) { function GameCartCheckedList(g_key, g_result, cgl_id) { if (g_key && g_result) { var g_win = document.getElementById(g_key + "_Win"); var g_draw = document.getElementById(g_key + "_Draw"); var g_lose = document.getElementById(g_key + "_Lose"); var g_handiwin = document.getElementById(g_key + "_HandiWin"); var g_handilose = document.getElementById(g_key + "_HandiLose"); var g_under = document.getElementById(g_key + "_Under"); var g_over = document.getElementById(g_key + "_Over"); var g_odd = document.getElementById(g_key + "_Odd"); var g_even = document.getElementById(g_key + "_Even"); var g_home = document.getElementById(g_key + "_home"); var g_away = document.getElementById(g_key + "_away"); //마우스온오버시 색상변환 //var g_win_bg = document.getElementById( g_key + "_Win_BG" ); //var g_draw_bg = document.getElementById( g_key + "_Draw_BG" ); //var g_lose_bg = document.getElementById( g_key + "_Lose_BG" ); //var g_handiwin_bg = document.getElementById( g_key + "_HandiWin_BG" ); //var g_handilose_bg = document.getElementById( g_key + "_HandiLose_BG" ); //var g_under_bg = document.getElementById( g_key + "_Under_BG" ); //var g_over_bg = document.getElementById( g_key + "_Over_BG" ); //var g_odd_bg = document.getElementById( g_key + "_Odd_BG" ); //var g_even_bg = document.getElementById( g_key + "_Even_BG" ); //var g_home_bg = document.getElementById( g_key + "_home_BG" ); //var g_away_bg = document.getElementById( g_key + "_away_BG" ); //마우스온오버시 색상변환 //배경색 초기화 //if ( g_win ) g_win.style.backgroundColor = "#1B1B1B"; //if ( g_draw ) g_draw.style.backgroundColor = "#1B1B1B"; //if ( g_lose ) g_lose.style.backgroundColor = "#1B1B1B"; //if ( g_handiwin ) g_handiwin.style.backgroundColor = "#1B1B1B"; //if ( g_handilose ) g_handilose.style.backgroundColor = "#1B1B1B"; //if ( g_under ) g_under.style.backgroundColor = "#1B1B1B"; //if ( g_over ) g_over.style.backgroundColor = "#1B1B1B"; //if ( g_odd ) g_odd.style.backgroundColor = "#1B1B1B"; //if ( g_even ) g_even.style.backgroundColor = "#1B1B1B"; //if ( g_home ) g_home.style.backgroundColor = "#1B1B1B"; //if ( g_away ) g_away.style.backgroundColor = "#1B1B1B"; //배경색 초기화 (마감경기 배경은 처리안함) if (g_win) g_win.style.backgroundColor = "#1B1B1B"; if (g_draw) g_draw.style.backgroundColor = "#1B1B1B"; if (g_lose) g_lose.style.backgroundColor = "#1B1B1B"; if (g_handiwin) g_handiwin.style.backgroundColor = "#1B1B1B"; if (g_handilose) g_handilose.style.backgroundColor = "#1B1B1B"; if (g_under) g_under.style.backgroundColor = "#1B1B1B"; if (g_over) g_over.style.backgroundColor = "#1B1B1B"; if (g_odd) g_odd.style.backgroundColor = "#1B1B1B"; if (g_even) g_even.style.backgroundColor = "#1B1B1B"; if (g_home) g_home.style.backgroundColor = "#1B1B1B"; if (g_away) g_away.style.backgroundColor = "#1B1B1B"; //폰트색 초기화 if (g_win) g_win.style.color = "#FFFFFF"; if (g_draw) g_draw.style.color = "#FFFFFF"; if (g_lose) g_lose.style.color = "#FFFFFF"; if (g_handiwin) g_handiwin.style.color = "#FFFFFF"; if (g_handilose) g_handilose.style.color = "#FFFFFF"; if (g_under) g_under.style.color = "#FFFFFF"; if (g_over) g_over.style.color = "#FFFFFF"; if (g_odd) g_odd.style.color = "#FFFFFF"; if (g_even) g_even.style.color = "#FFFFFF"; if (g_home) g_home.style.color = "#FFFFFF"; if (g_away) g_away.style.color = "#FFFFFF"; //if ( g_win ) g_win.bgColor = "#303030"; //if ( g_draw ) g_draw.bgColor = "#303030"; //if ( g_lose ) g_lose.bgColor = "#303030"; //if ( g_handiwin ) g_handiwin.bgColor = "#303030"; //if ( g_handilose ) g_handilose.bgColor = "#303030"; //if ( g_under ) g_under.bgColor = "#303030"; //if ( g_over ) g_over.bgColor = "#303030"; //if ( g_odd ) g_odd.bgColor = "#303030"; //if ( g_even ) g_even.bgColor = "#303030"; //if ( g_home ) g_home.bgColor = "#303030"; //if ( g_away ) g_away.bgColor = "#303030"; //마우스온오버시 색상변환 //if ( g_win ) g_win_bg.value = "#303030"; //if ( g_draw ) g_draw_bg.value = "#303030"; //if ( g_lose ) g_lose_bg.value = "#303030"; //if ( g_handiwin ) g_handiwin_bg.value = "#303030"; //if ( g_handilose ) g_handilose_bg.value = "#303030"; //if ( g_under ) g_under_bg.value = "#303030"; //if ( g_over ) g_over_bg.value = "#303030"; //if ( g_odd ) g_odd_bg.value = "#303030"; //if ( g_even ) g_even_bg.value = "#303030"; //if ( g_home ) g_home_bg.value = "#303030"; //if ( g_away ) g_away_bg.value = "#303030"; if (g_win) g_win.cgl_key = ""; if (g_draw) g_draw.cgl_key = ""; if (g_lose) g_lose.cgl_key = ""; if (g_handiwin) g_handiwin.cgl_key = ""; if (g_handiwin) g_handiwin.cgl_key = ""; if (g_handilose) g_handilose.cgl_key = ""; if (g_under) g_under.cgl_key = ""; if (g_over) g_over.cgl_key = ""; if (g_odd) g_odd.cgl_key = ""; if (g_even) g_even.cgl_key = ""; if (g_home) g_home.cgl_key = ""; if (g_away) g_away.cgl_key = ""; //마우스온오버시 색상변환 //var g_result_bg = document.getElementById( g_result.id + "_BG"); var g_result = document.getElementById(g_key + "_" + g_result); if (g_result) { //마우스온오버시 색상변환 //g_result_bg.value = "#FF9C00"; g_result.style.backgroundColor = "#CCA707"; g_result.style.color = "#FFCC00"; g_result.cgl_key = cgl_id; } } ; } function GameCartCheckedListLoading() { var urls = '/action/ajax_cart_action.php'; var parm = '&action=CheckedList'; new ajax.xhr.Request(urls, parm, GameCartCheckedListLoadingback, "GET"); } function GameCartCheckedListLoadingback(req) { if (req.readyState == 4) { if (req.status == 200) { eval(req.responseText); } else { //alert("에러 발생: "+req.status); } } } function GameCartAllListBlank() { var obj = document.getElementById("gamelist"); if (obj) SearchTag(obj); } function SearchTag(obj) { var _pattern = /Win|Draw|Lose|Under|Over|Odd|Even|home|away/ var _patternResult = /_Result_/ for (var i = 0; i < obj.childNodes.length; i++) { var cnode = obj.childNodes.item(i); if (cnode.id) { if (_pattern.test(cnode.id) && !_patternResult.test(cnode.id)) { //게임리스트 페이지의 승무패 등의 id 값일 경우 || //경기결과 페이지의 _Result_ id 가 아닌 경우만 초기화 //cnode.bgColor = '#303030'; //게임리스트 테이블내 팀명,승무패 배당셀 기본 background-color if (cnode.style.backgroundColor != "#332523") //마감된 경기는 일반셀 배경과 다르므로 마감경기 배경은 처리안함 cnode.style.backgroundColor = '#1B1B1B'; //카트 재로딩시 게임리스트 테이블내 팀명,승무패 배당셀 기본 background-color 초기화 cnode.style.color = "#FFFFFF"; cnode.value = '#1B1B1B'; } } ; if (cnode.childNodes.length > 0) SearchTag(cnode); } } function GameCartBuy(cnt) { var BettingMoney = document.getElementById("BettingMoney"); var BettingMoneyVal = unComma_int(BettingMoney.value); var f = document.HiddenActionForm; var returnMoney = unComma_int(document.getElementById("BettingQuotaMoney").innerHTML); if (cnt < 1) { alert("구매할 게임이 없습니다."); //} else if ( cnt < 2 ) { // alert("최소한 2게임이상 선택하셔야 베팅 가능합니다."); } else if (BettingMoneyVal < 2000) { alert("배팅금액을 적어주세요. ex) 2000 ~ 1000000"); BettingMoney.focus(); } else if (BettingMoneyVal > 1000000) { alert("배팅금액은 100만원을 초과할 수 없습니다. ex) 2000 ~ 1000000"); BettingMoney.focus(); } else if (returnMoney.value > 3000000) { alert("당첨배당금액은 300만원을 초과할 수 없습니다."); BettingMoney.focus(); } else if (confirm("선택한 게임을 구매하시겠습니까?\n경기 배당률이 변경된 경우도 있습니다. 구매전 꼭 확인하세요.")) { f.HAF_Value_0.value = "BuyCart"; f.HAF_Value_1.value = BettingMoneyVal; f.method = "POST"; f.action = "/action/ajax_cart_action.php"; f.submit(); } ; } function SearchGame(f, sch_gtype1, sch_gtype2) { // var sch_gtype = document.getElementById( "sch_gtype" ).value.trim(); var sch_item = document.getElementById("sch_item").value.trim(); //var sch_sdate = document.getElementById( "sch_sdate" ).value.trim(); //var sch_edate = document.getElementById( "sch_edate" ).value.trim(); //location.href = "./" + f + ".php?sch_league=" + sch_league + "&sch_sdate=" + sch_sdate + "&sch_edate=" + sch_edate + "&sch_gtype=" + sch_gtype + "&sch_gtype1=" + sch_gtype1 + "&sch_gtype2=" + sch_gtype2; location.href = "./" + f + ".php?sch_item=" + sch_item + "&sch_gtype1=" + sch_gtype1 + "&sch_gtype2=" + sch_gtype2; } //////// 자바스크립트를 이용한 배팅카트 작업 시작 //////// function mouseOver(obj) { if (obj.className == "selected") { obj.className = "selected_over"; } if (obj.className == "default") obj.className = "over"; //else if(obj.className=='select') obj.className="normal"; } function mouseOut(obj) { if (obj.className == "selected") { return; } if (obj.className == "selected_over") { obj.className = "selected"; } if (obj.className == "over") obj.className = "default"; } function selectedGame2(obj, id, pos, divi, h_nm, a_nm, h_div, t_div, a_div, g_datetime, j_idx, l_idx, g_type, g_choice, cross_odd_underover, cross_odd_handicap, cross_handicap_underover, cross_draw_under, cross_same_game) { var ele = null; //if (betting_list.length >= 10 && obj.className!='selected') { // alert("한번 베팅에 조합은 10개까지만 가능합니다."); // return; //} ////////////////////// 승무패 크로스조합 조건 시작 ///////////////////////// var i = 0; var bet = null; var pt = /615|5607|6041|1429|1312|2533|2318/; var pt = /615|5607|6041|1429|1312|2533|2318|2533|2316|10241|10242|10243|10244/; if (pt.test(l_idx) && betting_list.length >= 1) { var selected_same_game = false; for (i = 0; i < betting_list.length; i++) { bet = betting_list[i]; if (bet.game_idx == id) { selected_same_game = true; } } if (!selected_same_game && betting_list.length >= 1 && (obj.className == 'default' || obj.className == 'over')) { //alert("사다리 조합은 1개까지만 가능합니다."); //return false; } } if(divi==1){ console.log("divi:"+divi); return false; } var pt = /2868/; for (i = 0; i < betting_list.length; i++) { bet = betting_list[i]; if(id!=bet.game_idx){ if(pt.test(bet.league_idx)==true && (g_choice == "HandiWin" || g_choice == "HandiLose")) { alert("[INFO] 보너스 배당은 핸디캡과 크로스 조합할 수 없습니다."); return false; } if(pt.test(bet.league_idx)==true && (g_choice == "Under" || g_choice == "Over")) { alert("[INFO] 보너스 배당은 언오버와 크로스 조합할 수 없습니다."); return false; } } if (pt.test(l_idx)==true && (bet.game_choice == "Under" || bet.game_choice == "Over") ) { alert("[INFO] 보너스 배당은 언오버와 크로스 조합할 수 없습니다."); return false; } if (pt.test(l_idx)==true && (bet.game_choice == "HandiWin" || bet.game_choice == "HandiLose") ) { alert("[INFO] 보너스 배당은 핸디캡과 크로스 조합할 수 없습니다."); return false; } } for (i = 0; i < betting_list.length; i++) { bet = betting_list[i]; // //조합베팅조건 : 같은경기 끼리는 아예 조합이 안되게 함. if (cross_same_game == 0 && bet.game_idx != id && bet.home_nm.trim() == h_nm.trim() && bet.away_nm.trim() == a_nm.trim() && bet.game_datetime == g_datetime) { if(j_idx==1){ alert("[INFO] 동일한 경기의 승무패/핸디캡/언더오버는 크로스 조합할 수 없습니다."); return false; } } if (document.getElementById("sch_gtype1").value == "Cross" || document.getElementById("sch_gtype1").value == "Special2") { //alert('1'); if (bet.game_idx != id && bet.home_nm.trim() == h_nm.trim() && bet.away_nm.trim() == a_nm.trim() && bet.game_datetime == g_datetime) { //alert('2/'+cross_handicap_underover+bet.game_choice); if (g_choice == "Win" || g_choice == "Draw" || g_choice == "Lose") { if (cross_odd_handicap == 0 && (bet.game_choice == "HandiWin" || bet.game_choice == "HandiLose")) { alert("[INFO] 동일한 경기의 승무패와 핸디캡은 크로스 조합할 수 없습니다."); return false; } else if (cross_odd_underover == 0 && (bet.game_choice == "Under" || bet.game_choice == "Over")) { alert("[INFO] 동일한 경기의 승무패와 언오버는 크로스 조합할 수 없습니다."); return false; } else if (bet.game_choice == "Win" || bet.game_choice == "Draw" || bet.game_choice == "Lose") { alert("[INFO] 동일한 경기의 승무패와 승무패는 크로스 조합할 수 없습니다."); return false; } } if (g_choice == "Draw") { if (cross_draw_under == 0 && bet.game_choice == "Under") { alert("[INFO] 동일한 경기의 무와 언더는 크로스 조합할 수 없습니다."); return false; } } if (g_choice == "HandiWin" || g_choice == "HandiLose") { if (cross_odd_handicap == 0 && (bet.game_choice == "Win" || bet.game_choice == "Draw" || bet.game_choice == "Lose")) { alert("[INFO] 동일한 경기의 핸디캡과 승무패는 크로스 조합할 수 없습니다."); return false; } if (cross_handicap_underover == 0 && (bet.game_choice == "Under" || bet.game_choice == "Over")) { alert("[INFO] 동일한 경기의 핸디캡과 언오버는 크로스 조합할 수 없습니다."); return false; } if (bet.game_choice == "HandiWin" || bet.game_choice == "HandiLose") { alert("[INFO] 동일한 경기의 핸디캡과 핸디캡은 크로스 조합할 수 없습니다."); return false; } } else if (g_choice == "Under" || g_choice == "Over") { if (cross_odd_underover == 0 && (bet.game_choice == "Win" || bet.game_choice == "Draw" || bet.game_choice == "Lose")) { alert("[INFO] 동일한 경기의 언오버와 승무패는 크로스 조합할 수 없습니다."); return false; } if (bet.game_choice == "Under" || bet.game_choice == "Over") { alert("[INFO] 동일한 경기의 언오버와 언오버는 크로스 조합할 수 없습니다."); return false; } } if (g_choice == "Under") { if (cross_draw_under == 0 && bet.game_choice == "Draw") { alert("[INFO] 동일한 경기의 언더와 무는 크로스 조합할 수 없습니다."); return false; } } if(j_idx=="5"){ if (g_choice == "HandiWin" || g_choice == "HandiLose") { if (bet.game_choice == "Under" || bet.game_choice == "Over") { alert("[INFO] 동일한 경기의 핸디캡과 언오버는 조합할 수 없습니다.."); return false; } } if (g_choice == "Under" || g_choice == "Over") { if (bet.game_choice == "HandiWin" || bet.game_choice == "HandiLose") { alert("[INFO] 동일한 경기의 언오버와 핸디캡은 조합할 수 없습니다.."); return false; } } } // } } } // ///// 스페셜 크로스조합 조건 끝 ///// // if (document.getElementById("sch_gtype").value == "OddEven") { // if (bet.game_idx != id && bet.home_nm.trim() == h_nm.trim() && bet.away_nm.trim() == a_nm.trim() && bet.game_datetime == g_datetime) { // if ( (g_choice == "Draw" && bet.game_choice == "Under") || (g_choice == "Under" && bet.game_choice == "Draw") ) { // alert("[INFO] 동일한 경기의 무와 언더조합은 불가능합니다."); // return false; // } // } // } } ////////////////////// 승무패 크로스조합 조건 끝 /////////////////////////// if (obj.className == 'default' || obj.className == 'over') { //alert("asd"); obj.className = "selected"; if (pos != 1) { ele = document.getElementById(id + "_1"); if (ele && ele != null) { if (ele.className == "selected") { ele.className = "default"; } } } ele = null; if (pos != 3) { ele = document.getElementById(id + "_3"); if (ele && ele != null) { if (ele.className == "selected") ele.className = "default"; } } ele = null; if (pos != 2) { ele = document.getElementById(id + "_2"); if (ele && ele != null) { if (ele.className == "selected") ele.className = "default"; } } addBettingSlip(id, pos, divi, h_nm, a_nm, h_div, t_div, a_div, g_datetime, j_idx, l_idx, g_type, g_choice,'0',''); } else if (obj.className == 'selected' || obj.className == 'selected_over') { obj.className = "default"; delBettingSlip(id); } } function selectedGame_baseball(obj, id, pos, divi, h_nm, a_nm, h_div, t_div, a_div, g_datetime, j_idx, l_idx, g_type, g_choice) { var ele = null; cross_same_game = 0; cross_odd_underover = 0; cross_handicap_underover = 0; cross_draw_under = 0; cross_same_game = 0; //if (betting_list.length >= 10 && obj.className!='selected') { // alert("한번 베팅에 조합은 10개까지만 가능합니다."); // return; //}, cross_odd_underover, cross_odd_handicap, cross_handicap_underover, cross_draw_under, cross_same_game ////////////////////// 승무패 크로스조합 조건 시작 ///////////////////////// var i = 0; var bet = null; var pt = /615|5607|6041|1429|1312|2533|2318/; var pt = /615|5607|6041|1429|1312|2533|2318|2533|2316|10241|10242|10243|10244/; if (pt.test(l_idx) && betting_list.length >= 1) { var selected_same_game = false; for (i = 0; i < betting_list.length; i++) { bet = betting_list[i]; if (bet.game_idx == id) { selected_same_game = true; } } if (!selected_same_game && betting_list.length >= 1 && (obj.className == 'default' || obj.className == 'over')) { //alert("사다리 조합은 1개까지만 가능합니다."); //return false; } } if(divi==1){ console.log("divi:"+divi); return false; } var pt = /99999/; if(l_idx==pt){ console.log("bonus : l_idx:"+l_idx); } for (i = 0; i < betting_list.length; i++) { bet = betting_list[i]; if(id!=bet.game_idx){ if(pt.test(bet.league_idx)==true && (g_choice == "HandiWin" || g_choice == "HandiLose")) { alert("[INFO] 보너스 배당은 핸디캡과 크로스 조합할 수 없습니다."); return false; } if(pt.test(bet.league_idx)==true && (g_choice == "Under" || g_choice == "Over")) { alert("[INFO] 보너스 배당은 언오버와 크로스 조합할 수 없습니다."); return false; } } if (pt.test(l_idx)==true && (bet.game_choice == "Under" || bet.game_choice == "Over") ) { alert("[INFO] 보너스 배당은 언오버와 크로스 조합할 수 없습니다."); return false; } if (pt.test(l_idx)==true && (bet.game_choice == "HandiWin" || bet.game_choice == "HandiLose") ) { alert("[INFO] 보너스 배당은 핸디캡과 크로스 조합할 수 없습니다."); return false; } } for (i = 0; i < betting_list.length; i++) { bet = betting_list[i]; // //조합베팅조건 : 같은경기 끼리는 아예 조합이 안되게 함. if (cross_same_game == 0 && bet.game_idx != id && bet.home_nm.trim() == h_nm.trim() && bet.away_nm.trim() == a_nm.trim() && bet.game_datetime == g_datetime) { if(j_idx==1){ alert("[INFO] 동일한 경기의 승무패/핸디캡/언더오버는 크로스 조합할 수 없습니다."); return false; } } if (document.getElementById("sch_gtype1").value == "Special3") { if (bet.game_idx != id && bet.home_nm.trim() == h_nm.trim() && bet.away_nm.trim() == a_nm.trim() && bet.game_datetime == g_datetime) { if (g_choice == "Win" || g_choice == "Draw" || g_choice == "Lose") { if (cross_odd_handicap == 0 && (bet.game_choice == "HandiWin" || bet.game_choice == "HandiLose")) { alert("[INFO] 동일한 경기의 승무패와 핸디캡은 크로스 조합할 수 없습니다."); return false; } else if (cross_odd_underover == 0 && (bet.game_choice == "Under" || bet.game_choice == "Over")) { alert("[INFO] 동일한 경기의 승무패와 언오버는 크로스 조합할 수 없습니다."); return false; } } if (g_choice == "Draw") { if (cross_draw_under == 0 && bet.game_choice == "Under") { alert("[INFO] 동일한 경기의 무와 언더는 크로스 조합할 수 없습니다."); return false; } } if (g_choice == "HandiWin" || g_choice == "HandiLose") { if (cross_odd_handicap == 0 && (bet.game_choice == "Win" || bet.game_choice == "Draw" || bet.game_choice == "Lose")) { alert("[INFO] 동일한 경기의 핸디캡과 승무패는 크로스 조합할 수 없습니다."); return false; } if (cross_handicap_underover == 0 && (bet.game_choice == "Under" || bet.game_choice == "Over")) { alert("[INFO] 동일한 경기의 핸디캡과 언오버는 크로스 조합할 수 없습니다."); return false; } } else if (g_choice == "Under" || g_choice == "Over") { if (cross_odd_underover == 0 && (bet.game_choice == "Win" || bet.game_choice == "Draw" || bet.game_choice == "Lose")) { alert("[INFO] 동일한 경기의 언오버와 승무패는 크로스 조합할 수 없습니다."); return false; } } if (g_choice == "Under") { if (cross_draw_under == 0 && bet.game_choice == "Draw") { alert("[INFO] 동일한 경기의 언더와 무는 크로스 조합할 수 없습니다."); return false; } } // } } } // ///// 스페셜 크로스조합 조건 끝 ///// // if (document.getElementById("sch_gtype").value == "OddEven") { // if (bet.game_idx != id && bet.home_nm.trim() == h_nm.trim() && bet.away_nm.trim() == a_nm.trim() && bet.game_datetime == g_datetime) { // if ( (g_choice == "Draw" && bet.game_choice == "Under") || (g_choice == "Under" && bet.game_choice == "Draw") ) { // alert("[INFO] 동일한 경기의 무와 언더조합은 불가능합니다."); // return false; // } // } // } } ////////////////////// 승무패 크로스조합 조건 끝 /////////////////////////// if (obj.className == 'default' || obj.className == 'over') { //alert("asd"); obj.className = "selected"; if (pos != 1) { ele = document.getElementById(id + "_1"); if (ele && ele != null) { if (ele.className == "selected") { ele.className = "default"; } } } ele = null; if (pos != 3) { ele = document.getElementById(id + "_3"); if (ele && ele != null) { if (ele.className == "selected") ele.className = "default"; } } ele = null; if (pos != 2) { ele = document.getElementById(id + "_2"); if (ele && ele != null) { if (ele.className == "selected") ele.className = "default"; } } addBettingSlip(id, pos, divi, h_nm, a_nm, h_div, t_div, a_div, g_datetime, j_idx, l_idx, g_type, g_choice,'0',''); } else if (obj.className == 'selected' || obj.className == 'selected_over') { obj.className = "default"; delBettingSlip(id); } } function check_bonus(){ var pt = "99999"; var bet_limit_cnt = 0; var bet_cnt = 0; var bet_bonus_cnt = 0; for (i = 0; i < betting_list.length; i++) { bet = betting_list[i]; if (bet.league_idx==pt){ ++bet_bonus_cnt; //console.log("bet.home_nm:"+bet.home_nm); var regex = /[^0-9]/g; var result = bet.home_nm.replace(regex, ""); var bet_limit_cnt = parseInt(result); //console.log("bet_limit_cnt:"+bet_limit_cnt); }else{ ++bet_cnt; } //console.log("bet_cnt++:"+bet_cnt); //console.log("bet_bonus_cnt++:"+bet_bonus_cnt); } //console.log("2bet_limit_cnt:"+bet_limit_cnt); if(bet_bonus_cnt>1){ alert("[INFO] 보너스폴더는 1개 이상 선택하실수없습니다."); return false; } if(bet_bonus_cnt>0){ if(dividend>1.3){ }else{ alert("[INFO] 1.3배당 이하는 보너스배당과 배팅하실수없습니다."); return false; } for (i = 0; i < betting_list.length; i++) { bet = betting_list[i]; //console.log("check_bonus Found bonus : bet.league_idx:"+bet.league_idx); if(bet.league_idx!=pt){ if(bet.dividend>=1.3){ }else{ //console.log("check_bonus Found bonus : bet.dividend:"+bet.dividend); alert("[INFO] 1.3배당 미만은 보너스배당과 조합불가"); return false; } } } } if(bet_limit_cnt>0 && bet_cnt < bet_limit_cnt){ alert("[INFO] 해당 보너스 배당은 "+bet_limit_cnt+"폴더이상이어야 조합할 수 있습니다."); return false; } return true; } function selectedGameNew(obj, id, pos, divi, h_nm, a_nm, h_nm_dis, a_nm_dis, h_div, t_div, a_div, g_datetime, j_idx, l_idx, g_type, g_choice, cross_odd_underover, cross_odd_handicap, cross_handicap_underover, cross_draw_under, cross_same_game) { //console.log("divi:"+divi); var ele = null; ////////////////////// 승무패 크로스조합 조건 시작 ///////////////////////// var i = 0; var bet = null; var pt = /615|5607|6041|1429|1312|2533|2318/; var pt = /615|5607|6041|1429|1312|2533|2318|2533|2316|10241|10242|10243|10244/; if (pt.test(l_idx) && betting_list.length >= 1) { var selected_same_game = false; for (i = 0; i < betting_list.length; i++) { bet = betting_list[i]; if (bet.game_idx == id) { selected_same_game = true; } } if (!selected_same_game && betting_list.length >= 1 && (obj.className == 'default' || obj.className == 'over')) { //alert("사다리 조합은 1개까지만 가능합니다."); //return false; } } //console.log("id:"+id+"/ pos:"+pos+"/ divi:"+divi+"/ h_nm:"+h_nm+"/ a_nm:"+a_nm+"/ h_div:"+h_div+"/ t_div:"+t_div+"/ a_div:"+a_div+"/ g_datetime:"+g_datetime+"/ j_idx:"+j_idx+"/ l_idx:"+l_idx); if(divi<1){ selectGameInit(id, pos); //console.log("divi:"+divi); return false; } if(divi>30){ alert("[INFO] 30이상의 배당은 선택하실수없습니다."); selectGameInit(id, pos); return false; } var pt = "99999"; var bet_limit_cnt = 0; var bet_cnt = 0; var bet_bonus_cnt = 0; for (i = 0; i < betting_list.length; i++) { bet = betting_list[i]; if (bet.league_idx==pt){ if(id!=bet.game_idx){ ++bet_bonus_cnt; } }else{ ++bet_cnt; //console.log("bet.league_idx++:"+bet.league_idx); //console.log("bet_cnt++:"+bet_cnt); } } if(l_idx==pt){ if(bet_bonus_cnt>0){ alert("[INFO] 보너스폴더는 1개 이상 선택하실수없습니다."); selectGameInit(id, pos); return false; } if(dividend>1.3){ }else{ alert("[INFO] 보너스폴더는 1.3배당 미만은 선택하실수없습니다."); selectGameInit(id, pos); return false; } for (i = 0; i < betting_list.length; i++) { bet = betting_list[i]; console.log("Found bonus : bet.league_idx:"+bet.league_idx); if(bet.league_idx!=pt){ if(bet.dividend>=1.3){ }else{ alert("[INFO] 1.3배당 미만은 보너스배당과 조합불가"); selectGameInit(id, pos); return false; } } } const regex = /[^0-9]/g; const result = h_nm.replace(regex, ""); const bet_limit_cnt = parseInt(result); console.log("Found bonus : bet_limit_cnt:"+bet_limit_cnt); if(bet_limit_cnt>0 && betting_list.length < bet_limit_cnt){ alert("[INFO] 해당 보너스 배당은 "+bet_limit_cnt+"폴더이상이어야 조합할 수 있습니다."); selectGameInit(id, pos); return false; } } if( j_idx == "12" || j_idx == "40" ){ var selected_same_game = false; for (i = 0; i < betting_list.length; i++) { bet = betting_list[i]; bet = betting_list.shift(); drawBetSlip(); selectGameInit(bet.game_idx, bet.select_idx); if (bet.game_idx == id) { selected_same_game = true; } } if (!selected_same_game && betting_list.length >= 1){ //alert("미니게임은 조합이 불가능합니다."); //selectGameInit(id, pos); //return false; } } var is_betting = $('#betting_'+id).val(); if(is_betting!=0){ alert("[INFO] 현재 베팅이 금지되어있습니다."); selectGameInit(id, select_idx); return false; } //console.log("g_type:"+g_type+" / g_choice:"+g_choice); var pt = /99999/; /* for (i = 0; i < betting_list.length; i++) { bet = betting_list[i]; if(id!=bet.game_idx){ if(pt.test(bet.league_idx)==true && (g_choice == "HandiWin" || g_choice == "HandiLose")) { alert("[INFO] 보너스 배당은 핸디캡과 크로스 조합할 수 없습니다."); return false; } if(pt.test(bet.league_idx)==true && (g_choice == "Under" || g_choice == "Over")) { alert("[INFO] 보너스 배당은 언오버와 크로스 조합할 수 없습니다."); return false; } } if (pt.test(l_idx)==true && (bet.game_choice == "Under" || bet.game_choice == "Over") ) { alert("[INFO] 보너스 배당은 언오버와 크로스 조합할 수 없습니다."); return false; } if (pt.test(l_idx)==true && (bet.game_choice == "HandiWin" || bet.game_choice == "HandiLose") ) { alert("[INFO] 보너스 배당은 핸디캡과 크로스 조합할 수 없습니다."); return false; } } */ for (i = 0; i < betting_list.length; i++) { bet = betting_list[i]; // //조합베팅조건 : 같은경기 끼리는 아예 조합이 안되게 함. if (cross_same_game == 0 && bet.game_idx != id && bet.home_nm.trim() == h_nm.trim() && bet.away_nm.trim() == a_nm.trim() && bet.game_datetime == g_datetime) { if(j_idx==1){ alert("[INFO] 동일한 경기의 승무패/핸디캡/언더오버는 크로스 조합할 수 없습니다."); selectGameInit(id, pos); return false; } } if (document.getElementById("sch_gtype2").value == "Cross" || document.getElementById("sch_gtype2").value == "WDL" || document.getElementById("sch_gtype1").value == "Special" || document.getElementById("sch_gtype1").value == "Special2") { //alert('1'); //console.log("bet.home_nm.trim :"+ bet.home_nm.trim() ); //console.log("selectedGameNew"+ h_nm.trim() ); if (bet.game_idx != id && bet.home_nm.trim() == h_nm.trim() && bet.away_nm.trim() == a_nm.trim() && bet.game_datetime == g_datetime) { //alert('2/'+cross_handicap_underover+bet.game_choice); if (g_choice == "Win" || g_choice == "Draw" || g_choice == "Lose") { if (cross_odd_handicap == 0 && (bet.game_choice == "HandiWin" || bet.game_choice == "HandiLose")) { alert("[INFO] 동일한 경기의 승무패와 핸디캡은 크로스 조합할 수 없습니다."); selectGameInit(id, pos); return false; } else if (cross_odd_underover == 0 && (bet.game_choice == "Under" || bet.game_choice == "Over")) { alert("[INFO] 동일한 경기의 승무패와 언오버는 크로스 조합할 수 없습니다."); selectGameInit(id, pos); return false; } else if (bet.game_choice == "Win" || bet.game_choice == "Draw" || bet.game_choice == "Lose") { alert("[INFO] 동일한 경기의 승무패와 승무패는 크로스 조합할 수 없습니다."); selectGameInit(id, pos); return false; } } if (g_choice == "Draw") { if (cross_draw_under == 0 && bet.game_choice == "Under") { alert("[INFO] 동일한 경기의 무와 언더는 크로스 조합할 수 없습니다."); selectGameInit(id, pos); return false; } } if (g_choice == "HandiWin" || g_choice == "HandiLose") { if (cross_odd_handicap == 0 && (bet.game_choice == "Win" || bet.game_choice == "Draw" || bet.game_choice == "Lose")) { alert("[INFO] 동일한 경기의 핸디캡과 승무패는 크로스 조합할 수 없습니다."); selectGameInit(id, pos); return false; } if (cross_handicap_underover == 0 && (bet.game_choice == "Under" || bet.game_choice == "Over")) { alert("[INFO] 동일한 경기의 핸디캡과 언오버는 크로스 조합할 수 없습니다."); selectGameInit(id, pos); return false; } if (bet.game_choice == "HandiWin" || bet.game_choice == "HandiLose") { alert("[INFO] 동일한 경기의 핸디캡과 핸디캡은 크로스 조합할 수 없습니다."); selectGameInit(id, pos); return false; } } else if (g_choice == "Under" || g_choice == "Over") { if (cross_odd_underover == 0 && (bet.game_choice == "Win" || bet.game_choice == "Draw" || bet.game_choice == "Lose")) { alert("[INFO] 동일한 경기의 언오버와 승무패는 크로스 조합할 수 없습니다."); selectGameInit(id, pos); return false; } if (bet.game_choice == "Under" || bet.game_choice == "Over") { alert("[INFO] 동일한 경기의 언오버와 언오버는 크로스 조합할 수 없습니다."); selectGameInit(id, pos); return false; } } if (g_choice == "Under") { if (cross_draw_under == 0 && bet.game_choice == "Draw") { alert("[INFO] 동일한 경기의 언더와 무는 크로스 조합할 수 없습니다."); selectGameInit(id, pos); return false; } } if(j_idx=="5" || j_idx=="4"){ if (g_choice == "Win" || g_choice == "Draw" || g_choice == "Lose") { if (bet.game_choice == "HandiWin" || bet.game_choice == "HandiLose") { alert("[INFO] 동일한 경기의 승무패와 핸디캡은 조합할 수 없습니다."); selectGameInit(id, pos); return false; } else if (bet.game_choice == "Under" || bet.game_choice == "Over") { alert("[INFO] 동일한 경기의 승무패와 언오버는 조합할 수 없습니다."); selectGameInit(id, pos); return false; } } if (g_choice == "HandiWin" || g_choice == "HandiLose") { if (bet.game_choice == "Win" || bet.game_choice == "Draw" || bet.game_choice == "Lose") { alert("[INFO] 동일한 경기의 핸디캡과 승무패는 조합할 수 없습니다."); selectGameInit(id, pos); return false; } else if (bet.game_choice == "Under" || bet.game_choice == "Over") { alert("[INFO] 동일한 경기의 핸디캡과 언오버는 조합할 수 없습니다."); selectGameInit(id, pos); return false; } } if (g_choice == "Under" || g_choice == "Over") { if (bet.game_choice == "HandiWin" || bet.game_choice == "HandiLose") { alert("[INFO] 동일한 경기의 언오버와 핸디캡은 조합할 수 없습니다."); selectGameInit(id, pos); return false; }else if (bet.game_choice == "Win" || bet.game_choice == "Draw" || bet.game_choice == "Lose") { alert("[INFO] 동일한 경기의 언오버와 승무패는 조합할 수 없습니다."); selectGameInit(id, pos); return false; } } } } } } var select_btn_name = id+'_'+pos; var is_pre_select_radio_btn = $('#radio_pre_'+select_btn_name).val(); if ( $('#radio'+select_btn_name).val() == true ){ //console.log("true obj.className:"+'#radio_'+id); }else{ //console.log("false obj.className:"+'#radio_'+id); } if (is_pre_select_radio_btn == 'false') { //console.log("is_pre_select_radio_btn:"+is_pre_select_radio_btn); $('#radio_pre_'+select_btn_name).val(true); if(pos==1){ $('#radio_pre_'+id+'_2').val(false); $('#radio_pre_'+id+'_3').val(false); } if(pos==2){ $('#radio_pre_'+id+'_1').val(false); $('#radio_pre_'+id+'_3').val(false); } if(pos==3){ $('#radio_pre_'+id+'_1').val(false); $('#radio_pre_'+id+'_2').val(false); } addBettingSlip(id, pos, divi, h_nm, a_nm, h_nm_dis, a_nm_dis, h_div, t_div, a_div, g_datetime, j_idx, l_idx, g_type, g_choice,'0',''); } else if (is_pre_select_radio_btn == 'true') { //console.log("is_pre_select_radio_btn:"+is_pre_select_radio_btn); $('#radio_pre_'+select_btn_name).val(false); $('#radio'+select_btn_name).prop('checked', false ); delBettingSlip(id); } } function selectedGame(obj, id, pos, divi, h_nm, a_nm, h_div, t_div, a_div, g_datetime, j_idx, l_idx, g_type, g_choice) { var ele = null; var i = 0; var bet = null; var pt = /615|5607|6041|1429|1312|2533|2318|2533|2316|10241|10242|10243|10244|10265|10266|10800/; var pt = /615|5607|6041|1429|1312|2533|2318|2533|2316|10241|10242|10243|10244|10265|10266|10800|10829|10828|10482|10483|10484|10082|10904/; var pt = /615|5607|6041|1429|1312|2533|2318|2533|2316|10241|10242|10243|10244|10265|10266|10800|10829|10828|10482|10483|10484|10082|10904|10942|11739|11738/; var pt = /319|2808|615|5607|6041|1429|1312|2533|2318|2533|2316|10241|10242|10243|10244|10265|10266|10800|10829|10828|10482|10483|10484|10082|10904|10942|11739|11738/; for (i = 0; i < betting_list.length; i++) { bet = betting_list[i]; //alert('bet game_idx='+bet.game_idx); //alert(bet.game_idx+"="+id); //alert('pt.test = '+pt.test(bet.league_idx) ); if(id!=bet.game_idx){ if(pt.test(bet.league_idx)==true && betting_list.length >= 1 && (obj.className == 'default' || obj.className == 'over')){ alert("현재 조합불가능한 게임이 카트에 있습니다."); return false; } } } if(divi==1){ console.log("divi:"+divi); return false; } var i = 0; if (pt.test(l_idx) && betting_list.length >= 1) { var selected_same_game = false; for (i = 0; i < betting_list.length; i++) { bet = betting_list[i]; if (bet.game_idx == id) { selected_same_game = true; } } //alert(selected_same_game); if (!selected_same_game && betting_list.length >= 1 && (obj.className == 'default' || obj.className == 'over')) { //alert( betting_list.length); //alert( obj.className); alert("해당 게임은 조합이 불가능합니다."); return false; } } //if (betting_list.length >= 10 && obj.className!='selected') { // alert("한번 베팅에 조합은 10개까지만 가능합니다."); // return; //} ////////////////////// 승무패 크로스조합 조건 시작 ///////////////////////// var i = 0; var bet = null; for (i = 0; i < betting_list.length; i++) { bet = betting_list[i]; //가상축구 동일팀 조합 if (document.getElementById("sch_gtype2").value == "Virtual" || document.getElementById("sch_gtype2").value == "virtualsoccer") { if (bet.game_idx != id && bet.home_nm.trim() != h_nm.trim() && bet.away_nm.trim() != a_nm.trim()) { alert("[INFO] 가상축구는 동일팀만 조합 가능합니다."); return false; } } // //조합베팅조건 : 같은경기 끼리는 아예 조합이 안되게 함. // if (bet.game_idx != id && bet.home_nm.trim() == h_nm.trim() && bet.away_nm.trim() == a_nm.trim() && bet.game_datetime == g_datetime) { // alert("[INFO] 동일한 경기의 승무패/핸디캡/언더오버는 크로스 조합할 수 없습니다."); // return false; // } if (document.getElementById("sch_gtype2").value == "WDL" || document.getElementById("sch_gtype2").value == "Handicap_UnderOver") { // for(i=0;i= 10 && obj.className!='selected') { // alert("한번 베팅에 조합은 10개까지만 가능합니다."); // return; //} ////////////////////// 승무패 크로스조합 조건 시작 ///////////////////////// var i = 0; var bet = null; if(divi==1){ console.log("divi:"+divi); return false; } var pt = /99999/; for (i = 0; i < betting_list.length; i++) { bet = betting_list[i]; if(id!=bet.game_idx){ if(pt.test(bet.league_idx)==true && (g_choice == "HandiWin" || g_choice == "HandiLose")) { alert("[INFO] 보너스 배당은 핸디캡과 크로스 조합할 수 없습니다."); return false; } if(pt.test(bet.league_idx)==true && (g_choice == "Under" || g_choice == "Over")) { alert("[INFO] 보너스 배당은 언오버와 크로스 조합할 수 없습니다."); return false; } } if (pt.test(l_idx)==true && (bet.game_choice == "Under" || bet.game_choice == "Over") ) { alert("[INFO] 보너스 배당은 언오버와 크로스 조합할 수 없습니다."); return false; } if (pt.test(l_idx)==true && (bet.game_choice == "HandiWin" || bet.game_choice == "HandiLose") ) { alert("[INFO] 보너스 배당은 핸디캡과 크로스 조합할 수 없습니다."); return false; } } for (i = 0; i < betting_list.length; i++) { bet = betting_list[i]; // //조합베팅조건 : 같은경기 끼리는 아예 조합이 안되게 함. if (cross_same_game == 0 && bet.game_idx != id && bet.home_nm.trim() == h_nm.trim() && bet.away_nm.trim() == a_nm.trim() && bet.game_datetime == g_datetime) { if(j_idx==1){ alert("[INFO] 동일한 경기의 승무패/핸디캡/언더오버는 크로스 조합할 수 없습니다."); return false; } } if (document.getElementById("sch_gtype1").value == "Cross") { if (bet.game_idx != id && bet.home_nm.trim() == h_nm.trim() && bet.away_nm.trim() == a_nm.trim() && bet.game_datetime == g_datetime) { if(bet.rule_bygame =="1" && rule_bygame =="1" ){ alert("[INFO] 동일한 경기의 득점&무득점 경기는 언오버와 크로스 조합할 수 없습니다."); return false; } if (g_choice == "Win" || g_choice == "Draw" || g_choice == "Lose") { if (cross_odd_handicap == 0 && (bet.game_choice == "HandiWin" || bet.game_choice == "HandiLose")) { alert("[INFO] 동일한 경기의 승무패와 핸디캡은 크로스 조합할 수 없습니다."); return false; } else if (cross_odd_underover == 0 && (bet.game_choice == "Under" || bet.game_choice == "Over")) { alert("[INFO] 동일한 경기의 승무패와 언오버는 크로스 조합할 수 없습니다."); return false; } } if (g_choice == "Draw") { if (cross_draw_under == 0 && bet.game_choice == "Under") { alert("[INFO] 동일한 경기의 무와 언더는 크로스 조합할 수 없습니다."); return false; } } if (g_choice == "HandiWin" || g_choice == "HandiLose") { if (cross_odd_handicap == 0 && (bet.game_choice == "Win" || bet.game_choice == "Draw" || bet.game_choice == "Lose")) { alert("[INFO] 동일한 경기의 핸디캡과 승무패는 크로스 조합할 수 없습니다."); return false; } if (cross_handicap_underover == 0 && (bet.game_choice == "Under" || bet.game_choice == "Over")) { alert("[INFO] 동일한 경기의 핸디캡과 언오버는 크로스 조합할 수 없습니다."); return false; } } else if (g_choice == "Under" || g_choice == "Over") { if (cross_odd_underover == 0 && (bet.game_choice == "Win" || bet.game_choice == "Draw" || bet.game_choice == "Lose")) { alert("[INFO] 동일한 경기의 언오버와 승무패는 크로스 조합할 수 없습니다."); return false; } } if (g_choice == "Under") { if (cross_draw_under == 0 && bet.game_choice == "Draw") { alert("[INFO] 동일한 경기의 언더와 무는 크로스 조합할 수 없습니다."); return false; } } } } // ///// 스페셜 크로스조합 조건 끝 ///// // if (document.getElementById("sch_gtype").value == "OddEven") { // if (bet.game_idx != id && bet.home_nm.trim() == h_nm.trim() && bet.away_nm.trim() == a_nm.trim() && bet.game_datetime == g_datetime) { // if ( (g_choice == "Draw" && bet.game_choice == "Under") || (g_choice == "Under" && bet.game_choice == "Draw") ) { // alert("[INFO] 동일한 경기의 무와 언더조합은 불가능합니다."); // return false; // } // } // } } ////////////////////// 승무패 크로스조합 조건 끝 /////////////////////////// if (obj.className == 'default' || obj.className == 'over') { //alert("asd"); obj.className = "selected"; if (pos != 1) { ele = document.getElementById(id + "_1"); if (ele && ele != null) { if (ele.className == "selected") { ele.className = "default"; } } } ele = null; if (pos != 3) { ele = document.getElementById(id + "_3"); if (ele && ele != null) { if (ele.className == "selected") ele.className = "default"; } } ele = null; if (pos != 2) { ele = document.getElementById(id + "_2"); if (ele && ele != null) { if (ele.className == "selected") ele.className = "default"; } } addBettingSlip(id, pos, divi, h_nm, a_nm, h_div, t_div, a_div, g_datetime, j_idx, l_idx, g_type, g_choice , rule_bygame,''); } else if (obj.className == 'selected' || obj.className == 'selected_over') { obj.className = "default"; delBettingSlip(id); } } var betting_list = new Array(); function betting(g_idx, select_idx, home_nm, away_nm, home_nm_dis, away_nm_dis, dividend, h_div, t_div, a_div, g_datetime, j_idx, l_idx, g_type, g_choice, rule_bygame, rate_change) { this.select_idx = select_idx; this.game_idx = g_idx; this.home_nm = home_nm; this.away_nm = away_nm; this.home_nm_dis = home_nm_dis; this.away_nm_dis = away_nm_dis; this.dividend = dividend; this.home_div = h_div; this.tie_div = t_div; this.away_div = a_div; this.game_datetime = g_datetime; this.jongmok_idx = j_idx; this.league_idx = l_idx; this.game_type = g_type; this.game_choice = g_choice; this.rule_bygame = rule_bygame; this.rate_change = rate_change; } function drawBetSlip() { var bs = document.getElementById("betting_result"); var bet = null; var iHtml = "
    \n"; var prefix = ""; var lborder1 = ""; var lborder2 = ""; var rborder1 = ""; var rborder2 = ""; if (betting_list.length > 0) { for (i = 0; i < betting_list.length; i++) { bet = betting_list[i]; switch (bet.game_type) { case "Full" : prefix = "승무패"; break; case "FullHandicap" : prefix = "언/핸"; break; case "OddEven" : prefix = "스페셜"; break; } ; lborder1 = ''; lborder2 = ''; rborder1 = ''; rborder2 = ''; var game_select_bar = ''; switch (bet.game_choice) { case "Win" : game_choice = "승"; lborder1 = ''; lborder2 = ''; game_select_bar = 1; game_type = "승무패"; break; case "Draw" : game_choice = "무"; game_select_bar = 2; game_type = "승무패"; break; case "Lose" : game_choice = "패"; rborder1 = ''; rborder2 = ''; game_select_bar = 3; game_type = "승무패"; break; case "HandiWin" : game_choice = "핸디승"; lborder1 = ''; lborder2 = ''; game_select_bar = 1; game_type = "핸디캡"; break; case "HandiLose" : game_choice = "핸디패"; rborder1 = ''; rborder2 = ''; game_select_bar = 3; game_type = "핸디캡"; break; case "Under" : game_choice = "언더"; lborder1 = ''; lborder2 = ''; game_select_bar = 1; game_type = "언오바"; break; case "Over" : game_choice = "오버"; rborder1 = ''; rborder2 = ''; game_select_bar = 3; game_type = "언오바"; break; case "Odd" : game_choice = "홀"; lborder1 = ''; lborder2 = ''; game_select_bar = 1; break; case "Even" : game_choice = "짝"; rborder1 = ''; rborder2 = ''; game_select_bar = 3; break; case "home" : game_choice = "홈승"; lborder1 = ''; lborder2 = ''; game_select_bar = 1; break; case "away" : game_choice = "어웨이승"; rborder1 = ''; rborder2 = ''; game_select_bar = 3; break; } ; var rate_flag1 = ""; var rate_flag2 = ""; var rate_flag3 = ""; var team_flag1 = ""; if(game_select_bar=="1"){ var team_flag1 = bet.home_nm_dis; }else if(game_select_bar=="2"){ var team_flag1 = bet.home_nm_dis+"-무"; }else if(game_select_bar=="3"){ var team_flag1 = bet.away_nm_dis; } if(bet.rate_change>0){ if(game_select_bar=="1"){ var rate_flag1 = "(배당변동)"; var team_flag1 = bet.home_nm_dis; }else if(game_select_bar=="2"){ var rate_flag1 = "(무-배당변동)"; }else if(game_select_bar=="3"){ var rate_flag3 = "(배당변동)"; var team_flag1 = bet.away_nm_dis; } } switch (bet.game_choice) { case "Under" : game_choice = "언더"; var team_flag1 = bet.away_nm_dis; break; case "Over" : game_choice = "오버"; var team_flag1 = bet.home_nm_dis; break; } let today = new Date(bet.game_datetime); //let dateFormat1 = today.getFullYear() + '-' + (today.getMonth()+1) + '-' + today.getDate() + ' ' + today.getHours() + ':' + today.getMinutes(); let dateFormat1 = today.getFullYear() + '-' + ( (today.getMonth()+1) < 9 ? "0" + (today.getMonth()+1) : (today.getMonth()+1) )+ '-' + ( (today.getDate()) < 9 ? "0" + (today.getDate()) : (today.getDate()) ) +' '+( (today.getHours()) < 9 ? "0" + (today.getHours()) : (today.getHours()) )+':'+( (today.getMinutes()) < 9 ? "0" + (today.getMinutes()) : (today.getMinutes()) ); var league_name = $('#league_name_'+bet.league_idx).val() //console.log('drawBetSlip() : league_name: '+league_name ); //console.log('drawBetSlip() : bet.game_datetime: '+bet.game_datetime ); //console.log('drawBetSlip() : bet.game_choice: '+bet.game_choice+'bet.rate_change: '+bet.rate_change+" - "+'game_select_bar: '+game_select_bar+" - "+'rate_flag1: '+rate_flag1); //console.log('drawBetSlip() : bet.home_nm: '+bet.home_nm+" - "+'bet.home_nm_dis: '+bet.home_nm_dis); //console.log('drawBetSlip() : bet.away_nm: '+bet.away_nm+" - "+'bet.away_nm_dis: '+bet.away_nm_dis); //console.log('drawBetSlip() : league_name: '+league_name); //console.log('drawBetSlip() : team_flag1: '+team_flag1); iHtml += "
  • "; iHtml += "
    "; iHtml += "
    "; iHtml += "
    "; iHtml += " "+ dateFormat1 +""; iHtml += " "+ league_name +""; iHtml += "
    "; iHtml += "
    "; iHtml += "
    "; iHtml += "
    "; iHtml += "
    "; iHtml += "
    배팅타입 : "+game_type+"
    "; iHtml += "
    배팅 : "+team_flag1+ rate_flag1 +"
    "; iHtml += "
    배당 : "+Number(bet.dividend).toFixed(2)+" ["+game_choice+"]
    "; iHtml += "
    "; iHtml += "
    "; iHtml += "
    "; iHtml += "
    "; iHtml += "
    "; iHtml += " 베팅내역 삭제"; iHtml += "
  • "; } iHtml += '
\n'; } else { iHtml = ''; } bs.innerHTML = iHtml; } function fixed(str, no) { var ret = str; var dot = str.indexOf("."); if (dot > 0) { ret = str.substring(0, no + dot + 1); } return ret; } function calculrate() { var i = 0; var odds = 0.0; var winMoney = 0; var bet = null; var ele = document.getElementById("BettingMoney"); var str = ele.value; var userMoney = document.getElementById("UserQuotaMoneyOrg").value; //alert(userMoney); if (str == null || str.length == 0) str = "0"; str = unComma_int(str); var betMoney = parseInt(str); //alert("3333333"); for (i = 0; i < betting_list.length; i++) { bet = betting_list[i]; if (i == 0) odds = bet.dividend; else odds *= bet.dividend; } //베팅갯수가 하나이상이면 배당율 계산. 하나면 그냥 원래 한개것으로 적용. if (betting_list.length > 1) odds = (Math.floor(odds * 100) / 100); winMoney = Math.floor(betMoney * odds); str = "" + odds; var betting_total_money = betting_list.length*betMoney; if(betting_total_money>userMoney){ var betting_msg = ""+betting_list.length+"건"; }else{ var betting_msg = ""+betting_list.length+"건"; } if( $('#BettingQuota').length > 0 ){ document.getElementById("BettingQuota").innerHTML = "" + fixed(str, 2);//odds.toFixed(2); } if( $('#BettingQuotaMoney').length > 0 ){ document.getElementById("BettingQuotaMoney").innerHTML = Comma_int("" + winMoney); } if( $('#bet_cnt').length > 0 ){ document.getElementById("bet_cnt").innerHTML = betting_msg; //베팅갯수 //document.getElementById("UserQuotaMoney").innerHTML = Comma_int( userMoney- (betting_list.length*betMoney )); } dividend = odds; win_money = winMoney; return winMoney; } function changeBetMoney() { calculrate(); } function addBettingSlip(g_id, pos, divi, h_nm, a_nm, h_nm_dis, a_nm_dis, h_div, t_div, a_div, g_datetime, j_idx, l_idx, g_type, g_choice, rule_bygame, rate_change) { var i = 0; var bet = null; var ck = 0; //if(betting_list && betting_list!=null && betting_list.length>0){ for (i = 0; i < betting_list.length; i++) { bet = betting_list.shift(); if (bet.game_idx == g_id) { if (bet.select_idx != pos) { bet.dividend = divi; bet.select_idx = pos; bet.game_choice = g_choice; bet.rate_change = rate_change; ck++; betting_list.push(bet); } } else { betting_list.push(bet); } } //} if (ck == 0) { bet = new betting(g_id, pos, h_nm, a_nm, h_nm_dis, a_nm_dis, divi, h_div, t_div, a_div, g_datetime, j_idx, l_idx, g_type, g_choice, rule_bygame, rate_change); betting_list.push(bet); } drawBetSlip(); calculrate(); saveCartCookie(); } function delBettingSlip(g_id) { var i = 0; var bet = null; var g = null; var l = betting_list.length; for (i = 0; i < l; i++) { bet = betting_list.shift(); if (bet.game_idx != g_id) { betting_list.push(bet); i--; l--; } else { var select_btn_name = bet.game_idx+'_'+bet.select_idx; if( $('#radio_pre_'+select_btn_name).length > 0 ){ $('#radio_pre_'+select_btn_name).val(false); $('#radio'+select_btn_name).prop('checked', false ); } } } drawBetSlip(); calculrate(); saveCartCookie(); } function CancelBetting(){ document.getElementById("bwaiting").value = '0'; emptyBetslip(); document.getElementById("div_betting").innerHTML = '배팅하기'; } function emptyBetslip() { var i = 0; var bet = null; var g = null; var l = betting_list.length; var min_bet_money = $('#f_min_bet_money').val(); var s_min_bet_money = Comma_int($('#f_min_bet_money').val()); var max_win_money = $('#f_max_win_money').val(); var s_max_win_money = Comma_int($('#f_max_win_money').val()); var max_bet_money = $('#f_max_betting_money').val(); var s_max_bet_money = Comma_int($('#f_max_betting_money').val()); var max_win_money_special = $('#f_max_win_money_special').val(); var s_max_win_money_special = Comma_int($('#f_max_win_money_special').val()); var max_bet_money_special = $('#f_min_bet_money_special').val(); var s_max_bet_money_special = Comma_int($('#f_min_bet_money_special').val()); for (i = 0; i < l; i++) { bet = betting_list.shift(); var select_btn_name = bet.game_idx+'_'+bet.select_idx; if( $('#radio_pre_'+select_btn_name).length > 0 ){ $('#radio_pre_'+select_btn_name).val(false); $('#radio'+select_btn_name).prop('checked', false ); } } drawBetSlip(); calculrate(); //document.getElementById("BettingMoney").value = s_min_bet_money; document.getElementById("BettingMoney").value = "0"; SetCookie("carthead", "0"); } function applyMax() { var est_money = max_win_money / dividend; est_money = Math.floor(est_money); var betForm = document.formBetting; betForm.BettingMoney.value = Comma_int("" + est_money); calculrate(); } function saveCartCookie() { var carthead; carthead = betting_list.length + "," + document.getElementById("sch_gtype1").value + "," + unComma_int(document.getElementById("BettingMoney").value) + "," + unComma_int(document.getElementById("BettingQuota").innerHTML) + "," + unComma_int(document.getElementById("BettingQuotaMoney").innerHTML); //alert(carthead); SetCookie("carthead", carthead); var i = 0; var bet = null; var cartbody; for (i = 0; i < betting_list.length; i++) { bet = betting_list[i]; cartbody = bet.game_idx + "," + bet.select_idx + "," + bet.home_nm + "," + bet.away_nm + "," + bet.dividend + "," + bet.home_div + "," + bet.tie_div + "," + bet.away_div + "," + bet.game_datetime + "," + bet.jongmok_idx + "," + bet.league_idx + "," + bet.game_type + "," + bet.game_choice; SetCookie("cartbody" + i, cartbody); } } function loadCartCookie() { var bet = null; var cartinfo; var cartbody = new Array(); var carthead = new Array(); cartinfo = GetCookie("carthead"); //alert(cartinfo); carthead = cartinfo.split(','); console.log("==============="); if(document.getElementById("sch_gtype1").value=="Cross" || document.getElementById("sch_gtype1").value=="Special2"){ var i = 0; var selectObj = null; for (i = 0; i < carthead[0]; i++) { cartinfo = GetCookie("cartbody" + i); cartbody = cartinfo.split(','); selectObj = document.getElementById(cartbody[0] + "_" + cartbody[1]); selectObj = document.getElementById(cartbody[0] + "_" + cartbody[1]); console.log(i+"check / cartbody[0]: "+cartbody[0] + "_" + cartbody[1]+"/"+selectObj.className); if (selectObj){ var duplex_check =''; for (ii = 0; ii < betting_list.length; ii++) { bet = betting_list[ii]; if(bet.game_idx==cartbody[0]){ var duplex_check = true; } console.log(ii+" bet.game_idx : "+bet.game_idx + " / cartbody[0]: "+cartbody[0] + "_" + cartbody[1]+"/"+selectObj.className); if(selectObj.className!="selected"){ selectObj.className = "selected"; } } if(duplex_check==''){ selectObj.className = "selected"; //bet = new betting(g_id,pos,h_nm,a_nm,divi,h_div,t_div,a_div,g_datetime,j_idx,l_idx,g_type,g_choice); bet = new betting(cartbody[0], cartbody[1], cartbody[2], cartbody[3], cartbody[4], cartbody[5], cartbody[6], cartbody[7], cartbody[8], cartbody[9], cartbody[10], cartbody[11], cartbody[12], ''); betting_list.push(bet); } }else{ //console.log(i+"no obj / cartbody[0]: "+cartbody[0] + "_" + cartbody[1]+"/"); } } } console.log("==============="); drawBetSlip(); calculrate(); } var my_money = 0; var win_money = 0; var dividend = 0.0; var bBetting = false; var bet_money = 0; function applyBetting() { //$("#div_betting").hide("slow"); var min_bet_money = $('#f_min_bet_money').val(); var s_min_bet_money = Comma_int($('#f_min_bet_money').val()); var max_win_money = $('#f_max_win_money').val(); var s_max_win_money = Comma_int($('#f_max_win_money').val()); var max_bet_money = $('#f_max_betting_money').val(); var s_max_bet_money = Comma_int($('#f_max_betting_money').val()); var max_win_money_special = $('#f_max_win_money_special').val(); var s_max_win_money_special = Comma_int($('#f_max_win_money_special').val()); var max_bet_money_special = $('#f_min_bet_money_special').val(); var s_max_bet_money_special = Comma_int($('#f_min_bet_money_special').val()); //console.log("max_win_money="+max_win_money); //console.log("max_bet_money="+max_bet_money); if( check_bonus() == false ) return false; if(document.getElementById("bwaiting").value!="0"){ alert("배팅중입니다.잠시만 기다려주세요"); return false; } var betForm = document.formBetting; if(document.getElementById("betting_max_bet_count")!=null){ betting_max_bet_count = parseInt(document.getElementById("betting_max_bet_count").value); if(betting_list.length>betting_max_bet_count){ alert('규정에 어긋난 배팅입니다.(최대 '+betting_max_bet_count+'폴더까지만 배팅할수있습니다.)'); return false; } } if(document.getElementById("betting_max_dividend")!=null) { betting_max_dividend = parseInt(document.getElementById("betting_max_dividend").value); if(betting_max_dividend 0) { if (calculrate() > max_win_money) { alert("적중금 상한 '" + s_max_win_money + " 원'을 초과 하였습니다."); return; } if (bet_money < min_bet_money) { alert("베팅금액이 최소베팅금액 " + s_min_bet_money + "원 미만입니다."); return; } if (bet_money > max_bet_money) { alert("베팅금액이 최대베팅금액 '" + s_max_bet_money + "원'을 초과 하였습니다."); return; } } //var game_max_rate = 100; //if (dividend >game_max_rate) { // alert("최대 베팅가능한 배당은 " + game_max_rate + "배당 입니다."); // return; //} //if(bet_money>my_money){ // alert("베팅금액이 보유금액을 초과합니다."); // return; //} console.log("betting_list.length : "+betting_list.length); if (betting_list.length == 1) { if (document.getElementById("danfolder").value == "Y") { //alert(max_bet_money_dan+"/"+max_win_money_dan); //alert(bet_money+"/"+calculrate()); if (document.getElementById("sch_gtype1").value == "Cross"){ if(max_bet_money_dan>5000){ if (bet_money > max_bet_money_dan) { alert("단폴더 베팅에서의 베팅금액이 최대베팅금액 '" + s_max_bet_money_dan + "원'을 초과 하였습니다."); return; } } if(max_win_money_dan>5000){ if (calculrate() > max_win_money_dan) { alert("단폴더 베팅에서의 당첨금액이 최대당첨금액 '" + s_max_win_money_dan + "원'을 초과 하였습니다."); return; } } }else{ if (calculrate() > max_win_money) { alert("적중금 상한 '" + s_max_win_money + " 원'을 초과 하였습니다."); return; } if (bet_money < min_bet_money) { alert("베팅금액이 최소베팅금액 " + s_min_bet_money + "원 미만입니다."); return; } if (bet_money > max_bet_money) { alert("베팅금액이 최대베팅금액 '" + s_max_bet_money + "원'을 초과 하였습니다."); return; } } } else { if(is_live!= true){ if (betting_list[0].game_type == "Full" && document.getElementById("member_dan_folder_WDL").value == "N") { alert("승무패 단폴더 베팅을 지원하지 않습니다."); return; } if (betting_list[0].game_type == "FullHandicap" && document.getElementById("member_dan_folder_Handi_UnderOver").value == "N") { alert("핸디캡 단폴더 베팅을 지원하지 않습니다."); return; } if (betting_list[0].game_type == "OddEven" && document.getElementById("member_dan_folder_Special").value == "N") { alert("스페셜 단폴더 베팅을 지원하지 않습니다."); return; } } if(max_bet_money_dan>5000){ if (bet_money > max_bet_money_dan) { alert("단폴더 베팅에서의 베팅금액이 최대베팅금액 '" + s_max_bet_money_dan + "원'을 초과 하였습니다."); return; } } } }else{ console.log("max_win_money : "+max_win_money); if (calculrate() > max_win_money) { alert("적중금 상한 '" + s_max_win_money + " 원'을 초과 하였습니다."); return; } if (bet_money < min_bet_money) { alert("베팅금액이 최소베팅금액 " + s_min_bet_money + "원 미만입니다."); return; } if (bet_money > max_bet_money) { alert("베팅금액이 최대베팅금액 '" + s_max_bet_money + "원'을 초과 하였습니다."); return; } } if (betting_list.length <= 0) { alert("선택된 경기가 없습니다."); return; } if (!confirm("베팅하시겠습니까?\n(베팅 후 베팅내역을 확인하십시오.)")) { return; } $('#div_betting').html('배팅중입니다.잠시만 기다려주세요'); bBetting = true; if (betting_list == null) betting_list = new Array(); //var obj = document.getElementById("layer_form"); //var strHtml = "
"; var i = 0; var j = 0; var bet = null; var obj = null; document.getElementById("game_idx").value = ''; document.getElementById("game_select").value = ''; document.getElementById("home_rate").value = ''; document.getElementById("tie_rate").value = ''; document.getElementById("away_rate").value = ''; document.getElementById("jongmok_idx").value = ''; document.getElementById("league_idx").value = ''; document.getElementById("game_type").value = ''; document.getElementById("game_choice").value = ''; document.getElementById("dividend").value = ''; document.getElementById("bet_money").value = ''; document.getElementById("win_money").value = ''; for (i = 0; i < betting_list.length; i++) { bet = betting_list[i]; obj = document.getElementById("game_idx"); obj.value = obj.value + bet.game_idx + ","; obj = document.getElementById("game_select"); obj.value = obj.value + bet.select_idx + ","; obj = document.getElementById("home_rate"); obj.value = obj.value + bet.home_div + ","; obj = document.getElementById("tie_rate"); obj.value = obj.value + bet.tie_div + ","; obj = document.getElementById("away_rate"); obj.value = obj.value + bet.away_div + ","; obj = document.getElementById("jongmok_idx"); obj.value = obj.value + bet.jongmok_idx + ","; obj = document.getElementById("league_idx"); obj.value = obj.value + bet.league_idx + ","; obj = document.getElementById("game_type"); obj.value = obj.value + bet.game_type + ","; obj = document.getElementById("game_choice"); obj.value = obj.value + bet.game_choice + ","; } document.getElementById("bwaiting").value = "1"; betForm.target='HIddenActionFrame'; betForm.mode.value = "betting"; betForm.action = "/action/betting_action.php"; betForm.bet_money.value = "" + bet_money; betForm.dividend.value = dividend; betForm.win_money.value = win_money; betForm.betting_length.value = betting_list.length; SetCookie("carthead", "0"); betForm.submit(); } //--> //////// 자바스크립트를 이용한 배팅카트 작업 끝 ////////// function BettingCheck(g_id, pos, h_div, t_div, a_div) { var i = 0; var bet = null; var ck = 0; //if(betting_list && betting_list!=null && betting_list.length>0){ for (i = 0; i < betting_list.length; i++) { bet = parent.betting_list[i]; //console.log(i+'bet.select_idx: '+bet.select_idx+" - "+'bet.game_idx: '+bet.game_idx+" - "+'dividend: '+bet.dividend); //console.log(i+'bet.home_div: '+bet.home_div+" - "+'bet.tie_div: '+bet.tie_div+" - "+'away_div: '+bet.away_div); //console.log(i+'bet.home_nm: '+bet.home_nm+" - "+'bet.home_nm_dis: '+bet.home_nm_dis); //console.log(i+'bet.away_nm: '+bet.away_nm+" - "+'bet.away_nm_dis: '+bet.away_nm_dis); if (bet.game_idx == g_id) { if (bet.select_idx == pos) { ck++; } } } return ck; } function addBettingSlip1(g_id, pos, divi, h_div, t_div, a_div) { var i = 0; var bet = null; var ck = 0; //if(betting_list && betting_list!=null && betting_list.length>0){ for (i = 0; i < betting_list.length; i++) { bet = parent.betting_list[i]; console.log(i+'bet.select_idx: '+bet.select_idx+" - "+'bet.game_idx: '+bet.game_idx+" - "+'dividend: '+bet.dividend); console.log(i+'bet.home_div: '+bet.home_div+" - "+'bet.tie_div: '+bet.tie_div+" - "+'away_div: '+bet.away_div); } for (i = 0; i < betting_list.length; i++) { bet = parent.betting_list.shift(); if (bet.game_idx == g_id) { bet.select_idx = pos; bet.home_div = h_div; bet.tie_div = t_div; bet.away_div = a_div; ck++; parent.betting_list.push(bet); }else{ parent.betting_list.push(bet); } //console.log('bet.dividend: '+bet.dividend+" - "+'odds: '+odds+" - "+'g_id: '+g_id+'home_rate: '+bet.home_rate); } for (i = 0; i < parent.betting_list.length; i++) { bet = parent.betting_list[i]; //console.log(i+'bet.select_idx: '+bet.select_idx+" - "+'bet.game_idx: '+bet.game_idx+" - "+'dividend: '+bet.dividend); } drawBetSlip(); calculrate(); } //////// 자바스크립트 쿠키를 이용한 배팅카트 저장 작업 시작 ////////// function getCookieVal(offset) { var endstr = document.cookie.indexOf(";", offset); if (endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); } //GetCookie(name) //name(필수 요소) function GetCookie(name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { //while open var j = i + alen; if (document.cookie.substring(i, j) == arg) return getCookieVal(j); i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } //while close return null; } function SetCookie(name, value) { var argv = SetCookie.arguments; var argc = SetCookie.arguments.length; var expires = (2 < argc) ? argv[2] : null; var path = (3 < argc) ? argv[3] : null; var domain = (4 < argc) ? argv[4] : null; var secure = (5 < argc) ? argv[5] : false; document.cookie = name + "=" + escape(value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : ""); } //////// 자바스크립트 쿠키를 이용한 배팅카트 저장 작업 끝 ////////// function Action_Allin() { var f = document.HiddenActionForm; var user_money = document.getElementById("UserQuotaMoneyOrg"); var betting_money = document.getElementById("BettingMoney"); betting_money.value = Number(user_money.value); calculrate(); betting_money.value = Comma_int(betting_money.value); document.getElementById("AllBetting").value='1'; } function Action_Allin_Init() { var f = document.HiddenActionForm; document.getElementById("AllBetting").value='0'; } function chkPwd1(str){ var reg_pwd = /^.*(?=.{6,20})(?=.*[0-9])(?=.*[a-zA-Z]).*$/; if(!reg_pwd.test(str)){ return false; } return true; } function CleanBetSlip(){ emptyBetslip(); calculrate(); drawBetSlip(); } function mouseOver(obj){ } function mouseOut(obj){ } function selectGameInit(id, pos){ $('#radio'+id+'_'+pos).prop('checked', false ); }