if(!pub_channeling)var pub_channeling=new (function(){var defaulthost="http://"+document.location.hostname;var info=null;var syncObject=new Object;var auth=null;this.init=function(){try{if(info==null){var arrParam=new Array;if(arguments.length>0)for(var i=0;i<arguments[0].length;i++)arrParam["arg"+i]=arguments[0][i];var oAjax=new Ajax;info=oAjax.sendRequest(defaulthost+"/gamepub/channel/service_info.nwz",arrParam,"POST",null,"JSON",true)}}catch(E){}};this.login=function(){if(info==null)this.init();
switch(info.url.login.type){case "self":break;case "js":eval(info.url.login.url);break;case "url":if(arguments.length>0)document.location.href=info.url.login.url+urlencode(defaulthost+arguments[0]);else document.location.href=info.url.login.url+urlencode(defaulthost);break;case "surl":document.location.href=info.url.login.url;break}};this.logout=function(){if(info==null)this.init();switch(info.url.logout.type){case "self":break;case "js":eval(info.url.logout.url);break;case "url":document.location.href=
info.url.logout.url;break}};this.agree=function(gamename){if(info==null)this.init(arguments);switch(info.url.agree.type){case "js":eval(info.url.agree.url);break;case "self":break;case "url":if(this.confirm('<b>"'+gamename+'"</b> °ÔÀÓ Âü¿©¸¦ À§ÇØ<br>Á¦ÈÞ¼­ºñ½º¿¡ °¡ÀÔÇÏ½Ã°Ú½À´Ï±î?'))document.location.href=info.url.agree.url;else this.setChCookie("OFF");break}};this.agree_self=function(){if(info==null)this.init(arguments);var arrParam=new Array;arrParam["url"]="/gamepub/channel/agree.nwz";arrParam["width"]=495;arrParam["height"]=
480;if(this.confirm("temp",arrParam)){var authreturn=null;this.init_sync_object();syncObject.url="/gamepub/channel/agree_proc.nwz";syncObject.type="POST";syncObject.dataType="json";syncObject.data={};eval("authreturn = "+$.ajax(syncObject).responseText);switch(authreturn.resultcode){case "1000":case "1002":case "1004":this.pm_login(authreturn.pm_login.from,authreturn.pm_login.uid,authreturn.pm_login.cid,authreturn.pm_login.srl);break;case "confirm":var arrParam=new Array;arrParam["title"]=document.title;
if(this.confirm(authreturn.resultdesc,arrParam))document.location=authreturn.resulturl;break;default:var arrParam=new Array;arrParam["title"]=document.title;this.alert(authreturn.resultdesc,arrParam);break}return false}};this.login_agree=function(){if(info==null)this.init();switch(info.url.agreelogin.type){case "self":break;case "url":document.location.href=info.url.agreelogin.url;break}};this.pm_login=function(from,uid,cid,srl){try{document.fo_login.pageurl.value=document.location;document.fo_login.usrid.value=
uid;document.fo_login.channel_id.value=cid;document.fo_login.channel_srl.value=srl;document.fo_login.from.value=from;document.fo_login.conntype.value=3;fo_finish(false)}catch(E){var frm=document.createElement("<form name=fo_login></form>");frm.id="fo_login";frm.method="post";frm.action="/global/login.nwz";frm.target="_top";document.body.insertAdjacentElement("beforeEnd",frm);var els=["pageurl","from","key","myip","myport","iscapslock","usrid","passwd","channel_id","channel_srl","conntype","sso_type"];
for(var idx in els){var obj=document.createElement("<input type=hidden name="+els[idx]+">");switch(obj.name){case "from":obj.value="pmang";break;case "conntype":obj.value=3;break;case "sso_type":obj.value=4;break}frm.insertAdjacentElement("beforeEnd",obj)}frm.pageurl.value=document.location;frm.usrid.value=uid;frm.channel_id.value=cid;frm.channel_srl.value=srl;frm.from.value=from;frm.conntype.value=3;fo_finish(false)}};this.under14=function(){if(info==null)this.init(arguments);if(this.confirm("°ÔÀÓ Âü¿©¸¦ À§ÇØ¼­´Â<br><b>½Ç¸í ÀÎÁõ</b>À» ÇÏ¼Å¾ß ÇÕ´Ï´Ù.<br><br>"))switch(info.url.under14.type){case "self":break;
case "url":document.location.href=info.url.under14.url;break}};this.my_pmang=function(){if(info==null)this.init();if(gamepub_check_login())this.open_win("http://www.pmang.com/gamepub/channel/my_pmang.nwz?gamename="+info.arrhost[0],"_buy",650,500);else this.alert("¸¶ÀÌÇÇ¸Á ¼­ºñ½º »ç¿ëÀ» À§ÇØ¼­´Â,<br>Á¦ÈÞ ¼­ºñ½º °¡ÀÔÀÌ ÇÊ¿äÇÕ´Ï´Ù.")};this.pm_send_login=function(){location.href="http://www.pmang.com/loginform.nwz?pageurl="+urlencode(document.location.href)};this.notify_regist=function(msg,url){this.alert(msg);location.href=url};
this.alert_login=function(){var clogin=null;this.init_sync_object();syncObject.url="/gamepub/client/check_login.nwz";syncObject.type="POST";syncObject.dataType="json";syncObject.data={check_mode:"CH"};eval("clogin = "+$.ajax(syncObject).responseText);switch(clogin.type){case "alert":var arrParam=new Array;arrParam["title"]=document.title;pub_alert(clogin.msg,arrParam);break;case "js":eval(clogin.msg);break;case "pass":return true;break}return false};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(info==null)this.init();return info.alert};this.setChCookie=function(data){this.clearCookie();
var expireDate=new Date;expireDate.setDate(expireDate.getDate()+1);this.setCookie(data,expireDate);return true};this.clearCookie=function(){if(arguments.length>0){var exp=new Date;exp.setTime(exp.getTime()-1E3);document.cookie=arguments[0]+"=; domain=."+document.domain+"; path=/; expires="+exp.toGMTString()+";"}else this.setCookie("",new Date("Jan 1, 1970 00:00:00"))};this.setCookie=function(data,expireDate){document.cookie="__REDIRECT_AGREE="+data+"; domain=."+document.domain+"; path=/; expires="+
expireDate.toGMTString()+";"};this.getElement=function(id){var obj=document.getElementById(id);if(typeof obj=="object"&&obj!==null)return obj;else null};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){}};this.init_sync_object=function(){if(!syncObject.async){syncObject.async=
false;syncObject.timeout=2E3}};this.getSignature=function(){var now=new Date;if(auth==null||auth.objdate.getTime()+1E3>now.getTime()){this.init_sync_object();syncObject.url="/gamepub/channel/get_finger_print.nwz";syncObject.type="POST";syncObject.dataType="json";syncObject.data={ssn:ssn};eval("auth = "+$.ajax(syncObject).responseText);if(arguments.length>0&&arguments[0]&&auth.ssn!=333){$("#dialog").dialog({autoOpen:false,modal:true,resizable:false,width:400,height:350});$("#dialog").dialog("option",
"buttons",{"È®ÀÎ":function(){$("#dialog").dialog("close")}});$("#dialog").html(this.serialize(auth));$("#dialog").dialog("open")}auth.objdate=new Date}return auth};this.getUserInfo=function(){this.getSignature();this.init_sync_object();if(auth.agree=="Y"){syncObject.url="/gamepub/channel/get_user_info.nwz";syncObject.type="POST";syncObject.dataType="json";syncObject.data=auth;eval("var obj = "+$.ajax(syncObject).responseText);if(arguments.length>0&&arguments[0]&&auth.ssn!=333){$("#dialog").dialog({autoOpen:false,
modal:true,resizable:false,width:400,height:350});$("#dialog").dialog("option","buttons",{"È®ÀÎ":function(){$("#dialog").dialog("close")}});$("#dialog").html(this.serialize(obj));$("#dialog").dialog("open")}return obj}else if(auth.age_restricted){$("#dialog").dialog({autoOpen:false,modal:true,resizable:false,width:400,height:350,title:"°ÔÀÓ ÀÌ¿ë Á¦ÇÑ ¾Ë¸²"});$("#dialog").dialog("option","buttons",{"È®ÀÎ":function(){$("#dialog").dialog("close")}});$("#dialog").html("ÇØ´ç °ÔÀÓÀº ¸¸ "+auth.age+"¼¼ ÀÌ»óÀÎ ºÐ¸¸ ÀÌ¿ë °¡´ÉÇÕ´Ï´Ù.");$("#dialog").dialog("open")}else{var url=
$("iframe[height=100%]").get(0).contentWindow.document.location.href;this.doAgreeInbound(url)}};this.getPcbInfo=function(){this.init_sync_object();syncObject.url="/gamepub/channel/get_pcb_info.nwz";syncObject.type="POST";syncObject.dataType="json";syncObject.data={};eval("var obj = "+$.ajax(syncObject).responseText);if(arguments.length>0&&arguments[0]&&auth.ssn!=333){$("#dialog").dialog({autoOpen:false,modal:true,resizable:false,width:400,height:350});$("#dialog").dialog("option","buttons",{"È®ÀÎ":function(){$("#dialog").dialog("close")}});
$("#dialog").html(this.serialize(obj));$("#dialog").dialog("open")}return obj};this.resetAgree=function(){this.getSignature();this.init_sync_object();syncObject.url="/gamepub/channel/get_reset_agree.nwz";syncObject.type="POST";syncObject.dataType="json";syncObject.data=auth;$("#dialog").dialog({autoOpen:false,modal:true,resizable:false,width:400,height:350});$("#dialog").dialog("option","buttons",{"È®ÀÎ":function(){$("#dialog").dialog("close")}});$("#dialog").html($.ajax(syncObject).responseText);$("#dialog").dialog("open")};
this.goInetRealnameConfirm=function(){this.open_win("https://secure.pmang.com/www/check_member_realname_confirm_popup.nwz?from=pmang","_realname_confirm",510,503)};this.doAgreeInbound=function(targeturl){var url="http://"+document.location.hostname+document.location.pathname+"?target="+urlencode(targeturl);this.getSignature();this.setInboundCookie("_AGREE",url,1);document.location.href="http://member.pmang.com/inbound/clause.nwz?game_ssn="+auth.ssn+"&ts="+auth.ts+"&hash="+auth.hash};this.setInboundCookie=
function(name,value,expire){var ExpDate=new Date;ExpDate.setDate(ExpDate.getDate()+expire);document.cookie="__PM_CHIN"+name+"="+escape(value)+"; path=; domain="+document.domain+"; expires="+ExpDate.toGMTString()+";"};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("\\","////").replace("\r","\\r").replace("\n","\\n").replace('"','\\"')+'"';case "undefined":return"{}";default:return String(obj)}}});
