if(!pub_shop)var pub_shop=new (function(){var defaulthost="http://"+document.location.hostname;var service=null;var itemdesc=null;var wind_o=null;var request=new Object;var arrChar=new Array;var search_condition=null;var syncObject=new Object;this.isDev=function(){if(service===null)this.init();return service.isdev};this.getCookieInfo=function(){if(service===null)this.init();return service.cookie};this.point_buy=function(){request.type="PB";request.args=arguments;this.doPurchase()};this.point_gift=
function(){request.type="PG";request.args=arguments;this.doPurchase()};this.buy=function(){request.type="B";request.args=arguments;this.doPurchase()};this.gift=function(){request.type="G";request.args=arguments;this.doPurchase()};this.giftTicket=function(){request.type="T";request.args=arguments;this.doPurchase()};this.showdetail=function(){request.type="D";request.args=arguments;this.doPurchase()};this.change=function(saleinfo_id){var url=defaulthost;url+=document.location.pathname;var search=document.location.search.substring(1).split("&");
for(var i=0,n=search.length;i<n;i++)if(search[i].indexOf("saleinfo_id")>=0)url+=(i==0?"?":"&")+"saleinfo_id="+saleinfo_id;else url+=i==0?"?"+search[i]:"&"+search[i];document.location.replace(url)};this.move=function(moveto,saleinfo_id){switch(moveto){case "B":case "PB":service.kr="¾ÆÀÌÅÛ ±¸¸Å";service.josa1="°¡";service.josa2="¸¦";break;case "G":case "PG":service.kr="¾ÆÀÌÅÛ ¼±¹°";service.josa1="ÀÌ";service.josa2="À»";break;case "T":service.kr="»óÇ°±Ç ¼±¹°";service.josa1="ÀÌ";service.josa2="À»";break}if(service.userinfo.usn>
0)location.href=defaulthost+"/gamepub/purchase/purchase.nwz?buytype="+moveto+"&ssn="+request.ssn+"&saleinfo_id="+saleinfo_id;else if(moveto!="D"&&service.userinfo.ch.channel_id>0)this.alert("<br><br>"+service.kr+service.josa2+" À§ÇØ¼­´Â<br><b>Á¦ÈÞ ¼­ºñ½º °¡ÀÔ</b>ÀÌ ÇÊ¿äÇÕ´Ï´Ù.");else location.href=defaulthost+"/gamepub/purchase/purchase.nwz?buytype="+moveto+"&ssn="+request.ssn+"&saleinfo_id="+saleinfo_id};this.doPurchase=function(){request.ssn=request.args[0];request.sid=request.args[1];this.init();try{switch(request.type){case "B":case "PB":service.kr=
"¾ÆÀÌÅÛ ±¸¸Å";service.josa1="°¡";service.josa2="¸¦";break;case "G":case "PG":service.kr="¾ÆÀÌÅÛ ¼±¹°";service.josa1="ÀÌ";service.josa2="À»";break;case "T":service.kr="»óÇ°±Ç ¼±¹°";service.josa1="ÀÌ";service.josa2="À»";break}switch(true){case service.err.no==1:var exts="";for(var i=2,n=request.args.length;i<n;i++)exts+="&arg_"+(i-2)+"="+request.args[i];if(service.userinfo.usn>0)this.open_win(defaulthost+"/gamepub/purchase/purchase.nwz?buytype="+request.type+"&ssn="+request.ssn+"&saleinfo_id="+request.sid+exts,"_buy",430,
600);else if(service.userinfo.ch.channel_id>0&&request.type!="D")if(service.userinfo.ch.islogged==true)this.alert("<br><br>"+service.kr+service.josa2+" À§ÇØ¼­´Â<br><b>Á¦ÈÞ ¼­ºñ½º °¡ÀÔ</b>ÀÌ ÇÊ¿äÇÕ´Ï´Ù.");else this.alert("<br><br>"+service.kr+service.josa2+" À§ÇØ¼­´Â<br><b>·Î±×ÀÎ</b>ÀÌ ÇÊ¿äÇÕ´Ï´Ù.");else this.open_win(defaulthost+"/gamepub/purchase/purchase.nwz?buytype="+request.type+"&ssn="+request.ssn+"&saleinfo_id="+request.sid+exts,"_buy",305,240);break;case service.err.group==8:this.open_win(defaulthost+service.err.msg,"_buy",
440,220);break;default:this.alert(service.err.msg)}}catch(E){if(service!=null&&service.isdev)alert("JS Function : doPurchase :: "+E.message)}};this.callSubmit=function(){if((request.type=="B"||request.type=="PB")&&service.guilditem.status==true){if(this.check_guild_submit())this.purchase_submit()}else if(request.type=="B"||request.type=="PB")this.purchase_submit();else if(this.check_gift_submit())this.purchase_submit()};this.callSubmitCharge=function(act,paymethod){if(request.type=="G"||request.type==
"PG"||request.type=="T")if(!this.check_gift_submit())return;if((request.type=="B"||request.type=="PB")&&service.guilditem.status==true)if(!this.check_guild_submit())return;var objTemp=new Array;objTemp=this.compositExternalParams(objTemp);if(!objTemp["p_err"]){var param=this.requestUserComponent("paymethod",act,paymethod,this.serialize(request),this.serialize(objTemp));if(param&&param.err.no>0)this.purchase_submit_charge(act,param);else this.alert("ÀÏ½ÃÀûÀÎ ¿À·ù·Î °èÁÂ »óÅÂ¸¦<br>Á¶È¸ÇÏÁö ¸øÇß½À´Ï´Ù.<br><br><br>Àá½Ã ÈÄ ´Ù½Ã ½ÃµµÇØÁÖ¼¼¿ä.")}};
this.purchase_submit_charge=function(act,param){param.PMURL=defaulthost+service.strCallBackURL+param.PMURL+"&rdspay=1";this.go_charge(param.params+"&sayurl="+urlencode(param.PMURL))};this.go_charge=function(querystring){document.location.replace(defaulthost+service.strChargeURL+"?"+querystring)};this.check_game_status=function(){try{if(!service.game_status){this.alert("°ÔÀÓ Á¡°Ë Áß¿¡´Â<br>¾ÆÀÌÅÛÀ» "+service.kr+"ÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.");return false}if(request.sellplace!="C"&&typeof AppletSession!="undefined"&&AppletSession.externalmethod("isrunning",
service.clsid,0,0,""))return this.confirm("°ÔÀÓ ½ÇÇà Áß ¾ÆÀÌÅÛÀ» "+service.kr+"ÇÏ½Ç °æ¿ì,<br>ÀÏºÎ ¾ÆÀÌÅÛÀº ÀçÁ¢¼ÓÀ» ÅëÇØ È®ÀÎÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.<br><br><br><font color=#A03333>¾ÆÀÌÅÛÀ» "+service.kr+"ÇÏ½Ã°Ú½À´Ï±î?</font>")}catch(E){this.alert("°ÔÀÓ »óÅÂ¸¦ ¾Ë ¼ö ¾ø½À´Ï´Ù.<br><br>Àá½Ã ÈÄ ´Ù½Ã ½ÃµµÇØÁÖ¼¼¿ä.");return false}return true};this.check_guild_submit=function(){try{var obj=this.getElement("guildid");if(obj==null)return true;if(obj.value==""){this.alert("¾ÆÀÌÅÛÀ» ¹ÞÀ» "+service.guilditem.system_name+"À»(¸¦) ¼±ÅÃÇØÁÖ¼¼¿ä.<br><br><b>"+service.guilditem.system_name+"</b> ¾ÆÀÌÅÛÀº ¾ÆÀÌÅÛÀ» ¹ÞÀ»<b>"+
service.guilditem.system_name+"</b>À»(¸¦)<br><br>ÁöÁ¤ÇØ¾ß ÇÕ´Ï´Ù.");return false}else request.guildid=obj.value}catch(E){this.alert("¿À·ù·Î ÀÎÇØ ´õÀÌ»ó ÁøÇàÇÒ ¼ö ¾ø½À´Ï´Ù.<br><br>Àá½Ã ÈÄ ´Ù½Ã ½ÃµµÇØÁÖ¼¼¿ä.");return false}return this.confirm_guild_target()};this.confirm_guild_target=function(){var arrParam=new Array;arrParam["url"]=defaulthost+"/gamepub/purchase/check_guild.nwz";arrParam["ssn"]=request.ssn;arrParam["guildid"]=request.guildid;arrParam["saleinfo_id"]=request.sid;arrParam["width"]=450;arrParam["height"]=325;arrParam["edge"]=
"sunken";arrParam["center"]="yes";arrParam["gamename"]=service.gamename;if(this.confirm("",arrParam))return true;else{var obj=this.getElement("guildid");obj.value="";obj=this.getElement("guild_name");obj.value="";request.guildid=""}};this.check_gift_submit=function(){try{var targetid=this.getElement("targetid");var charinfo=this.getElement("charinfo");var reward_to=this.getElement("reward_to");var tochar=this.getElement("tochar");var reward_name=this.getElement("reward_name");if(reward_name!=null)reward_name=
reward_name.value;else reward_name="¸®¿öµå";var memo=this.getElement("memo");var objNull=new Array;var result=this.compositExternalParams(objNull);if(result["p_err"]==true)return false;if(tochar.value!=""){var arrParam=new Array;arrParam["ssn"]=request.ssn;arrParam["tochar"]=tochar.value;for(i=0;i<search_condition.cnt;i++){switch(search_condition.list[i].type){case "select-one":case "selectbox":case "hidden":case "text":case "button":arrParam[search_condition.list[i].key]=this.getElement(search_condition.list[i].key).value;
break;case "radio":case "checkbox":arrParam[search_condition.list[i].key]=this.___get_radio_value(search_condition.list[i].key);break;default:arrParam[search_condition.list[i].key]=""}if(search_condition.list[i].restrict==true&&arrParam[search_condition.list[i].key]==""){this.alert(search_condition.list[i].name+"(À»)¸¦ ¼±ÅÃ(ÀÔ·Â)ÇØ ÁÖ¼¼¿ä.");return false}}this.gamepub_char_search(arrParam);try{targetid.value=arrChar[0].pmangid;tochar.value=arrChar[0].gamenick;charinfo.value=arrChar[0].charinfo;var obj=this.getElement("dv_char");
if(obj!=null)obj.style.display="none"}catch(E){targetid.value="";charinfo.value=""}}if(tochar.value==""){this.alert("¼±¹° ¹ÞÀ¸½Ç ºÐÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä.");return false}if(targetid.value==""){this.alert(tochar.value+"´Â Á¸ÀçÇÏÁö ¾Ê´Â Ä³¸¯ÅÍ¸í ÀÔ´Ï´Ù.");return false}request.targetid=targetid.value;request.charinfo=charinfo.value;request.tochar=tochar.value;var val="0";switch(reward_to.type){case "radio":val=this.___get_radio_value("reward_to");if(val==""){this.alert(reward_name+" ¹ÞÀ»»ç¶÷À» ÁöÁ¤ÇØ ÁÖ¼Å¾ß ÇÕ´Ï´Ù.");return false}break;default:val=
reward_to.value}request.reward_to=val;switch(true){case memo.value=="":this.alert("¸Þ¼¼Áö¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.");memo.focus();return false;break;case memo.value.length>200:this.alert("¸Þ¼¼Áö´Â 200ÀÚ ÀÌÇÏ·Î¸¸ º¸³»½Ç ¼ö ÀÖ½À´Ï´Ù.");memo.focus();return false;break}request.memo=memo.value}catch(E){this.alert("¿À·ù·Î ÀÎÇØ ´õÀÌ»ó ÁøÇàÇÒ ¼ö ¾ø½À´Ï´Ù.<br><br>Àá½Ã ÈÄ ´Ù½Ã ½ÃµµÇØÁÖ¼¼¿ä.");return false}return this.confirm_gift_target()};this.confirm_gift_target=function(){var arrParam=new Array;arrParam["url"]=defaulthost+"/gamepub/purchase/check_user.nwz";arrParam["ssn"]=
request.ssn;arrParam["targetid"]=request.targetid;arrParam["saleinfo_id"]=request.sid;arrParam["width"]=450;arrParam["height"]=325;arrParam["edge"]="sunken";arrParam["center"]="yes";arrParam["gamename"]=service.gamename;arrParam["charinfo"]=request.charinfo;if(this.confirm("",arrParam))return true;else{var obj=this.getElement("targetid");obj.value="";obj=this.getElement("tochar");obj.value="";obj=this.getElement("charinfo");obj.value=""}};this.check_lack=function(){return false};this.purchase_submit=
function(){var tmpfoot="";if(!request.bPurchase){try{request.bPurchase=true;var footer=this.getElement("footer");if(footer!=null){tmpfoot=footer.innerHTML;footer.innerHTML="<img src='http://file.pmang.com/images/pmang/gamepub/loading.gif'>"}var objParam=new Array;objParam["ssn"]=request.ssn;objParam["saleinfo_id"]=request.sid;objParam["buytype"]=request.type=="B"||request.type=="PB"?"buy":"gift";objParam["sellplace"]=request.sellplace;objParam["securityKey"]=service.userinfo.security;objParam["encrypt"]=
service.userinfo.encrypt;objParam["chktime"]=service.userinfo.chktime;objParam["usn"]=service.userinfo.usn;objParam["gamecode"]=service.gamecode;objParam["type"]=request.type;if(request.type=="G"||request.type=="PG"||request.type=="T"){objParam["targetid"]=request.targetid;objParam["charinfo"]=request.charinfo;objParam["reward_to"]=request.reward_to;objParam["memo"]=request.memo}if(request.selfclose){objParam["pay_cdl"]=request.pay_cdl;objParam["pay_type"]=request.pay_type}else if(service.paytype!=
"")objParam["pay_type"]=service.paytype;else objParam["pay_type"]="SAYCASH";objParam=this.compositExternalParams(objParam);if(request.dscobj!=null){objParam["dsc_own_id"]=request.dsc_own_id;objParam["dsc_amount"]=request.amount}if(service.guilditem.status==true&&request.guildid!=null)objParam["guildid"]=request.guildid;if(objParam["p_err"]){if(footer!=null)footer.innerHTML=tmpfoot;request.bPurchase=false;return}}catch(Ex1){request.bPurchase=false;if(footer!=null)footer.innerHTML='<a href="#" onclick=\'javascript:pub_shop.closeWnd();\'><img src="http://file.pmang.kr/images/pmang/clan/img/common/btn_p_confirm.gif"></a>';
this.alert("½ºÅ©¸³Æ® ¿À·ù·Î ÀÎÇØ, ÁøÇàÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.");return}try{var msgbox=this.getElement("msgbox");if(this.check_lack()){var objret=new Object;objret.cash=service.userinfo.account.ownsum;objret.err=new Object;objret.err.no=-9;objret.err.msg="º¸À¯ ±Ý¾×ÀÌ ºÎÁ·ÇÕ´Ï´Ù. ÃæÀü ÈÄ ´Ù½Ã ½ÃµµÇØ ÁÖ½Ê½Ã¿ä."}else{var oAjax=new Ajax;var objret=oAjax.sendRequest(defaulthost+service.strPurURL,objParam,"POST",null,"JSON",true)}if(objret.err.no<0)switch(objret.err.no){case -1001:if(this.confirm(objret.err.msg)){resizeTo(305,240);document.location.reload()}break;
default:if(msgbox!=null)msgbox.innerHTML=objret.err.msg;else this.alert(objret.err.msg);if(footer!=null)footer.innerHTML='<a href="#" onclick="'+(request.sellplace=="C"?"javascript:pub_shop.closeClientWnd("+objret.err.no+", '', "+objret.cash+");":"javascript:pub_shop.closeWnd();")+'"><img src="http://file.pmang.kr/images/pmang/clan/img/common/btn_p_confirm.gif"></a>'}else{try{var btnCoupon=this.getElement("btnDISCOUNT_AMOUNT");if(btnCoupon!=null)btnCoupon.style.display="none";var divCoupon=this.getElement("divCoupon");
if(divCoupon!=null)divCoupon.style.display="none";var ulPayment=this.getElement("ulPayment");if(ulPayment!=null)ulPayment.style.display="none";var divGuildSearch=this.getElement("divGuildSearch");if(divGuildSearch!=null)divGuildSearch.style.display="none";var pPromo=this.getElement("pPromo");if(pPromo!=null)pPromo.style.display="none";ulPayment=this.getElement("ulAfterPayment");if(ulPayment!=null){ulPayment.style.display="block";ulPayment.innerHTML=objret.afterbox}if(footer!=null){footer.innerHTML=
'<a href="#" onclick="'+(request.sellplace=="C"?"javascript:pub_shop.closeClientWnd("+objret.err.no+", '', "+objret.cash+");":"javascript:pub_shop.closeWnd();")+'"><img src="http://file.pmang.kr/images/pmang/clan/img/common/btn_p_confirm.gif"></a>';footer.style.display="block"}if(msgbox!=null)msgbox.innerHTML=objret.err.msg;else this.alert(objret.err.msg)}catch(Ex1){}resize_wnd();if(objret.t.use){var buseurl=false;switch(objret.t.msgtype){case "alert":this.alert(objret.t.msg);buseurl=true;break;case "confirm":buseurl=
this.confirm(objret.t.msg);break}if(buseurl)switch(objret.t.urltype){case "url":this.open_win(objret.t.url,"_puse_"+request.sid,objret.t.width,objret.t.height);self.close();break;case "javascript":eval(objret.t.url);break}else if(objret.t.cctype&&objret.t.cctype!="")switch(objret.t.cctype){case "url":this.open_win(objret.t.ccurl,"_puse_"+request.sid,objret.t.ccwidth,objret.t.ccheight);self.close();break;case "javascript":eval(objret.t.ccurl);break;default:self.close()}else self.close()}if(request.selfclose){this.alert("<b>"+
objret.err.msg+"</b>");if(request.sellplace=="C")pub_shop.closeClientWnd(objret.err.no,"",objret.cash);else self.close()}}}catch(Ex){}}};this.request_confirm=function(){var str_PayMethod="";if(service.paytype!="")str_PayMethod=service.paytype;else str_PayMethod=this.___get_radio_value("PayMethod");if(str_PayMethod=="SAYCASH"||str_PayMethod=="")if(typeof request.lagcash!="undefined"&&request.lagcash>0||typeof request.lagcash=="undefined"&&service.userinfo.account.lagcash>0)if(request.dscobj!=null)this.callSubmitCharge(this.getActionStr("pay",
"Discount"),str_PayMethod);else this.callSubmitCharge(this.getActionStr("pay",""),str_PayMethod);else this.callSubmit();else if(str_PayMethod==service.paytype)this.callSubmit();else if(request.dscobj!=null)this.callSubmitCharge(this.getActionStr("pay","NowDiscount"),str_PayMethod);else this.callSubmitCharge(this.getActionStr("pay","Now"),str_PayMethod)};this.compositExternalParams=function(objParam){var iparams=null;var eparams=new Array;switch(request.type){case "B":case "PB":iparams=service.service.buy;
break;case "G":case "PG":iparams=service.service.gift;break;default:eparams["p_err"]=false;return eparams}for(var key in iparams)eparams[key]=iparams[key];var tmp=null;for(var key in eparams){if(typeof objParam[key]=="undefined"){tmp=this.getElement(key);if(tmp!=null)switch(tmp.type){case "select-one":case "hidden":case "text":case "button":objParam[key]=tmp.value;break;case "radio":case "checkbox":objParam[key]=this.___get_radio_value(key);break;default:objParam[key]=""}else objParam[key]=""}if(objParam[key]==
""&&eparams[key]!=""){this.alert("<b>["+eparams[key]+"]</b>¸¦ ÁöÁ¤ÇÏÁö ¾Ê¾Æ,<br>"+service.kr+" ÇÒ ¼ö ¾ø½À´Ï´Ù.<br><br>"+service.kr+service.josa2+" À§ÇØ¼­´Â<br>ÇØ´ç Á¤º¸¸¦ ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù.");eparams["p_err"]=true;return eparams}}objParam["p_err"]=false;return objParam};this.ajax_return=function(obj){try{alert(obj.msg)}catch(E){this.alert(E.message+" : "+this.serialize(obj))}};this.getValueByName=function(name){try{var obj=this.getElementByName(name);if(obj===null)return null;switch(obj[0].type){case "checkbox":case "radio":for(var i=
0,n=obj.length;i<n;i++)if(obj[i].checked==true)return obj[i].value;break;case "select-one":case "hidden":case "text":return obj[0].value;break}}catch(E){alert(E.message)}return null};this.checkOwn=function(saleinfo_id){var obj=this.getElement("fid");if(obj===null){this.alert("½Ã½ºÅÛ ¿À·ù·Î ÀÎÇØ ÁøÇàÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.");return false}if(obj.value.length<=0){this.alert("¹ÞÀ¸½Ç ºÐÀÇ ¾ÆÀÌµð¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.");return false}};this.selFriend=function(){id.value=frndlist.value};this.alert=function(msg,param){if(param==null)param=this.getObjAlert();
var arrParam=new Array;for(var key in param)if(param[key]!=null)arrParam[key]=param[key];arrParam["args"]=param;pub_alert(msg,arrParam)};this.confirm=function(msg,param){if(param==null)param=this.getObjAlert();var arrParam=new Array;for(var key in param)if(param[key]!=null)arrParam[key]=param[key];arrParam["args"]=param;return pub_confirm(msg,arrParam)};this.getObjAlert=function(){if(service===null)this.init();return service.alert};this.serialize=function(obj){if(window.uneval)return window.uneval(obj);
switch(typeof obj){case "object":if(obj===null)return"null";var js=[];if(obj instanceof Array&&obj[obj.length-1]){js.push("[");for(var i=0,n=obj.length;i<n;++i){i&&js.push(", ");js.push(this.serialize(obj[i]))}js.push("]")}else{js.push("{");for(var k in obj){js.length>1&&js.push(", ");js.push(this.serialize(k),": ",this.serialize(obj[k]))}js.push("}")}return js.join("");case "string":return'"'+obj.replace(/\\/g,"////").replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/"/g,'\\"')+'"';case "undefined":return"{}";
default:return String(obj)}};this.pResize=function(nWidth,nHeight){try{if(nWidth&&nHeight){window.resizeTo(nWidth,nHeight);var sw=nWidth-document.body.clientWidth;var sh=nHeight-document.body.clientHeight;if(sw>0||sh>0){window.resizeTo(nWidth+sw,nHeight+sh);document.all.usrid.focus()}}}catch(e){return false}};this.opener_reload=function(handle){};this.closeWnd=function(){self.close()};this.closeClientWnd=function(code,msg,cash){var msg="RESULT="+code+"|RETMSG="+msg+"|CASH="+cash;document.location.replace("http://pmang.send.msg/"+
msg);document.location.replace("http://pmang.window.close")};this.open_win=function(url,name,w,h){try{try{var vleft=(screen.width-w)/2;var vtop=(screen.height-h)/2-150}catch(E1){var vleft=0;var vtop=0}var oWin=window.open(url,name,"status=no,scrollbars=no,resizable=no,width="+w+",height="+h+", top="+vtop+", left="+vleft);oWin.focus();return oWin}catch(E2){if(service.isdev)this.alert("Function : open_win :: "+E2.message)}};this.getElement=function(id){var obj=document.getElementById(id);if(typeof obj==
"object"&&obj!=null)return obj;else null};this.getElementByName=function(name){var obj=document.getElementsByName(name);if(typeof obj=="object"&&obj!=null)return obj;else null};this.replaceItemImage=function(html){try{var obj=this.getElement("divitemimg");obj.innerHTML=html}catch(E){}};this.init=function(){var objParam=new Array;try{if(typeof request.ssn!="undefined"&&typeof request.sid!="undefined"){objParam["ssn"]=request.ssn;objParam["sid"]=request.sid;objParam["type"]=request.type}else return}catch(IE){alert("INIT1: "+
IE.message);return}try{if(service!=null)return;var oAjax=new Ajax;service=oAjax.sendRequest(defaulthost+"/gamepub/purchase/service_info.nwz",objParam,"GET",null,"JSON",true);service.alert.url=defaulthost+service.alert.url;if(service.err.no<0);}catch(initE){alert(initE.message);document.location.reload();service=null}try{this.requestUserComponent("search_condition","","","","")}catch(searchE){return}};this.init_action=function(){var objParam=new Array;objParam["ssn"]=request.ssn;objParam["sid"]=request.sid;
objParam["type"]=request.type;var oAjax=new Ajax;service=oAjax.sendRequest(defaulthost+"/gamepub/purchase/service_info.nwz",objParam,"GET",null,"JSON",true);service.alert.url=defaulthost+service.alert.url;if(service.err.no<0){this.alert(service.err.msg);return false}return true};this.onPayedLoad=function(ssn,sid,type,sellplace,host,dsc_own_id,dsc_amt,pay_type,pay_cdl,targetid,reward_to,charinfo,eparams,memo,guildid){var loc_=document.location.pathname.search("/NL/pmang/");if(loc_>0){document.location.replace("http://"+
host+"/"+document.location.pathname.substring(loc_+10)+document.location.search);return}request.ssn=ssn;request.sid=sid;request.type=type;request.sellplace=sellplace;request.amount=dsc_amt;request.bPurchase=false;request.dsc_own_id=dsc_own_id;request.dscobj=new Object;request.selfclose=true;request.pay_type=pay_type;request.pay_cdl=pay_cdl;request.targetid=targetid;request.charinfo=charinfo;request.reward_to=reward_to;request.memo=memo;request.guildid=guildid;this.init();var iparams=null;switch(request.type){case "B":case "PB":iparams=
service.service.buy;break;case "G":case "PG":iparams=service.service.gift;break}var objTemp=null;if(iparams!=null){var ipos=0;eparams=eparams.split("|");for(var key in iparams){objTemp=this.getElement(key);if(objTemp!=null)objTemp.value=eparams[ipos++]}}this.purchase_submit();OnloadReplace()};this.onPageLoaded=function(ssn,sid,type,sellplace,host){var loc_=document.location.pathname.search("/NL/pmang/");if(loc_>0){document.location.replace("http://"+host+"/"+document.location.pathname.substring(loc_+
10)+document.location.search);return}request.ssn=ssn;request.sid=sid;request.type=type;request.sellplace=sellplace;request.amount=0;request.bPurchase=false;request.selfclose=false;this.init();OnloadReplace();if(request.type=="D"){var objInfor=this.getElement("item_infor");if(objInfor.innerHTML=="- "||objInfor.innerHTML=="")bjInfor.style.display="none";else bjInfor.style.display="block";objInfor.style.height=300;objInfor.style._height=302;var objDescr=this.getElement("item_descr");objDescr.style.display=
"none";resize_wnd()}else if(request.type=="T"||request.type=="G"||request.type=="PG"){var objChar=this.getElement("tochar");if(objChar!=null)objChar.focus();else{objChar=this.getElement("memo");if(objChar!=null)objChar.focus()}}else if(false&&!this.requestUserComponent("uinfo","","","",""))this.alert(service.err.msg)};this.requestUserComponent=function(field,subkey1,subkey2,subkey3,subkey4){if(service.err.no>0)try{var arrParam=new Array;arrParam["ssn"]=service.ssn;arrParam["sid"]=service.sid;arrParam["type"]=
service.type;arrParam["usn"]=service.userinfo.usn;arrParam["pid"]=service.userinfo.pid;arrParam["gamecode"]=service.gamecode;arrParam["sellplace"]=request.sellplace;arrParam["field"]=field;arrParam["subkey1"]=subkey1;arrParam["subkey2"]=subkey2;arrParam["subkey3"]=subkey3;arrParam["subkey4"]=subkey4;arrParam["encrypt"]=service.userinfo.encrypt;var oAjax=new Ajax;switch(field){case "uinfo":service.err.msg="NOT DEFINED";return false;case "dccoupon":request.userobj=oAjax.sendRequest(defaulthost+"/gamepub/purchase/requestUserComponent.nwz",
arrParam,"POST",null,"JSON",true);if(request.userobj.err.no<0){service.err.msg=request.userobj.err.msg;service.err.no=request.userobj.err.no;return false}else return true;break;case "excticket":request.userobj=oAjax.sendRequest(defaulthost+"/gamepub/purchase/requestUserComponent.nwz",arrParam,"POST",null,"JSON",true);if(request.userobj.err.no<0){service.err.msg=request.userobj.err.msg;service.err.no=request.userobj.err.no;return false}else return true;break;case "guildsearch":request.userobj=oAjax.sendRequest(defaulthost+
"/gamepub/purchase/requestUserComponent.nwz",arrParam,"POST",null,"JSON",true);if(request.userobj.err.no<0){service.err.msg=request.userobj.err.msg;service.err.no=request.userobj.err.no;return false}else return true;break;case "search_condition":search_condition=oAjax.sendRequest(defaulthost+"/gamepub/purchase/requestUserComponent.nwz",arrParam,"POST",null,"JSON",true);return true;break;case "use_excticket":var ret=oAjax.sendRequest(defaulthost+"/gamepub/purchase/requestUserComponent.nwz",arrParam,
"POST",null,"JSON",true);return ret;case "history":var ret=oAjax.sendRequest(defaulthost+"/gamepub/purchase/requestUserComponent.nwz",arrParam,"POST",null,"JSON",true);return ret;case "paymethod":var ret=oAjax.sendRequest(defaulthost+"/gamepub/purchase/requestUserComponent.nwz",arrParam,"POST",null,"JSON",true);return ret}}catch(E){if(!service.isdev)this.alert("»óÁ¡¿À·ù: "+E.message);return false}else return false};this.useExcTicket=function(ticketid,ticketsrl){try{if(ticketid>=0){$("#dialog").dialog({autoOpen:false,
show:"",hide:"slide",modal:true,resizable:false,draggable:false});$("#dialog").dialog("option","width",300);$("#dialog").dialog("option","minHeight",300);$("#dialog").html("¼±ÅÃÇÑ »óÇ°±ÇÀ¸·Î ¾ÆÀÌÅÛÀ» ±³È¯ÇÏ½Ã°Ú½À´Ï±î?");$("#dialog").dialog("option","buttons",{"¾Æ´Ï¿À":function(){$("#dialog").dialog("close")},"¿¹":function(){var oAjax=new Ajax;var objParam=new Array;objParam["ssn"]=request.ssn;objParam["saleinfo_id"]=request.sid;objParam["ticketid"]=ticketid;objParam["ticketsrl"]=ticketsrl;service=oAjax.sendRequest(defaulthost+
"/gamepub/purchase/purchase_ticket.nwz",objParam,"GET",null,"JSON",true);if(service.code>0){$("#dialog").dialog("close");pub_shop.alert(service.msg);self.close()}else{$("#dialog").dialog("close");pub_shop.alert(service.msg)}}});$("#dialog").dialog("open")}else{var divExcTicket=this.getElement("divExcTicket");var ulPayment=this.getElement("ulPayment");divExcTicket.style.display="none";ulPayment.style.display="block";this.redrawAccount()}}catch(E){}};this.selectCoupon=function(idx){try{if(idx>=0){request.dsc_own_id=
request.userobj.coupon[idx].dsc_own_id;request.dscobj=request.userobj.coupon[idx];if(request.dscobj.dsc_type=="RT")request.amount=service.saleinfo.amt*request.dscobj.amount/100;else request.amount=request.dscobj.amount;request.amount=parseInt(request.amount)}else if(typeof request.dscobj=="object");else{request.dsc_own_id="";request.amount=service.userinfo.account.pcbdiscount;request.dscobj=null}var divCoupon=this.getElement("divCoupon");var ulPayment=this.getElement("ulPayment");divCoupon.style.display=
"none";ulPayment.style.display="block";this.redrawAccount()}catch(E){}};this.redrawAccount=function(){if(request.dscobj==null){request.dsc_own_id="";request.amount=service.userinfo.account.pcbdiscount;request.dscobj=null}try{try{var DISCOUNT_AMOUNT=this.getElement("DISCOUNT_AMOUNT");if(DISCOUNT_AMOUNT!=null)DISCOUNT_AMOUNT.innerHTML=this.formatNumber(request.amount,3);var DISCOUNT_PAY=this.getElement("DISCOUNT_PAY");if(DISCOUNT_PAY!=null)DISCOUNT_PAY.innerHTML=this.formatNumber(service.saleinfo.amt-
request.amount,3);DISCOUNT_PAY=this.getElement("DISCOUNT_PAY_NOW");if(DISCOUNT_PAY!=null)DISCOUNT_PAY.innerHTML=this.formatNumber(service.saleinfo.amt-request.amount,3)}catch(ED){}try{var DISCOUNT_LAGCASH=this.getElement("DISCOUNT_LAGCASH");if(DISCOUNT_AMOUNT!=null)request.lagcash=service.saleinfo.amt-request.amount-service.userinfo.account.ownsum;else request.lagcash=service.userinfo.account.lagcash-request.amount;request.lagcash=request.lagcash<0?0:request.lagcash;if(DISCOUNT_LAGCASH!=null)DISCOUNT_LAGCASH.innerHTML=
this.formatNumber(request.lagcash,3)}catch(ED){}try{var msgbox=this.getElement("msgbox");var msgstr=service.type=="B"?"¾ÆÀÌÅÛÀ» ±¸¸Å ÇÏ½Ã°Ú½À´Ï±î?":"¾ÆÀÌÅÛÀ» ¼±¹° ÇÏ½Ã°Ú½À´Ï±î?";var obj=this.getElement("guildid");if(obj!=null)msgstr="¾ÆÀÌÅÛÀ» ¼±¹° ÇÏ½Ã°Ú½À´Ï±î?";if(msgbox!=null)if(service.paytype==""){var str_PayMethod=this.___get_radio_value("PayMethod");if(str_PayMethod==""||str_PayMethod=="SAYCASH")if(request.lagcash>0)msgbox.innerHTML="ºÎÁ·ÇÑ ±Ý¾×À» ÃæÀüÇÏ¿© "+msgstr;else msgbox.innerHTML=msgstr;else msgbox.innerHTML="¼±ÅÃÇÑ °áÁ¦¹æ½ÄÀ¸·Î "+msgstr}var btnCoupon=
this.getElement("btnDISCOUNT_AMOUNT");if(request.dscobj!=null)btnCoupon.src="http://file.pmang.kr/images/pmang/gamepub/purchase/img/btn_coupon_cancel.gif";else btnCoupon.src="http://file.pmang.kr/images/pmang/gamepub/purchase/img/btn_coupon_apply.gif"}catch(ED){}}catch(E){}resize_wnd()};this.retriveGuildForm=function(use){var divGuildSearch=this.getElement("divGuildSearch");var divExcTicket=this.getElement("divExcTicket");var divCoupon=this.getElement("divCoupon");var ulPayment=this.getElement("ulPayment");
var ulAfterPayment=this.getElement("ulAfterPayment");if(use>0){if(request.bPurchase&&ulAfterPayment!=null)if(ulAfterPayment.style.display!="none"){this.alert("ÀÌ¹Ì ¼±¹°ÀÌ ¿Ï·áµÇ¾ú½À´Ï´Ù.");return}if(divExcTicket!=null&&ulPayment!=null&&divCoupon!=null){divGuildSearch.style.display="block";divExcTicket.style.display="none";ulPayment.style.display="none";divCoupon.style.display="none"}this.redrawAccount();resize_wnd()}else{divGuildSearch.style.display="none";ulPayment.style.display="block";this.redrawAccount()}};
this.selectGuild=function(name,guildid,close){var ulGuild_name=this.getElement("guild_name");var ulGuildid=this.getElement("guildid");if(ulGuild_name!=null&&ulGuildid!=null){request.guildid=guildid;ulGuild_name.value=name;ulGuildid.value=guildid}if(close==null)this.retriveGuildForm(-1)};this.retriveGuildList=function(){var findtype=this.___get_radio_value("findtype");var keyword=this.getElement("keyword").value;if(keyword==""){this.alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.");return}if(this.requestUserComponent("guildsearch",
findtype,keyword,"","")){var cnt=request.userobj.guildcnt;if(cnt>0){var emExcGuildCnt=this.getElement("emGuildCnt");if(emExcGuildCnt!=null)emExcGuildCnt.innerHTML=cnt;objTBL=this.clearTable("tblGuildList");for(var i=0;i<cnt;i++){var row=objTBL.insertRow();for(j=0;j<2;j++){var cell=row.insertCell();switch(j){case 0:cell.innerHTML=service.guilditem.system_name+"¸í : <a style='cursor:hand' onclick=\"pub_shop.selectGuild('"+request.userobj.guildlist[i].name+"','"+request.userobj.guildlist[i].guildid+"')\">"+
request.userobj.guildlist[i].name+"</a>";cell.style.width="160px";break;case 1:cell.innerHTML=service.guilditem.system_name+service.guilditem.master_level+" : <a style='cursor:hand' onclick=\"pub_shop.selectGuild('"+request.userobj.guildlist[i].name+"','"+request.userobj.guildlist[i].guildid+"')\">"+request.userobj.guildlist[i].sysopnick+"</a>";cell.style.width="80px";break;default:}cell.className="t"+(j+1)}}request.userobj=""}else{objTBL=this.clearTable("tblGuildList");var row=objTBL.insertRow();
row.style.height="20px";row.style.background="#FFFFFF";var cell=row.insertCell();cell.style.width="420px";cell.innerHTML="°Ë»öµÈ °á°ú°¡ ¾ø½À´Ï´Ù."}}};this.retriveExcTicket=function(){var divExcTicket=this.getElement("divExcTicket");var divGuildSearch=this.getElement("divGuildSearch");var divCoupon=this.getElement("divCoupon");var ulPayment=this.getElement("ulPayment");if(divExcTicket!=null&&ulPayment!=null&&divCoupon!=null&&divGuildSearch!=null){divExcTicket.style.display="block";ulPayment.style.display="none";
divCoupon.style.display="none";divGuildSearch.style.display="none";var objTBL=this.clearTable("tblCouponList");this.displaySearchTable(objTBL);var txtCoupon=this.getElement("txtExcTicket1");if(txtCoupon!=null)txtCoupon.innerHTML="»ç¿ë°¡´ÉÇÑ »óÇ°±Ç";var txtCoupon=this.getElement("txtExcTicket2");if(txtCoupon!=null)txtCoupon.innerHTML="ÇÒÀÎÀ²";var txtCoupon=this.getElement("txtExcTicket3");if(txtCoupon!=null)txtCoupon.innerHTML="»ç¿ë±âÇÑ";var txtCoupon=this.getElement("txtExcTicket4");if(txtCoupon!=null)txtCoupon.innerHTML=
'<a href="#" onclick="javascript:pub_shop.selectCoupon(-1);"><img src="http://file.pmang.kr/images/pmang/mall/btn_box_coupon_close.gif"></a>';if(this.requestUserComponent("excticket","","","","")){var cnt=request.userobj.excticketavailcnt;var emExcTicketCnt=this.getElement("emExcTicketCnt");if(emExcTicketCnt!=null)emExcTicketCnt.innerHTML=cnt;if(cnt>0){objTBL=this.clearTable("tblExcTicketList");for(var i=0;i<cnt;i++){var row=objTBL.insertRow();for(j=0;j<3;j++){var cell=row.insertCell();switch(j){case 0:cell.innerHTML=
'<a href="#" onclick="javascript:pub_shop.useExcTicket('+request.userobj.ticket[i].ticketid+","+request.userobj.ticket[i].ticketsrl+');">'+request.userobj.ticket[i].ticketname+"</a>";break;case 1:cell.innerHTML="100%";break;case 2:cell.innerHTML="~ "+request.userobj.ticket[i].expiredate.substr(2,2)+"."+request.userobj.ticket[i].expiredate.substr(4,2)+"."+request.userobj.ticket[i].expiredate.substr(6,2)+" "+request.userobj.ticket[i].expiredate.substr(8,2)+":"+request.userobj.ticket[i].expiredate.substr(10,
2)+":"+request.userobj.ticket[i].expiredate.substr(12,2);break;default:}cell.className="t"+(j+1)}}}else{objTBL=this.clearTable("tblExcTicketList");var row=objTBL.insertRow();row.style.height="20px";row.style.background="#FFFFFF";var cell=row.insertCell();cell.style.width="420px";cell.innerHTML="»ç¿ë °¡´ÉÇÑ Ä³½¬ »óÇ°±ÇÀÌ ¾ø½À´Ï´Ù."}}}resize_wnd();this.trimTitle()};this.retriveCoupon=function(){if(request.dscobj!=null){request.dsc_own_id="";request.amount=service.userinfo.account.pcbdiscount;request.dscobj=null;this.redrawAccount();
return}var divExcTicket=this.getElement("divExcTicket");var divGuildSearch=this.getElement("divGuildSearch");var divCoupon=this.getElement("divCoupon");var ulPayment=this.getElement("ulPayment");if(divCoupon!=null&&ulPayment!=null&&divExcTicket!=null&&divGuildSearch!=null){divCoupon.style.display="block";divExcTicket.style.display="none";ulPayment.style.display="none";divGuildSearch.style.display="none";var objTBL=this.clearTable("tblCouponList");this.displaySearchTable(objTBL);var txtCoupon=this.getElement("txtCoupon1");
if(txtCoupon!=null)txtCoupon.innerHTML="»ç¿ë°¡´ÉÇÑ ÄíÆù";var txtCoupon=this.getElement("txtCoupon2");if(txtCoupon!=null)txtCoupon.innerHTML="ÇÒÀÎÀ²";var txtCoupon=this.getElement("txtCoupon3");if(txtCoupon!=null)txtCoupon.innerHTML="»ç¿ë±âÇÑ";var txtCoupon=this.getElement("txtCoupon4");if(txtCoupon!=null)txtCoupon.innerHTML='<a href="#" onclick="javascript:pub_shop.selectCoupon(-1);"><img src="http://file.pmang.kr/images/pmang/mall/btn_box_coupon_close.gif"></a>';if(this.requestUserComponent("dccoupon","","","",
"")){var cnt=request.userobj.couponavailcnt;var emCouponCnt=this.getElement("emCouponCnt");if(emCouponCnt!=null)emCouponCnt.innerHTML=cnt;if(cnt>0){objTBL=this.clearTable("tblCouponList");for(var i=0;i<cnt;i++){var row=objTBL.insertRow();for(j=0;j<3;j++){var cell=row.insertCell();switch(j){case 0:cell.innerHTML='<a href="#" onclick="javascript:pub_shop.selectCoupon('+i+');">'+request.userobj.coupon[i].name+"</a>";break;case 1:cell.innerHTML=request.userobj.coupon[i].dsc_info;break;case 2:cell.innerHTML=
"~ "+request.userobj.coupon[i].expdate;break;default:}cell.className="t"+(j+1)}}}else{objTBL=this.clearTable("tblCouponList");var row=objTBL.insertRow();row.style.height="20px";row.style.background="#FFFFFF";var cell=row.insertCell();cell.style.width="420px";cell.innerHTML="»ç¿ë °¡´ÉÇÑ ÇÒÀÎ ÄíÆùÀÌ ¾ø½À´Ï´Ù."}}}resize_wnd();this.trimTitle()};this.clearTable=function(id){var objTBL=this.getElement(id);if(objTBL==null)return null;for(var i=objTBL.rows.length-1;i>=0;i--)objTBL.deleteRow(0);return objTBL};this.displaySearchTable=
function(objTBL){var row=objTBL.insertRow();row.style.height="20px";row.style.background="#FFFFFF";var cell=row.insertCell();cell.style.width="420px";cell.innerHTML="<img src='http://file.pmang.com/images/pmang/gamepub/loading.gif'>"};this.trimTitle=function(){try{AppletSession.setcaption("")}catch(Exception){}};this.formatNumber=function(src,separator_pos){var x=[];src=new String(src);for(var i=1;i<=src.length;i++)if(i%separator_pos)x[src.length-i]=src.charAt(src.length-i);else x[src.length-i]=","+
src.charAt(src.length-i);return x.join("").replace(/^,/,"")};this.___get_radio_value=function(id){var objs=this.getElementByName(id);var val;if(typeof objs=="object"){if(!objs.length)if(objs.checked)val=objs.value;else val="";else{val="";for(var cb=0;cb<objs.length;cb++)if(objs[cb].checked)val=objs[cb].value}return val}else return""};this.___set_radio_check=function(id,value){var objs=this.getElementByName(id);if(typeof objs=="object")if(!objs.length){if(objs.value==value)objs.checked=true}else for(var cb=
0;cb<objs.length;cb++)if(objs[cb].value==value)objs[cb].checked=true};this.___set_selectbox_check=function(id,value){for(i=0;i<$(":input[name="+id+"] > option").size();i++)if($(":input[name="+id+"] > option[index="+i+"]").val()==value)$(":input[name="+id+"] > option[index="+i+"]").attr("selected","true");if($(":input[name="+id+"]").attr("class")=="SelectBasic")RelocateSelects()};this.getActionStr=function(prefix,suffix){prefix=prefix=="buy"?"buy":"pay";switch(request.type){case "B":if(prefix=="buy")return prefix+
"Charge"+suffix;else return prefix+"Buy"+suffix;case "G":return prefix+"Gift"+suffix;case "T":return prefix+"Ticket"+suffix;case "PB":return prefix+"BuyPoint"+suffix;case "PG":return prefix+"GiftPoint"+suffix;default:return""}};this.closeMyPurchaseList=function(){var divCoupon=this.getElement("divCoupon");var ulPayment=this.getElement("ulPayment");var ulAfterPayment=this.getElement("ulAfterPayment");var divGuildSearch=this.getElement("divGuildSearch");var divExcTicket=this.getElement("divExcTicket");
divCoupon.style.display="none";if(divGuildSearch!=null)divGuildSearch.style.display="none";if(divExcTicket!=null)divExcTicket.style.display="none";if(request.bPurchase)ulAfterPayment.style.display="block";else ulPayment.style.display="block";resize_wnd()};this.retriveMyPurchaseList=function(){var divCoupon=this.getElement("divCoupon");var ulPayment=this.getElement("ulPayment");var ulAfterPayment=this.getElement("ulAfterPayment");var divGuildSearch=this.getElement("divGuildSearch");if(divCoupon!=null&&
ulPayment!=null){var objTBL=this.clearTable("tblCouponList");this.displaySearchTable(objTBL);var txtCoupon=this.getElement("txtCoupon1");if(txtCoupon!=null)txtCoupon.innerHTML="°Å·¡³»¿ë";var txtCoupon=this.getElement("txtCoupon2");if(txtCoupon!=null)txtCoupon.innerHTML="À¯Çü";var txtCoupon=this.getElement("txtCoupon3");if(txtCoupon!=null)txtCoupon.innerHTML="°Å·¡ÀÏ½Ã";var txtCoupon=this.getElement("txtCoupon4");if(txtCoupon!=null)txtCoupon.innerHTML='<a href="#" onclick="javascript:pub_shop.closeMyPurchaseList();"><img src="http://file.pmang.kr/images/pmang/mall/btn_box_coupon_close.gif"></a>';
divCoupon.style.display="block";ulPayment.style.display="none";if(divGuildSearch!=null)divGuildSearch.style.display="none";if(divExcTicket!=null)divExcTicket.style.display="none";if(ulAfterPayment!=null)ulAfterPayment.style.display="none";var objlist=this.requestUserComponent("history","","","","");var emCouponCnt=this.getElement("emCouponCnt");if(emCouponCnt!=null)emCouponCnt.innerHTML=objlist?objlist.cnt:0;if(objlist&&objlist.cnt>0){objTBL=this.clearTable("tblCouponList");for(var i=0;i<objlist.cnt;i++){var row=
objTBL.insertRow();for(j=0;j<3;j++){var cell=row.insertCell();switch(j){case 0:cell.innerHTML="<a>"+objlist.list[i].product_name+"</a>";break;case 1:cell.innerHTML=objlist.list[i].action_type;break;case 2:cell.innerHTML="~ "+objlist.list[i].cre_time;break;default:}cell.className="t"+(j+1)}}}else{objTBL=this.clearTable("tblCouponList");var row=objTBL.insertRow();row.style.height="20px";row.style.background="#FFFFFF";var cell=row.insertCell();cell.style.width="420px";cell.innerHTML="°Å·¡ ±â·ÏÀÌ ¾ø½À´Ï´Ù."}resize_wnd()}this.trimTitle()};
this.resetwgifttarget=function(){var objwgifttarget=this.getElement("wgifttarget");if(objwgifttarget!=null){if(objwgifttarget.style.display=="block")document.all.wgifttarget.style.display="none";return}};this.selectChar=function(idx){try{var obj=this.getElement("targetid");obj.value=arrChar[idx].pmangid;obj=this.getElement("tochar");obj.value=arrChar[idx].gamenick;obj=this.getElement("charinfo");obj.value=arrChar[idx].charinfo;obj=this.getElement("dv_char");if(obj!=null)obj.style.display="none"}catch(E){}};
this.selectSearchCondition=function(nMenuID,param){var obj=null,tag=null;var args=param.split(/,/);var is_expanded=false;try{for(var i=0,n=args.length;i<n;i++){tag=args[i].split(/=/);is_expanded=false;for(j=0;j<search_condition.cnt;j++)if(tag[0]==search_condition.list[j].key){switch(search_condition.list[j].type){case "hidden":case "text":case "button":obj=this.getElement(tag[0]);obj.value=tag[1];break;case "selectbox":this.___set_selectbox_check(tag[0],tag[1]);break;case "radio":this.___set_radio_check(tag[0],
tag[1]);break;case "checkbox":this.___set_radio_check(tag[0],tag[1]);break;default:obj=this.getElement(tag[0]);obj.value=tag[1]}is_expanded=true}if(is_expanded==false){obj=this.getElement(tag[0]);obj.value=tag[1]}}}catch(E){this.alert("¿À·ù·Î ÀÎÇØ ÁøÇàÇÒ ¼ö ¾ø½À´Ï´Ù. Ä£±¸ ¼±ÅÃÀ» ´Ù½Ã ½ÃµµÇØÁÖ¼¼¿ä.<br><br>"+E.message)}obj=this.getElement("dv_char");if(obj!=null)obj.style.display="none"};this.selectFriend=function(nMenuID,param){var obj=null,tag=null;var args=param.split(/,/);try{for(var i=0,n=args.length;i<n;i++){tag=args[i].split(/=/);
obj=this.getElement(tag[0]);obj.value=tag[1]}}catch(E){this.alert("¿À·ù·Î ÀÎÇØ ÁøÇàÇÒ ¼ö ¾ø½À´Ï´Ù. Ä£±¸ ¼±ÅÃÀ» ´Ù½Ã ½ÃµµÇØÁÖ¼¼¿ä.<br><br>"+E.message)}obj=this.getElement("dv_char");if(obj!=null)obj.style.display="none"};this.a_char_focus=function(objA,bgainfocus){if(bgainfocus){objA.style.backgroundColor="#cac4b7";objA.style.color="#333"}else{objA.style.backgroundColor="#f4f2ea";objA.style.color="#333"}};this.searchCharKeyEvent=function(who){try{var obj;switch(event.keyCode){case 33:for(var i=5;i>=0;i--){obj=this.getElement("a_char_"+
(who-i));if(obj!=null){obj.focus();break}}break;case 34:for(var i=5;i>=0;i--){obj=this.getElement("a_char_"+(who+i));if(obj!=null){obj.focus();break}}break;case 38:if(who==0){obj=this.getElement("tochar");if(obj!=null)obj.focus();var objdvchar=this.getElement("dv_char");if(objdvchar!=null)objdvchar.style.display="none"}else{obj=this.getElement("a_char_"+(who-1));if(obj!=null)obj.focus()}break;case 40:obj=this.getElement("a_char_"+(who+1));if(obj!=null)obj.focus();break}}catch(E){}};this.gamepub_char_search=
function(arrParams){var oAjax=new Ajax;arrChar=oAjax.sendRequest(defaulthost+"/gamepub/purchase/gamepub_char_search.nwz",arrParams,"GET",null,"JSON",true)};this.searchChar=function(objChar){var valToChar=objChar.value;if(event.keyCode==40){var arrParam=new Array;arrParam["ssn"]=request.ssn;arrParam["tochar"]=valToChar;for(i=0;i<search_condition.cnt;i++)switch(search_condition.list[i].type){case "select-one":case "selectbox":case "hidden":case "text":case "button":arrParam[search_condition.list[i].key]=
this.getElement(search_condition.list[i].key).value;break;case "radio":case "checkbox":arrParam[search_condition.list[i].key]=this.___get_radio_value(search_condition.list[i].key);break;default:arrParam[search_condition.list[i].key]=""}this.gamepub_char_search(arrParam);var objdvchar=this.getElement("dv_char");if(objdvchar!=null){var objTBL=this.clearTable("tblChar");objdvchar.style.display="block";if(arrChar.length>0)for(var i=0;i<arrChar.length;i++){var row=objTBL.insertRow();for(var j=0;j<1;j++){var cell=
row.insertCell();switch(j){case 0:cell.innerHTML="<a href=# id=a_char_"+i+" onclick='javascript:pub_shop.selectChar("+i+");'"+" onfocus='javascript:pub_shop.a_char_focus(this, true);'"+" onfocusout='javascript:pub_shop.a_char_focus(this, false);'"+" onkeydown='javascript:pub_shop.searchCharKeyEvent( "+i+" );'"+">"+arrChar[i].dpname+"</a>";break}}}else objdvchar.style.display="none";if(typeof document.all.a_char_0=="object")document.all.a_char_0.focus()}}};this.check_login=function(){this.init_sync_object();
syncObject.url="/gamepub/client/check_login.nwz";syncObject.type="GET";if($.ajax(syncObject).responseText=="ONLINE")return true;else return false};this.init_sync_object=function(){if(!syncObject.async){syncObject.async=false;syncObject.timeout=2E3}};this.showPremium=function(ssn){if(this.check_login()){var exts="ssn="+ssn+"&";for(var i=1,n=arguments.length;i<n;i++)exts+="arg_"+i+"="+arguments[i]+"&";this.open_win(defaulthost+"/gamepub/purchase/premium.nwz?"+exts,"_premium",380,500)}else this.alert("·Î±×ÀÎÀÌ ÇÊ¿äÇÑ ¼­ºñ½ºÀÔ´Ï´Ù.")};
this.registPremium=function(ssn,saleinfo_id,step){if(this.check_login())this.open_win(defaulthost+"/gamepub/purchase/premium_regist.nwz?ssn="+ssn+"&saleinfo_id="+saleinfo_id+"&step="+step,"_premium",400,560);else this.alert("·Î±×ÀÎÀÌ ÇÊ¿äÇÑ ¼­ºñ½ºÀÔ´Ï´Ù.")};this.rdsPremium=function(rdsurl,ssn,t_saleinfo_id){if($(agree_autopay)[0].checked==false&&$(agree_autopay)[1].checked==false){$("#dialog").dialog({autoOpen:false,show:"slide",hide:"slide",modal:true,resizable:false,draggable:false});$("#dialog").html("ÀÚµ¿ °áÁ¦¸¦ »ç¿ëÇÏ½Ã°Ú½À´Ï±î?");
$("#dialog").dialog("option","buttons",{"¾Æ´Ï¿À":function(){location.href=defaulthost+"/gamepub/purchase/purchase.nwz?buytype=B&ssn="+ssn+"&saleinfo_id="+t_saleinfo_id;$("#dialog").dialog("close")},"¿¹":function(){document.location.href=rdsurl+"%26agree_autopay%3DY";try{$("#dialog").dialog("close")}catch(E){}}});$("#dialog").dialog("open")}else if($(agree_autopay)[0].checked)document.location.href=rdsurl+"%26agree_autopay%3DY";else location.href=defaulthost+"/gamepub/purchase/purchase.nwz?buytype=B&ssn="+
ssn+"&saleinfo_id="+t_saleinfo_id};this.rdsPremiumCharacter=function(rdsurl,ssn,t_saleinfo_id,character_srl){if(typeof character_srl!="undefined"||character_srl!="")var str_char_info="%26character_srl%3D"+character_srl;else var str_char_info="";if(this.getElement("agree_autopay").checked==false){$("#dialog").dialog({autoOpen:false,show:"slide",hide:"slide",modal:true,resizable:false,draggable:false});$("#dialog").html("ÀÚµ¿ °áÁ¦ ÀÌ¿ë¿¡ µ¿ÀÇÇÏ½Ê´Ï±î?");$("#dialog").dialog("option","buttons",{"¾Æ´Ï¿À":function(){$("#dialog").dialog("close")},
"¿¹":function(){this.getElement("agree_autopay").checked=true;location.href=rdsurl+"%26agree_autopay%3D"+str_char_info;try{$("#dialog").dialog("close")}catch(E){}}});$("#dialog").dialog("open")}else location.href=rdsurl+"%26agree_autopay%3D"+str_char_info};this.checkPremium=function(ssn,saleinfo_id){this.init_sync_object();syncObject.url="/gamepub/purchase/premium_action.nwz";syncObject.type="POST";syncObject.dataType="json";syncObject.data={ssn:ssn,saleinfo_id:saleinfo_id,action:"check_premium"};
syncObject.success=function(obj){switch(obj.msg_type){case "alert":$("#dialog").dialog({autoOpen:false,show:"",hide:"slide",modal:true,resizable:false,draggable:true});$("#dialog").dialog("option","width",500);$("#dialog").dialog("option","minHeight",300);$("#dialog").html(obj.msg);$("#dialog").dialog("open");break;case "confirm":$("#dialog").dialog({autoOpen:false,show:"",hide:"slide",modal:true,resizable:false,draggable:true});$("#dialog").dialog("option","width",500);$("#dialog").dialog("option",
"minHeight",300);$("#dialog").html(obj.msg);$("#cs_dv_pop_footer_ok").one("click",function(){pub_shop.registPremium(ssn,saleinfo_id,1);$("#dialog").dialog("close")});$("#cs_dv_pop_footer_cancel").one("click",function(){$("#dialog").dialog("close")});$("#dialog").dialog("open");break;case "javascript":eval(obj.msg);break;case "expired":pub_shop.registPremium(ssn,saleinfo_id,1);default:alert("asdasda")}};$.ajax(syncObject)};this.premium_autopay=function(action,ssn,saleinfo_id,srl){this.init_sync_object();
syncObject.url="/gamepub/purchase/premium_action.nwz";syncObject.type="POST";syncObject.dataType="json";syncObject.data={ssn:ssn,saleinfo_id:saleinfo_id,srl:srl,action:action};syncObject.success=function(obj){pub_shop.reply(obj)};$.ajax(syncObject)};this.reply=function(obj){$("#dialog").dialog({autoOpen:false,show:"slide",hide:"slide",modal:true,resizable:false});switch(obj.msg_type){case "confirm":$("#dialog").dialog("option","buttons",{"Ãë¼Ò":function(){$("#dialog").dialog("close")},"È®ÀÎ":function(){pub_shop.reply_check(obj);
$("#dialog").dialog("close")}});$("#dialog").html(obj.msg);$("#dialog").dialog("open");break;case "alert":$("#dialog").dialog("option","buttons",{"È®ÀÎ":function(){$("#dialog").dialog("close")}});$("#dialog").dialog("option","close",function(){pub_shop.reply_check(obj)});$("#dialog").html(obj.msg);$("#dialog").dialog("open");break}};this.reply_check=function(obj){var type=obj.nurl_type.split(":");switch(type[0]){case "blank":open_window(obj.nurl,type[0],"");break;case "popup":open_win(obj.nurl,type[0],
type[1],type[2]);break;case "javascriptreload":document.location.reload();break;case "javascriptclose":self.close();break;case "js":eval(obj.nurl);break}};this.openPremiumPaymethod=function(ssn,saleinfo_id){this.init_sync_object();syncObject.url="/gamepub/purchase/premium_action.nwz";syncObject.type="POST";syncObject.dataType="json";syncObject.data={ssn:ssn,saleinfo_id:saleinfo_id,action:"openPremiumPaymethod"};syncObject.success=function(obj){open_win(obj.nurl_type+"?"+obj.nurl,"_premium_method",
380,300)};$.ajax(syncObject)};this.goChangeCharinfo=function(ssn,saleinfo_id){request.ssn=ssn;request.sid=saleinfo_id;request.type="B";if(this.check_login()){var exts="ssn="+ssn+"&saleinfo_id="+saleinfo_id+"&mode=changechr";location.href=defaulthost+"/gamepub/purchase/premium.nwz?"+exts}else this.alert("·Î±×ÀÎÀÌ ÇÊ¿äÇÑ ¼­ºñ½ºÀÔ´Ï´Ù.")};this.changeCharinfo=function(ssn,saleinfo_id,character_srl){this.init_sync_object();syncObject.url="/gamepub/purchase/premium_action.nwz";syncObject.type="POST";syncObject.dataType=
"json";syncObject.data={ssn:ssn,saleinfo_id:saleinfo_id,character_srl:character_srl,action:"change_character"};syncObject.success=function(obj){pub_shop.reply(obj)};$.ajax(syncObject)};this.redirectPremium=function(ssn,saleinfo_id){request.ssn=ssn;request.sid=saleinfo_id;request.type="B";if(this.check_login()){var exts="ssn="+ssn+"&saleinfo_id="+saleinfo_id;location.href=defaulthost+"/gamepub/purchase/premium.nwz?"+exts}else this.alert("·Î±×ÀÎÀÌ ÇÊ¿äÇÑ ¼­ºñ½ºÀÔ´Ï´Ù.")};this.detailPremium=function(ssn,saleinfo_id){request.ssn=
ssn;request.sid=saleinfo_id;request.type="B";if(this.check_login()){var exts="ssn="+ssn+"&saleinfo_id="+saleinfo_id;this.open_win(defaulthost+"/gamepub/purchase/premium.nwz?"+exts,"_premium",380,500)}else this.alert("·Î±×ÀÎÀÌ ÇÊ¿äÇÑ ¼­ºñ½ºÀÔ´Ï´Ù.")}});function sendMobileSMS(reg_date){$.post("/slugger_check_mobile_item.nwz",{reg_date:reg_date},function(ret){var data=ret.split("|");if(data[1]=="T")window.open(data[2],"m_pop","width=440,height=200");else pub_alert(data[2])})};
