try { document.domain = location.host.substr(location.host.indexOf(".")+1); } catch(e) { } var netgamePopupObject; var thisUri = location.href.replace("http://"+ location.host,"").split("/"); var thisHost = location.host.split("."); var thisDomain = thisHost[1]; function netgameLoginCheck(f,dest) { var returnUrl = encodeBase64(dest ? dest : top.location.href); var idReplace = f.userid.value.replace(/[^a-zA-Z0-9_\-]/gi,""); var idLength = f.userid.value.length; var pwReplace = f.pw.value.replace(/[^a-zA-Z0-9]/gi,""); var pwLength = f.pw.value.length; //로그인은 가능. if(!f.userid.value.trim()) { error("Please enter your ID."); f.userid.focus(); return false; } if(idLength < 4 || idLength > 12) { error("ID should be between 4-12 characters"); f.userid.focus(); return false; } /* if(f.userid.value != idReplace) { error("ID should be between 4-12 characters and may contain only a-z, 0-9 and '_' or '-'."); f.userid.focus(); return false; } */ if(!f.pw.value.trim()) { error("Please enter your password."); f.pw.focus(); return false; } /* if(f.pw.value != pwReplace) { error("Certain symbols may not be used in creating the password."); f.pw.focus(); return false; }*/ f.action = "http://www.netgame.com/login/login_action.php?dest="+ returnUrl; /* When a page does not completely open in IE, IOVATION cannot detect DEVICEID */ if(isIE()){ if(document.readyState == 'complete'){ return true; }else{ return false; } } return true; } function netgameUserCheck(opt) { if(!getCookie("MGUSA")) { error("Please use it after you sign in."); return false; } return true; } function netgameUserModify() { if(!netgameUserCheck()) return; top.location.href = "http://www.netgame.com/account/setting.php"; } function netgameNcash() { if(!netgameUserCheck()) return; top.location.href = "http://www.netgame.com/account/ncash.php"; } function netgameUserNcash() { if(!netgameUserCheck()) return; top.location.href = "http://www.netgame.com/account/usage.php"; } function netgameUserManage(nick) { if(!netgameUserCheck()) return; // top.location.href = "http://profile.netgame.com/"+nick+"/preview/profile.php"; top.location.href = "http://www.netgame.com/account/profile.php"; /* if(!nick) { top.location.href = "http://www.netgame.com/account/profile.php"; return; } top.location.href = "http://profile.netgame.com/"+nick+"/preview/profile_edit.php"; */ } function netgameLogout() { top.location.href = "http://www.netgame.com/login/logout.php?dest="+ thisGame(); } function netgameIlligalWordsCheck(str) { var strReplace = new RegExp(netgameIlligalWords.replace(/[^a-z0-9\\\|]/gi,''),'gim'); var strNew = str.replace(strReplace,function($0) { return $0.replace(/[a-z0-9]/gi,'*'); }); if(str != strNew) error('We have detected inappropriate word.'); return strNew; } function netgameFindId() { top.location.href = "http://www.netgame.com/login/fid.php"; } function netgameFindPassword() { top.location.href = "http://www.netgame.com/login/fpasswd.php"; } function netgameNewAccount() { top.location.href = "http://www.netgame.com/login/create.php"; } function netgameCoupon() { if(!netgameUserCheck()) return; top.location.href = "http://www.netgame.com/account/coupon.php"; } function netgameEmailGuide() { top.location.href = "http://www.netgame.com/email/guide.php"; } function netgameStart(gameName) { if(!netgameUserCheck()) return; gameName = gameName ? gameName : thisGame(); try { game_run.location.href = "/launch/launch_"+ gameName +".php"; } catch(e) { var obj = document.createElement("iframe"); obj.setAttribute("id","game_run"); obj.setAttribute("name","game_run"); obj.setAttribute("width","0"); obj.setAttribute("height","0"); document.body.appendChild(obj); netgameStart(gameName); } } function netgameImageView(obj) { netgamePopup("http://www.netgame.com/lib/popup_image.php?imgUrl="+ obj); } function netgamePopup(param,w,h, scrollbars, location) { var popupWidth = w ? w : 50; var popupHeight = h ? h : 50; var popupScrollbars = scrollbars ? scrollbars : 'no'; var popupLocation = location ? location : 'no'; netgamePopupObject = window.open(param,"netgamePopup","width="+ popupWidth +",height="+ popupHeight +",top=0,left=0,scrollbars="+popupScrollbars+",location="+popupLocation); } function netgameRollOver() { if (!document.getElementById) return var aPreLoad = new Array(); var sTempSrc; var aImages = document.getElementsByTagName('img'); for (var i = 0; i < aImages.length; i++) { if (aImages[i].className == 'imgover') { var src = aImages[i].getAttribute('src'); var ftype = src.substring(src.lastIndexOf('.'), src.length); var hsrc = src.replace(ftype, '_on'+ftype); aImages[i].setAttribute('hsrc', hsrc); aPreLoad[i] = new Image(); aPreLoad[i].src = hsrc; aImages[i].onmouseover = function() { sTempSrc = this.getAttribute('src'); this.setAttribute('src', this.getAttribute('hsrc')); } aImages[i].onmouseout = function() { if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_on'+ftype, ftype); this.setAttribute('src', sTempSrc); } } } } function netgameFlash(flashUrl,flashWidth,flashHeight,flashDiv) { var flashPath,flashVars; var classId = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"; var codeBase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"; var pluginsPage = "application/x-shockwave-flash"; var embedType = "application/x-shockwave-flash"; var pluginsPage = "http://www.macromedia.com/go/getflashplayer"; var flashHtml = ""; flashHtml += ''; flashHtml += ' '; flashHtml += ' '; flashHtml += ' '; flashHtml += ' '; flashHtml += ' '; flashHtml += ''; if(flashDiv) { document.getElementById(flashDiv).innerHTML = flashHtml; } else { document.write(flashHtml); } } function netgameMovie(movieUrl,movieWidth,movieHeight,movieDiv,movieUI,moviePlay) { var classId = "clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6"; var playUI = movieUI ? "full" : "none"; var playMode = moviePlay ? "false" : "true"; var movieHtml = ""; movieHtml += ''; movieHtml += ' '; movieHtml += ' '; movieHtml += ' '; movieHtml += ' '; movieHtml += ' '; movieHtml += ' '; movieHtml += ' '; movieHtml += ' '; movieHtml += ' '; movieHtml += ' '; movieHtml += ''; if(movieDiv) { document.getElementById(movieDiv).innerHTML = movieHtml; } else { document.write(movieHtml); } } function netgameFooter(idx) { var filePath = "http://www.netgame.com/company/"; switch(parseInt(idx)) { case 1 : filePath += "agreement.php"; break; case 2 : filePath += "policy.php"; break; case 4 : filePath += "recruit.php"; break; default : filePath += "rules.php"; break; } top.location.href = filePath; } function iframeResize(ifrm) { if(ifrm) { ifrm.height = isXHTML(ifrm.contentWindow) ? ifrm.contentWindow.document.documentElement.scrollHeight : ifrm.contentWindow.document.body.scrollHeight; } else { var obj = parent.document.getElementsByTagName('iframe')[window.name]; obj.style.height = isXHTML() ? document.documentElement.scrollHeight +'px' : document.body.scrollHeight; } } function if_Resize(td,iframe) { td = td ? td : 'resizeTd'; iframe = iframe ? iframe : 'content'; var obj = document.getElementById(td); var ifrm = document.getElementById(iframe); //var ifrm = obj.getElementsByTagName('iframe')[0].contentWindow; obj.style.height = Math.max(ifrm.document.documentElement.scrollHeight,ifrm.document.body.scrollHeight) +'px'; ifrm.height = Math.max(ifrm.document.documentElement.scrollHeight,ifrm.document.body.scrollHeight) +'px'; document.body.scrollTop = 0; } function ajaxCreate() { var xmlHttp; if(window.ActiveXObject) { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } else if(window.XMLHttpRequest) { xmlHttp = new XMLHttpRequest(); } return xmlHttp; } function ajaxRequest(div,actionfile,param,xml) { var ajax = ajaxCreate(); ajax.open(param ? "POST" : "GET",actionfile,false); ajax.setRequestHeader("content-type","application/x-www-form-urlencoded"); ajax.send(param ? param : null); if(ajax == null){ alert("AJAX NOT SUPPORT."); history.back(); } if(xml) { eval(div+"(ajax)"); } else { if(div) { document.getElementById(div).innerHTML = ajax.responseText; } else { return ajax.responseText; } } } function isIE() { return (navigator.appName == "Microsoft Internet Explorer") ? true : false; } function isIE7() { var flag = false; var arrVerStr = window.navigator.appVersion.split("; "); if(arrVerStr.length >= 4) { var arrIEVer = arrVerStr[1].split(" "); if(arrIEVer[1] >= 7.0) { flag = true; } } return flag; } function windowVersion() { var osVerNum = 5.1; var arrVerStr = window.navigator.appVersion.split('; '); if( arrVerStr.length >= 4 ) { var arrOsVer = arrVerStr[2].split(' '); if( arrOsVer.length >= 3) { var osVerNum = new Number(arrOsVer[2]); } } return osVerNum; } function winResize() { var Dwidth = parseInt(Math.max(document.body.scrollWidth,document.documentElement.scrollWidth)); var Dheight = parseInt(Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)); var divEl = document.createElement("div"); divEl.style.position = "absolute"; divEl.style.left = "0px"; divEl.style.top = "0px"; divEl.style.width = "100%"; divEl.style.height = "100%"; document.body.appendChild(divEl); window.resizeBy(Dwidth-divEl.offsetWidth,Dheight-divEl.offsetHeight); document.body.removeChild(divEl); } function imageResize(obj,size) { if(!size) { obj.width = "100%"; } else { if(w=eval(obj.width) > size) obj.width = size; } } function addEvent(ev,fnc,obj) { obj = obj ? obj : window; if(isIE()) { obj.attachEvent(ev,fnc); } else { obj.addEventListener(ev.replace("on",""),fnc,false); } } function thisGame() { var gameName; var thisUri = top.location.host.split("."); if(thisUri[0].substr(0,2) == "mg") { gameName = thisUri[0].substr(2); } else if(thisUri[0].substr(thisUri[0].length-4) == "test") { gameName = thisUri[0].substr(0,thisUri[0].length-4); } else { gameName = thisUri[0]; } return gameName; } function thisName() { var thisHref = location.href.split("/"); var thisReFile = thisHref[thisHref.length-1].replace(/(\?(.)*)/gi,""); var thisLocate = thisReFile.split("."); return thisLocate[0].replace(/(_(.)*)/gi,""); } function thisFile(a) { var thisHref = location.href.split("/"); var thisReFile = thisHref[thisHref.length-1].replace(/(\?(.)*)/gi,""); var thisLocate = thisReFile.split("."); var thisName = thisLocate[0].replace(/(_(.)*)/gi,""); return a ? thisName + "_" + a +"."+thisLocate[1] : thisName + "."+thisLocate[1]; } function sortLink(v) { var f = document.procForm; f.sort.value = v; f.submit(); } function copyLink(v) { try { var copyPath = copyUrl; } catch(e) { var copyPath = location.href +"?idx="+ v; } clipboardData.setData("Text",copyPath); error("It is successfully saved."); } function writeLink() { if(!netgameUserCheck()) return; var p = document.procForm; if(p && p.mode) { p.mode.value = 'write'; } p.action = thisFile("write"); p.submit(); } function recomLink() { if(!netgameUserCheck()) return; var p = document.procForm; p.mode.value = "recom"; p.action = thisFile("proc"); p.submit(); } function viewLink(idx,a) { var p = document.procForm; p.idx.value = idx; if(a) { p.action = a; } else { try { p.action = procAction; } catch(e) { p.action = thisFile("view"); } } p.submit(); } function pageLink(page) { var p = document.procForm; p.page.value = page; p.submit(); } function listLink() { var p = document.procForm; p.action = thisFile(); p.submit(); } function modeLink(m) { if(!netgameUserCheck()) return; var p = document.procForm; p.mode.value = m; p.action = thisFile("proc"); p.submit(); } function deleteLink() { if(!netgameUserCheck()) return; if(!error("Do you want to delete?",true)) { return; } var p = document.procForm; p.mode.value = "delete"; p.action = thisFile("proc"); p.method = 'post'; p.submit(); } function editLink() { if(!netgameUserCheck()) return; var p = document.procForm; p.mode.value = "edit"; p.action = thisFile("write"); p.submit(); } function ajaxProc() { try { var cAction = ajaxAction; } catch(e) { var cAction = thisFile("comment"); } return cAction; } function ajaxResize() { try { if_Resize2(); } catch(e) { } } function ajaxId() { try { var div = ajaxDiv; } catch(e) { var div = "divAjax"; } return div; } function ajaxVariable() { try { var query = ajaxQuery; } catch(e) { var query = ""; } return query; } function ajaxPage(page, focus) { ajaxRequest(ajaxId(), ajaxProc(), ajaxVariable() + "&page=" + ((typeof page == 'undefined') ? 1 : page)); ajaxResize(); try { if(focus && focus == "no") {} else { document.commentForm.comment.focus(); document.commentForm.comment.blur(); } } catch(ex) {} } function commentWrite() { if(!netgameUserCheck()) return; var f = document.commentForm; f.comment.value = netgameIlligalWordsCheck(f.comment.value); if(!f.comment.value.trim()) { error("Please type the comment."); f.comment.focus(); return; } ajaxRequest(ajaxId(),ajaxProc(),ajaxVariable() +"&mode=write&comment="+ encodeURIComponent(f.comment.value)); f.reset(); ajaxResize(); } function commentDelete(idx) { if(!netgameUserCheck()) return; if(!error("Do you want to delete?",1)) return; ajaxRequest(ajaxId(),ajaxProc(),ajaxVariable() +"&mode=delete&idx="+ idx); ajaxResize(); } String.prototype.trim = function() { return this.replace(/(^[ \f\n\r\t]*)|([ \f\n\r\t]*$)/g, ""); } String.prototype.numberFormat = function() { return this.replace(/(\d)(?=(?:\d{3})+(?!\d))/g,'$1,'); } String.prototype.cut = function(len) { var str = this; var l = 0; for(var i=0;i 128) ? 2 : 1; if(l > len) return str.substring(0,i) + ".."; } return str; } function error(msg,opt) { if(!msg) { msg = "Please use it after you sign in."; } if(typeof(opt) != "undefined") { return confirm(msg); } else { try { netgameLayer(msg); } catch(ex) { alert(msg); } } } function setCookie(name, value, expiredays) { var expire_date = new Date(); expire_date.setDate(expire_date.getDate() + expiredays ); document.cookie = name + "=" + escape( value ) + "; expires=" + expire_date.toGMTString() + "; path=/; domain="+ document.domain; } function getCookie(name) { var nameOfCookie = name + "="; var x = 0; while(x <= document.cookie.length) { var y = (x+nameOfCookie.length); if(document.cookie.substring(x,y) == nameOfCookie) { if((endOfCookie = document.cookie.indexOf(";",y)) == -1) { endOfCookie = document.cookie.length; } return unescape( document.cookie.substring(y,endOfCookie)); } x = document.cookie.indexOf(" ",x) + 1; if(x == 0) break; } return ""; } function encodeBase64(what) { var encodeTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var result = ""; var len = what.length; var x,y; var ptr = 0; while(len-- > 0) { x = what.charCodeAt(ptr++); result += encodeTable.charAt((x >> 2) & 63); if(len-- <= 0) { result += encodeTable.charAt((x << 4) & 63); result += "=="; break; } y = what.charCodeAt(ptr++); result += encodeTable.charAt(((x << 4) | ((y >> 4) & 15)) & 63); if(len-- <= 0) { result += encodeTable.charAt((y << 2) & 63); result += "="; break; } x = what.charCodeAt(ptr++); result += encodeTable.charAt( ( ( y << 2 ) | ( ( x >> 6 ) & 3 ) ) & 63 ); result += encodeTable.charAt( x & 63 ); } return result; } function netgameLayer(msg,w,h,flag) { if(flag == 2) { var w = w ? parseInt(w+10) : 290; var h = h ? parseInt(h+38) : 380; } else { var w = 290; var h = flag ? 380 : 200; } var position = netgameLayerPosition(w,h); netgameLayerShow(); var html = ''; document.getElementById('divNetgameLayer').innerHTML = html; } function netgameLayerPosition(w,h) { if(!document.getElementById('divNetgameLayer')) { var divNew; var divName = ['divNetgameLayer','divNetgameLayerBg']; for(var i=0;i sHeight) ? cHeight : sHeight)+'px;z-index:1165;background:#000;filter:alpha(opacity=75);opacity:0.75;-moz-opacity:0.75;'; obj.style.cssText = 'margin:0;padding:0;position:absolute;z-index:6244;'; obj.style.left = Math.ceil((cWidth-w)/2) +'px'; obj.style.top = Math.ceil((cHeight-h)/2+sScroll) +'px'; } function netgameLayerShow() { try { var divName = ['divNetgameLayer','divNetgameLayerBg']; } catch(ex) { error('maintenance not found'); return; } var obj; for(var i=0;i'; document.getElementById('divNetgameLayer').innerHTML = html; if(bool == 'check') { return false; } } else { var url = ''; if(type == 'account') { url = 'http://www.netgame.com/account/setting.php'; } else if(type == 'customer') { url = 'http://www.netgame.com/help/inquiry.php?game='+game; } location.href=url; } }