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.trim().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://login.netgame.com/login"; f.dest.value = returnUrl; /* When a page does not completely open in IE, IOVATION cannot detect DEVICEID */ if(isIE()){ if(document.readyState == 'complete'){ return true; }else{ return true; } } return true; } /* * IOVATION FORM COPY 2009/12/02 ADDED */ function copyBlackBox(submit_form,pass) { var bb = document.getElementById( 'ioBlackBox' ); if ( typeof( bb ) == 'undefined' ) return true; if ( bb.value == '' && pass < 6) { setTimeout( "copyBlackBox( null," + (pass + 1) + ");", 500 ); return false; } else { if ( bb.value != '' ) { submit_form.ioBlackBox.value = bb.value; } } 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(dest) { var dest_str = dest ? dest : thisGame(); top.location.href = "http://login.netgame.com/logout/dest/"+ encodeBase64(dest_str); } function netgameIlligalWordsCheck(str, type) { var strReplace; if(type == 'nickname') { strReplace = new RegExp(netgameNickIlligalWords.replace(/[^a-z0-9\\\|]/gi,''),'gim'); } else { 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/sign/find_password.php"; } function netgameNewAccount() { top.location.href = "http://www.netgame.com/login/create.php"; } function netgameAccount(link, data, loginCheck) { if(data == 'undefined' || data == null || data == '') { data = ''; } if(loginCheck) { if(netgameUserCheck()) { error('You already signed in. The menu can be used before you signed in.'); return; } } if(link == 1) { netgameIframeLayer('http://www.netgame.com/sign/create.php?game='+data, 550, 756); } else if(link == 2) { netgameIframeLayer('http://www.netgame.com/sign/user_agreement.php?mode='+data, 550, 753); } else if(link == 3) { netgameIframeLayer('http://www.netgame.com/sign/privacy_policy.php?mode='+data, 550, 753); } else if(link == 4) { netgameIframeLayer('http://www.netgame.com/sign/edit_check.php', 550, 296); } else if(link == 5) { netgameIframeLayer('http://www.netgame.com/sign/rules_of_conduct.php?mode='+data, 550, 753); } } 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 netgameFreeCharge() { if(!netgameUserCheck()) return; netgameIframeLayer('http://bill.netgame.com/authorize/sim/free_charge/free_charge.php', 710, 780); } function netgameStart(gameName) { if(!netgameUserCheck()) return; gameName = gameName ? gameName : thisGame(); try { /* if(gameName == 'fate' || gameName == 'hero' || gameName == 'cloudnine' || gameName == 'op7') { game_run.location.href = '/launch/'+gameName; } else { game_run.location.href = "/launch/launch_"+ gameName +".php"; } */ game_run.location.href = '/launch/'+gameName; } 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) { if(parseInt(idx) > 2) { 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; case 5 : filePath = "http://www.netgame.com/partner/partner.php"; break; case 6 : filePath = "http://www.netgame.com/recruit/recruit.php"; break; default : filePath += "rules.php"; break; } top.location.href = filePath; } else { if(parseInt(idx) == 0) { netgameIframeLayer('http://www.netgame.com/sign/rules_of_conduct.php', 550, 753); } else if(parseInt(idx) == 1) { netgameIframeLayer('http://www.netgame.com/sign/user_agreement.php', 550, 753); } else if(parseInt(idx) == 2) { netgameIframeLayer('http://www.netgame.com/sign/privacy_policy.php', 550, 753); } } } 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, type, url) { if(flag == 2) { var w = w ? parseInt(w+10) : 360; var h = h ? parseInt(h+38) : 194; } else { var w = 360; var h = flag ? 220 : 194; } var subURI = ''; if(typeof(type) != 'undefined' && type != null) { if(type.trim().length > 0) { subURI = '&type='+type; } } if(typeof(url) != 'undefined' && url != null) { if(url.trim().length > 0) { subURI += '&url='+url; } } var position = netgameLayerPosition(w,h); netgameLayerShow(); var html = ''; document.getElementById('divNetgameLayer').innerHTML = html; } /** * Show Iframe Layer Function * * @param url Iframe URL * @param w Layer Width * @param h Layer Height * @return */ function netgameIframeLayer(url, w, h) { // var w = w ? parseInt(w+10) : 500; // var h = h ? parseInt(h+38) : 500; 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;'; var left_value = Math.ceil((cWidth-w)/2); var top_value = Math.ceil((cHeight-h)/2+sScroll); if(left_value < 10) left_value = 10; if(top_value < 10) top_value = 10; obj.style.left = left_value + 'px'; obj.style.top = top_value + 'px'; } function netgameLayerShow() { try { var divName = ['divNetgameLayer','divNetgameLayerBg']; } catch(ex) { error('maintenance not found'); return; } var obj; for(var i=0;i=7)); //alert(true); if(is_ie)if(is_ie7)return; if (on) { 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'; netgameIframeLayer('http://www.netgame.com/sign/edit_check.php', 550, 296); return; } else if(type == 'customer') { url = 'http://www.netgame.com/help/customer.php?cate='+game; } location.href=url; } } function netgameCustomerService(game) { if(netgameUserCheck()) { url = 'http://www.netgame.com/help/customer.php?cate='+game; location.href=url; } else { error(); } } function netgameFAQ(cate) { if(netgameUserCheck()) { location.href = 'http://www.netgame.com/help/faq.php?cate='+cate; } else { error(); } } //scroll layer function netgameLayerMoving(target, position, topLimit, btmLimit) { if (!target) return false; var obj = target; obj.initTop = position; obj.topLimit = topLimit; obj.bottomLimit = document.documentElement.scrollHeight - btmLimit; obj.style.position = "absolute"; obj.top = obj.initTop; obj.left = obj.initLeft; if (typeof(window.pageYOffset) == "number") { obj.getTop = function() { return window.pageYOffset; } } else if (typeof(document.documentElement.scrollTop) == "number") { obj.getTop = function() { return document.documentElement.scrollTop; } } else { obj.getTop = function() { return 0; } } if (self.innerHeight) { obj.getHeight = function() { return self.innerHeight; } } else if(document.documentElement.clientHeight) { obj.getHeight = function() { return document.documentElement.clientHeight; } } else { obj.getHeight = function() { return 500; } } obj.move = setInterval(function() { if (obj.initTop > 0) { pos = obj.getTop() + obj.initTop; } else { pos = obj.getTop() + obj.getHeight() + obj.initTop; //pos = obj.getTop() + obj.getHeight() / 2 - 15; } if (pos > obj.bottomLimit) pos = obj.bottomLimit; if (pos < obj.topLimit) pos = obj.topLimit; interval = obj.top - pos; obj.top = obj.top - interval / 3; obj.style.top = obj.top + "px"; }, 30) }