<!--
//document.domain='ntomo.jp';

var pWnd = this;
var pageType = pWnd = top.frames["hiddenFrame"];

function setPageType(newPageType) {
	pageType = newPageType;
	if(pageType=='w') pWnd = top.frames["hiddenFrame"];
	else if(pageType=='m' || pageType=='g') pWnd = parent;
	else if(pageType=='p') pWnd = opener;
	else pWnd = this;
}

function doModal(theURL,iWidth,iHeight) {
	var position = 'unadorned:yes; dialogWidth:' + iWidth + 'px; dialogHeight:' + iHeight + 'px; help:no; resizable:no; status:no; scroll=no;';
	return window.showModalDialog(theURL, window, position);
}

function popMessageWnd(msg, switchWord) {
	var width = 340;
	var height = 200;
	
	// IE6 modal size
	if (typeof document.body.style.maxHeight == "undefined") {
		width = 345;
		height = 240;
	}

	doModal("/jsp/common/pop_Message.jsp?msg="+msg+(typeof(switchWord) != "undefined" ? "&switchWord="+switchWord : ""), width, height);
}

function popConfirmWnd(msg, btType) {
	var width = 340;
	var height = 200;

	// IE6 modal size
	if (typeof document.body.style.maxHeight == "undefined") {
		width = 345;
		height = 240;
	}

	var features = "dialogWidth:"+width+"px;dialogHeight:"+height+"px;" +
		"scroll:no;help:no;status:no;unadorned:yes;";

	return window.showModalDialog("/jsp/common/pop_Confirm.jsp?msg="+msg+(typeof(btType) != "undefined" ? "&btType="+btType : ""),"", features);
}

function logout() {
	if(confirm("ログアウトすると開いてあるチャットウィンドウが全部閉じられます。\nログアウトしますか？")){
		pWnd.document.WebOcx.WEB2OCXCLOSEGUI();
		document.location.href = "/servlet/trid.user.USLogoutEE";
	}
}

// Deny login in other PC(x-client call)
function LogoutORclose(flag)
{
	if(flag > 0)
	{
		if (document.location.href.indexOf("webOcxHidden.jsp") > -1)
		{
			//top.location.href = "/servlet/trid.user.USLogoutEE" + ((typeof(parent.frames['hiddenFrame'])!='undefined')? "" : "?bPop=1");
			top.location.href = "/servlet/trid.user.USLogoutEE";
		}
		else
		{
			top.location.href = "/servlet/trid.user.USLogoutEE?bPop=1";
		}
	}
	else if(flag == 0)
	{
		if(document.location.href.indexOf("MNMainLF") > -1)
			window.close();
	}
}

// login mail address modify process : recieved mail logout
function webLogout2() {
	top.location.href = "/servlet/trid.user.USLogoutEE?bPop=1";
	alert("メールアドレス変更のためログアウトします。");
}

function popWindow(theURL,winName,features) {
 	window.open(theURL,winName,features);
}

function OCX2popWindow(theURL,winName,features) {
	var theURL = theURL.replace("/www.ntomo.jp/","/ntomo.nexon.co.jp/");
 	window.open(theURL,winName,features);
}

// input validation check
function isValidEmail(Email)
{
	var atCount = 0;

	for(var i=0; i<Email.value.length; i++){
		if(Email.value.indexOf(Email.value.substring(i,i+1))<0){
			return false;
		}
		
		if(Email.value.substring(i,i+1) == '@')
		{
			atCount++;
		}
	}

	if (atCount == 1) {
		return true;
	} else {
		return false;
	}
}

// input validation check
function containsCharsOnly(input, addChars) 
{
	var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" + (addChars ? addChars : '');
	for (var i=0; i<input.value.length; i++) 
	{
		if (chars.indexOf(input.value.charAt(i)) < 0) 
			return false;
	}
	return true;
}

String.prototype.replaceAll = function( searchStr, replaceStr )
{
	var temp = this;

	while( temp.indexOf( searchStr ) != -1 )
	{
		temp = temp.replace( searchStr, replaceStr );
	}

	return temp;
}

// cyMoney, cash 1,000 unit comma
function setComma(val)
{
	for(var i=val.length - 3; i>0; i-=3)
		val = val.substring(0,i) + "," + val.substring(i);

	return val;
}

function overDiv(sender)
{
	sender.style.backgroundColor = "#f3f3f3";
}

function outDiv(sender)
{
	sender.style.backgroundColor = "transparent";
}

function autoResize(targetWidth,targetHeight) {
	iWidth = document.documentElement.clientWidth; 
	iHeight = document.documentElement.clientHeight;

	if(iWidth == 0 && iHeight == 0)
	{
		iWidth = document.body.clientWidth;
		iHeight = document.body.clientHeight;
	}

	iWidth = targetWidth - iWidth; 
	iHeight = targetHeight - iHeight; 
	window.resizeBy(iWidth, iHeight); 
}

function checkStrLen(value, length) 
{
	if (value.length*3 > length) {
		return false;
	}
	else {
		return true;
	}
}

function chargeCash( useruuId, userId ) 
{
	
	var url = 'https://pg.ntomo.jp/pg/chargeStep1LF.jsp';
	//var url = 'http://ntomo.nexon.co.jp/nx/pg/chargeStep1LF.jsp';

	//var strParam = '?useruuId=' + useruuId + '&userId=' + userId;
	var strFeature = 'left=50,top=50,width=600,height=600,resizable=yes';
	//popWindow( url + strParam, 'chargeWnd', strFeature);

	var strParam = '?useruuId=' + useruuId + '&userId=' + userId;
	var strFeature = 'left=50,top=50';
	//popWindow( url + strParam, 'chargeWnd', '');
	popWindow( url, 'chargeWnd', strFeature);
	
	//popMessageWnd("NXCM0008");
}

<!-- nexon charge : not use common.js chargeCash method -->
function chargeNexon2NC( useruuId, userId ) 
{
	
	var url = 'http://ntomo.nexon.co.jp/nx/pg/chargeStep1LF.jsp';
	location.href = url;
	
	//popMessageWnd("NXCM0008");	
}

function popChargeMessageWnd(msg, switchWord) {
	var width = 340;
	var height = 200;
	
	// IE6 modal size
	if (typeof document.body.style.maxHeight == "undefined") {
		width = 345;
		height = 240;
	}

	doModal("http://www.ntomo.jp/jsp/common/pop_Message.jsp?msg="+msg+(typeof(switchWord) != "undefined" ? "&switchWord="+switchWord : ""), width, height);
}

function fs_noItem()
{
	popMessageWnd("MPST0012");
	
	if(opener)
	{
		opener.location.reload();
		window.close();
	}
	else
	{
		location.reload();
	}
}

function sleep(gap) {    /* gap is in millisecs */
	var then,now;
	then = new Date().getTime();
	now=then;
	while((now-then)<gap) {
		now = new Date().getTime();
	}
}
