
	document.write('<link rel="stylesheet" type="text/css" href="http://www.mgame.jp/profile/css/profile.css"/>');
	document.write('<link rel="stylesheet" type="text/css" href="http://www.mgame.jp/profile/css/profile_top.css"/>');


	document.write('<script type="text/javascript" language="javascript" src="/lib_js/mjscript.js"></script>');
	document.write('<div id="profile_login">');
	document.write('	<h3 class="profile_aid">ログイン</h3>');
	document.write('	<form method="post" name="profile_login" onsubmit="return checkProfileLogin();">');
	document.write('		<input type="hidden" name="arr" value="" />');
	document.write('		<input type="hidden" name="dest" value="d3d3Lm1nYW1lLmpwLw==" />');
	document.write('		<input type="hidden" name="game" value="PORTAL" />');
	document.write('		<div class="input_box">');
	document.write('			<span class="profile_aid">ID: </span><input type="text" name="userid" tabindex="1" id="profile_userid" maxlength="30" size="20" value="" />');
	document.write('			<span class="profile_aid">Password: </span><input type="password" name="pw" tabindex="2" id="profile_pw" maxlength="16" size="20" autocomplete="off" />');
	document.write('		</div>');
	document.write('		<div class="check_box">');
	document.write('			<input type="checkbox" name="saveid" value="Y"  /> 次回からIDの入力を省略');
	document.write('			<input type="checkbox" name="ssl" value="checkbox" checked /> 暗号化ログイン');
	document.write('		</div>');
	document.write('		<input type="submit" class="profile_aid" value="ログイン" />');
	document.write('		<a href="#" onclick="return goProfileLogin();" title="ログイン"></a>');
	document.write('	</form>');
	document.write('	<div class="yahoo_box">');
	document.write('		<img src="http://i.yimg.jp/images/login/bbauth/Ymark.gif" width="27" height="13" alt="Yahoo! JAPAN" border="0" style="vertical-align:middle;margin-right:3px;">');
	document.write('		<a href="#" onclick="yahoo_login(\'d3d3Lm1nYW1lLmpwLw==\');return false;">Yahoo! JAPAN ID でログイン</a>');
	document.write('	</div>');
	document.write('	<div class="fuji_box">');
	document.write('		<a href="#" onclick="fuji_login(\'d3d3Lm1nYW1lLmpw\');return false;">フジテレビ ID でログイン</a>');
	document.write('	</div>');
	document.write('	<a href="http://www.mgame.jp/remind_pass.html" class="find_idpw" title="ID/パスワードを忘れた方">ID/パスワードを忘れた方</a><span class="profile_aid">|</span>');
	document.write('	<a href="http://www.mgame.jp/regist/" class="regist_member" title="無料会員登録">無料会員登録</a>');
	document.write('</div>');

	function fuji_login(dest){
		document.cookie = "login_dest=" + escape(dest) + "; Domain=.mgame.jp; path=/";
		document.cookie = "login_Coop=FUJITV; Domain=.mgame.jp; path=/";
		location.href="https://wwws.fujitv.co.jp/safe/red_mpl/game/affiliate/gw.cgi?CID=mgame";
	}
	
	function left_checkIsZenkaku(value) {
		var form = document.forms['profile_login'];
		var arrtemp = new Array;
		var j;
		j = 0;
		for (var i = 0; i < value.length; i++) {
			var c = value.charCodeAt(i); 
			arrtemp[j] = value.substring(j,j+1);
			j++;
			if(i==0&&c==45){
				alert('');
				return false;	
			}
		}
		form.arr.value = arrtemp;
		return true;
	}
	function fn_left_login_form_submit() {
		var form = document.forms['profile_login'];
		var rtn;
		form.userid.value = chg_jun_ban(form.userid.value);
		rtn = left_checkIsZenkaku(form.userid.value);
		if(!rtn){
			form.userid.focus();
			return false;	
		}
		if(form.userid.value.length==0){
			alert("IDを入力してください。");
			form.userid.focus();
			return false;
		}
		for(var nBytes=0,i=0; i<form.userid.value.length; i++) {
			nBytes += ( form.userid.value.charCodeAt(i)>128 ) ? 2 : 1;
		}
		if(nBytes < 4 || nBytes > 12 || (form.userid.value.match(/\S+/) != form.userid.value) ){
			alert('ＩＤはアルファベットと数字使用の場合は半角で4〜12字、ひらがな、\nカタカナ、漢字使用の場合は全角で2〜6字で入力してください。');
			form.userid.focus();
			return false;
		}
		if(form.pw.value.length==0){
			alert("パスワードを入力してください。");
			form.pw.focus();
			return false;
		}
		if(form.pw.value.length>16){
			alert("パスワードは最長16文字まで可?です。");
			form.pw.focus();
			return false;
		}
		return true;
	}
	function checkProfileLogin() {
		var form = document.forms['profile_login'];
		if (fn_left_login_form_submit()){
			var ssl_chk = form.ssl.checked;
			if(ssl_chk==true){
				form.action="https://login.mgame.jp/plogin_process.php";
			}else{
				form.action="http://www.mgame.jp/member/plogin_process.php";
			}
			return true;
		}
		return false;
	}
	function goProfileLogin() {
		var form = document.forms['profile_login'];
		if (checkProfileLogin()) form.submit();
		return false;
	}
	function yahoo_login(dest){
		window.location.href = "https://login.mgame.jp/yahoo/yahoo_login.php?dest="+dest;
	}
	
	addEvent( window, 'onload', function() { document.forms['profile_login'].userid.focus(); }, false );
				

	function addEvent (obj, evt, func, capture) {
		if (!obj) return;
		if (obj.attachEvent) { obj.attachEvent(evt, func); }
		else if (obj.addEventListener) {
			if (!capture) capture=false;
			evt = evt.replace(/^on/i,'');
			obj.addEventListener(evt, func, capture);
		}else{ obj[evt] = fnc; }
		return;
	}
