function purchase_product(product_id, cat_id, newwindow, cont_type) { if(typeof(cont_type) == "undefined") cont_type = ""; var url = '/pmang_purchase_product.nwz?ssn=61&product_id='+product_id+'&cat_id='+cat_id+'&cont_type='+cont_type; (newwindow == false ? location.href = url : open_win(url, '_buy', 430, 400)); } function gift_product(product_id, cat_id, newwindow, cont_type) { if(typeof(cont_type) == "undefined") cont_type = ""; var url = '/pmang_gift_product.nwz?ssn=61&product_id='+product_id+'&cat_id='+cat_id+'&cont_type='+cont_type; (newwindow == false ? location.href = url : open_win(url, '_buy', 400, 400)); } function apply_premium(rsrl, cat_id, newwindow) { var url = '/pmang_purchase_premium.nwz?ssn=61&rsrl='+rsrl+'&cat_id='+cat_id; (newwindow == false ? location.href = url : open_win(url, '_buy', 430, 400)); } function reserve_premium(rsrl, fromrsrl, newwindow) { var url = '/premium_reserve.nwz?ssn=61&rsrl='+rsrl+'&fromrsrl='+ fromrsrl; (newwindow == false ? location.href = url : open_win(url, '_buy', 430, 400)); } function detail_product(product_id, cat_id, method, newwindow) { var url = '/pmang_purchase_product.nwz?ssn=61&product_id='+product_id+'&cat_id='+cat_id; open_win(url,'_buy',430,400); } function open_mall_popup(url) { url = "http://" + oDomain.www() + url; window.open(url); } function use_item(url, name, width, height) { open_win( url, name, width, height); } function detail_product_ssn(product_id, cat_id, ssn, method, newwindow) { var url = '/pmang_purchase_product.nwz?ssn='+ssn+'&product_id='+product_id+'&cat_id='+cat_id; open_win(url,'_buy',430,400); } function detail_premium(method, newwindow) { var url = '/premium_top.nwz?ssn=61&method='+method; (newwindow == false ? location.href = url : open_window(url, '_detail', "")); } function cp_detail_charge(method, cpsurl, newwindow) { var url = '/premium_top.nwz?ssn=61&method='+method; (newwindow == false ? location.href = url : open_window(url, '_detail', "")); } function cp_detail_charge(method, cpsurl, newwindow) { var url = '/mall_top.nwz?ssn=61&method='+method+'&cpsurl='+cpsurl; (newwindow == false ? location.href = url : open_window(url, '_detail', "")); } function go_mall(method, cat_id, sort) { if (method == "item") { location.href = "/mall_top.nwz?ssn=61&method="+method; } else if (method == "howchar") { location.href = "/mall_top.nwz?ssn=61&method=char&cat_id="+cat_id+(typeof(sort) != "undefined" ? "&sort="+sort : ""); } else { location.href = "/mall_top.nwz?ssn=61&method="+method+"&cat_id="+cat_id+(typeof(sort) != "undefined" ? "&sort="+sort : ""); } } function go_cmall(method, place) { if (method == "item") { location.href = "/pmang_client_mall_top.nwz?ssn=61&method="+method+"&place="+place; } } function go_premium(ssn, method, cat_id, urlkey) { ssn = (!ssn || ssn == 0 ? "61" : ssn); location.href = "/premium_"+(!urlkey ? "top" : urlkey)+".nwz?ssn="+ssn+"&method="+method+(typeof(cat_id) != "undefined" ? "&cat_id="+cat_id : ""); } function buy_magic_list(ctrl_id, cat_id, newwindow) { var ctrl = document.getElementById(ctrl_id); if(ctrl) purchase_product(ctrl.value, cat_id, newwindow, "MC") } function purchase_select_product(ctrl_name, cat_id, newwindow, cont_type) { var ctrls = document.getElementsByName(ctrl_name); if(ctrls) { var productId = null; for(var i = 0; i < ctrls.length; i++) { var ctrl = ctrls[i]; var ctrlTagName = ctrl.tagName.toUpperCase(); var ctrlType = ctrl.type.toUpperCase(); if(ctrlTagName == 'INPUT' && ctrlType == 'RADIO') { if(ctrl.checked) { productId = ctrl.value; break; } } else if(ctrlTagName == 'SELECT') { productId = ctrl.value; break; } } if(productId) purchase_product(productId, cat_id, newwindow, cont_type) } } function gift_select_product(ctrl_name, cat_id, newwindow, cont_type) { var ctrls = document.getElementsByName(ctrl_name); if(ctrls) { var productId = null; for(var i = 0; i < ctrls.length; i++) { var ctrl = ctrls[i]; var ctrlTagName = ctrl.tagName.toUpperCase(); var ctrlType = ctrl.type.toUpperCase(); if(ctrlTagName == 'INPUT' && ctrlType == 'RADIO') { if(ctrl.checked) { productId = ctrl.value; break; } } else if(ctrlTagName == 'SELECT') { productId = ctrl.value; break; } } if(productId) gift_product(productId, cat_id, newwindow, cont_type) } } // ÇǸÁ ½ºÅ¸ÀÏÀÇ Money StringÀ¸·Î »ý¼ºÇÏ¿© ¹ÝȯÇÑ´Ù. function pmangMakeMoneyStr(money) { var mae = new Array("","¸¸","¾ï","Á¶","°æ"); var r = ""; var r2 = ""; var l,t,k,part,i; if ( money == "" || money == 0 ) return 0; money = money.toString(); if ( money.indexOf('-') > 0 ) //ÁÖ¾îÁø ¸Ó´Ï°¡ À½¼ö¶ó¸é.. { r = "-"; money = money.substr(1); } i = 0; while( ( l = money.length ) > 0 ) { k = l % 4; t = Math.floor((l-1)/4); //¼Ò¼öÁ¡ ÀÌÇÏ´Â ¹ö¸². if ( k == 0 ) k = 4; part = money.substr(0,k); if ( part > 0 ) { r2 += parseFloat(part); r2 += mae[t]; } money = money.substr(k); i++; if ( i == 2) break; } if ( r2.slice( r2.length-4, r2.length) == "000¸¸" ) r2 = r2.substr(0,r2.length-4)+"õ¸¸"; return r.concat(r2); } var rpcUrl = "/global/virtual/pmang/jsonrpc/pmang_basket_server.jsonrpc.nwz"; // Àå¹Ù±¸´Ï °ü·Ã javascript function displayBasketList(ssn, cat_id) { var cnt = $("#basket_count").text(); var basketList = $("#basketList"); var item = ''; item += '
'; item += '
'; item += '
'; item += '»èÁ¦'; item += '
'; item += '
'; if( parseInt(cnt) > 0 ) { item += '
'; item += ''; item += 'Àá½Ã¸¸ ±â´Ù·ÁÁÖ¼¼¿ä.'; item += '
'; } item += '
'; item += '
'; item += '

Àå¹Ù±¸´Ï¿¡ ³ÖÀ¸½Ç ¼ö ÀÖ´Â »óÇ°Àº ÃÖ´ë 30°³ ÀÔ´Ï´Ù.

'; item += '
'; item += '
    '; var buyContents = '
  • ¼±Åð³¼ö : 0°³
  • ' + '
  • Àû¸³¸Ó´Ï : 0
  • ' + '
  • Àüü°¡°Ý : 0¿ø
  • '; item += buyContents; item += '
'; item += '±¸¸ÅÇϱâ'; item += '
'; item += '´Ý±â'; item += ''; item += '
'; item += '
'; cat_id = $("#basket_catid").val(); basketList.show(); basketList.html(item); getBasketList(ssn, cat_id); } function getBasketList(ssn, cat_id) { var data = new Array(); data[0] = ssn; data[1] = cat_id; var service = new rpc.ServiceProxy(rpcUrl, {asynchronous: true, protocol:"JSON-RPC", sanitize: false, methods: ['getBasketList']}); service.getBasketList({params:[data], onSuccess:disp_basketlist, onException:function(errorObj){ }, onComplete:function(obj){ } }); } function basketAlert() { alert("±¸¸ÅÇÒ »óÇ°ÀÌ ¾ø½À´Ï´Ù."); return; } function addBasketList(ssn, product_id, cat_id, price) { var cnt = $("#basket_count").text(); if( parseInt(cnt) >= 30 ) { open_win('/pmang_popup_msg.nwz?msgtype=9&msg=over', '_popup', 400, 340); return; } var data = new Array(); data[0] = ssn; data[1] = product_id; data[2] = cat_id; data[3] = price; var service = new rpc.ServiceProxy(rpcUrl, {asynchronous: true, protocol:"JSON-RPC", sanitize: false, methods: ['addBasketList']}); service.addBasketList({params:[data], onSuccess:disp_basketpop, onException:function(errorObj){ }, onComplete:function(obj){ } }); } function deleteBasketList(ssn, cat_id) { var srlList = new Array(); var srlStr; var i = 0; var cnt = $(".chkbasket:checked").length; if( cnt <= 0 ) { alert("¼±ÅÃµÈ »óÇ°ÀÌ ¾ø½À´Ï´Ù."); return; } $(".chkbasket").each(function(idx) { if( $(this).attr("checked") ) { srlList[i] = $(".basketIdx")[idx].value; i++; } }); srlStr = srlList.join("_"); var data = new Array(); data[0] = ssn; data[1] = cat_id; data[2] = srlStr; var service = new rpc.ServiceProxy(rpcUrl, {asynchronous: true, protocol:"JSON-RPC", sanitize: false, methods: ['deleteBasketList']}); service.deleteBasketList({params:[data], onSuccess:disp_basket_item, onException:function(errorObj){ }, onComplete:function(obj){ } }); } function disp_basketlist(data) { var catId = data["cat_id"]; var msn = data["msn"]; var ssn = data["ssn"]; var list = data["list"]; var ispcb = data["is_pcb"]; try { var basketList = $("#basketItemList"); var item = ""; if( list == null) { basketList.html(item); return; } var cnt = list.length; var totalMoney = 0; var totalCash = 0; var totalCnt = 0; for( var idx=0 ; idx'; if( list[idx]["firstType"] == 'FL') contents += ''; else if( list[idx]["firstType"] == 'FD') contents += ''; else if( list[idx]["firstType"] == 'FC') contents += ''; else if( list[idx]["firstType"] == 'FG') contents += ''; else if( list[idx]["firstType"] == 'FR') contents += ''; contents += ''; if( list[idx]["howproduct"] == "Y" && !ispcb ) contents += '
ÇÏ¿ìPC¹æ Àü¿ëij¸¯ÅÍ
'; contents += ''; contents += ''; contents += ''; contents += ''; contents += ''; contents += ''; contents += ''; if( list[idx]["sale_status"] == 'Y' ) { if( list[idx]["howproduct"] == 'Y' && !ispcb ) contents += '

±¸¸ÅºÒ°¡

'; else contents += '

'+list[idx]["amt"]+'¿ø

'; } else { contents += '

ÆǸÅÁ¾·á

'; } item += contents; item += ''; } basketList.html(item); var unit = (msn == 1) ? '³É' : '°ñµå'; $("#basketMoney").append(unit); var basketAction = 'javascript:basketBuyAction('+catId+', '+ispcb+');'; $("#btnBasketBuy").attr("href", basketAction); change_basket_buylist(); } catch(e) { } } function basketBuyAction(cat_id, isPcbang) { var productList = new Array(); var catList = new Array(); var i = 0; var ishowproduct = false; var isdisp = false; $(".chkbasket").each(function(idx) { if( $(this).attr("checked") ) { if( $(".basketHowProduct")[idx].value == "Y" ) ishowproduct = true; if( $(".basketDisplay")[idx].value == "N" ) isdisp = true; productList[i] = $(".basketProductId")[idx].value; catList[i] = cat_id; i++; } }); if( !isPcbang && ishowproduct ) { open_win('/pmang_popup_msg.nwz?msgtype=9&msg=pcb', '_popup', 400, 340); return; } if( isdisp ) { alert("±¸¸ÅÇÒ ¼ö ¾ø´Â »óÇ°ÀÌ Æ÷ÇԵǾî ÀÖ½À´Ï´Ù."); return; } product_id = productList.join("_"); cat_id = catList.join("_"); purchase_product(product_id, cat_id, true); } function disp_basket_item(data) { var status = data["status"]; var ssn = data["ssn"]; var catid = data["cat_id"]; var cnt = data["cnt"]; if( status == 'SUCCESS' ) { displayBasketList(ssn, catid); $("#basket_count").html(cnt); } else { alert("»èÁ¦¿¡ ½ÇÆÐ ÇÏ¿´½À´Ï´Ù. ´Ù½Ã ½ÃµµÇØ ÁÖ¼¼¿ä"); location.reload(); } } function hidden_basketlist() { $("#basketList").hide(); $("#dispBasket").remove(); } function change_basket_buylist() { var totalCnt; var totalMoney = 0; var totalCash = 0; totalCnt = $(".chkbasket:checked").length; var reward; var cash; $(".chkbasket").each(function(idx) { if( $(this).attr("checked") ) { totalMoney += parseInt($(".basketReward")[idx].value); totalCash += parseInt($(".basketCash")[idx].value); } }); totalMoney = pmangMakeMoneyStr(totalMoney); totalCash = formatNumber(totalCash,3); $("#basketTotCnt").html(totalCnt); $("#basketTotMoney").html(totalMoney); $("#basketTotCash").html(totalCash); } function selectItem(idx) { $(".chkbasket").each( function(i) { if( i == idx ) { if( $(this).attr("checked") ) $(this).removeAttr("checked"); else $(this).attr("checked", "checked"); } }); change_basket_buylist(); } function selectBasketAll() { $(".chkbasket").each(function(idx) { if( $("#chkBasketAll").attr("checked") ) $(this).attr("checked", "checked"); else $(this).removeAttr("checked"); }); change_basket_buylist(); } function disp_basketpop(data) { var status = data["status"]; var cnt = data["changecnt"]; var ssn = data["ssn"]; var cat_id = data["cat_id"]; var msn = data["msn"]; var isticket; try{ isticket = data["isticket"]; }catch(e){}; if( status == 'SUCCESS' ) { $("#basket_count").html(cnt); popBasket(); displayBasketList(ssn, cat_id); if( isticket ) displayBasketEvent(msn); } else if( status == 'OVER' ) { open_win('/pmang_popup_msg.nwz?msgtype=9&msg=over', '_popup', 400, 340); } else if( status == 'OVERLAP' ) { open_win('/pmang_popup_msg.nwz?msgtype=9&msg=overlap', '_popup', 400, 340); } else { alert('Á˼ÛÇÕ´Ï´Ù. ´Ù½Ã ½ÃµµÇØÁÖ¼¼¿ä.'); } } function displayBasketEvent(msn) { var item = ''; var hideAct = "$(\'.pmcart_get\').hide(); return false;"; item += '

100% ´ç÷À̺¥Æ®¿¡
ÀÀ¸ðµÇ¼Ì½À´Ï´Ù!

'; item += '

Áö±Ý ¹Ù·Î ¼±¹°À» ¹Þ¾Æ°¡¼¼¿ä!

'; item += '´Ý±â'; item += '¹Þ±â'; $(".pmcart_get").show(); $(".pmcart_get").append(item); var name = "BASKET_TICKET_" + msn; var value="0"; var ExpDate = new Date(2024, 3, 28, '24', '00', '00'); document.cookie = name + '=' + value + ';domain=pmang.com;path=/;expires=' + ExpDate.toGMTString(); setDenyBasketCookie(msn); pmcart_msg(); } function setDenyBasketCookie(msn) { var name = "BASKET_DENY_" + msn; var value="0"; var ExpDate = new Date(2024, 3, 28, '24', '00', '00'); document.cookie = name + '=' + value + ';domain=pmang.com;path=/;expires=' + ExpDate.toGMTString(); }