
	function isLogin() {
		return false;
	}

	function requireLogin() {
		if (isLogin()) return true;
		layerPopup.closeFunction = null;
		layerPopup.open('/square/member/login.html', 554, 291);
		return false;
	}

	function goMgameLogout() {
		top.location.href = 'http://www.mgame.jp/member/logout.php?return_URL=http%3A%2F%2Flunatia.mgame.jp%2F';
		return false;
	}

	function refreshProfile() {
		return false;
	}

	function goMyProfileInfo() {
		top.location.href = '/square/member/change_profile.html';
		return false;
	}

	function scrollPageTop() {
		window.scrollTo(0,0);
		return false;
	}

	function openBugReport() {
		if (requireLogin()) {
			layerPopup.closeFunction = null;
			layerPopup.open('/square/member/bug_report.html', 500, 661);
		}
		return false;
	}
	
	function showPopProfile(key, e) {
		var layer1	= document.getElementById('div_mya_profile_window');
		var layer2	= document.getElementById('div_mya_profile_window_closed');
		var event	= ( (window.event) ? window.event : e );
		var obj		= ( (window.event) ? window.event.srcElement : e.target );
		var posx, posy;
		if (event.pageX || event.pageY) {
			posx = event.pageX;
			posy = event.pageY;
		}else if (event.clientX || event.clientY) {
			posx = event.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
			posy = event.clientY + document.body.scrollTop + document.documentElement.scrollTop;
		}
		if (layer1) {
			layer1.style.display	= 'none';
			layer1.style.left		= posx.toString() + 'px';
			layer1.style.top		= (posy + 10).toString() + 'px';
		}
		if (layer2) {
			layer2.style.display	= 'none';
			layer2.style.left		= posx.toString() + 'px';
			layer2.style.top		= (posy + 10).toString() + 'px';
		}
		f_executeXHRequest('get', '/square/member/proc_profile_info.php?user='+ key.toString(), true, null, showPopProfileEnd, null);
		return false;
	}

	function showPopProfileEnd(xmlHttp) {
		if ( xmlHttp ) {
			var root	= xmlHttp.responseXML.documentElement;
			if (!root) {
				showPopProfileClosed();
				return false;
			}
			if (!root.hasChildNodes()) {
				showPopProfileClosed();
				return false;
			}
			var user		= root.getElementsByTagName('user')[0].firstChild.nodeValue;
			var nickname	= root.getElementsByTagName('nickname')[0].firstChild.nodeValue;
			var minimail	= root.getElementsByTagName('minimail')[0].firstChild.nodeValue;
			try { var degree_name	= root.getElementsByTagName('degree_name')[0].firstChild.nodeValue;	}catch(e){ var degree_name = ''; }
			try { var degree_rare	= root.getElementsByTagName('degree_rare')[0].firstChild.nodeValue;	}catch(e){ var degree_rare = ''; }
			try { var sex			= root.getElementsByTagName('sex')[0].firstChild.nodeValue;			}catch(e){ var sex = ''; }
			try { var level			= root.getElementsByTagName('level')[0].firstChild.nodeValue;		}catch(e){ var level = ''; }
			try { var point			= root.getElementsByTagName('point')[0].firstChild.nodeValue;		}catch(e){ var point = ''; }
			try { var comment		= root.getElementsByTagName('comment')[0].firstChild.nodeValue;		}catch(e){ var comment = ''; }
			var form = document.forms['frm_mya_profile_window_minimail'];
			if (form) form.vc_rec_nick.value	= nickname;
			if (form) form.vc_rec_nid.value		= minimail;
			document.getElementById('div_mya_profile_window_mya').innerHTML
				= GetPersonalAvatarFlash("http://image.mgame.jp/mya/AVATAR_EDITVIEW/","view_07","&bgcolor=%23FFFFFF&allowscriptaccess=always&width=70&height=105","&nid="+user);
			document.getElementById('a_mya_profile_window_blog').href			= 'http://blog.mgame.jp/' + nickname;
			document.getElementById('div_mya_profile_window_degree').className	= ((degree_rare=='1') ? 'mya_win_usr_title_rare' : 'mya_win_usr_title');
			document.getElementById('div_mya_profile_window_degree').innerHTML	= degree_name;
			document.getElementById('td_mya_profile_window_nickname').innerHTML	= nickname + ' さん';
			document.getElementById('div_mya_profile_window_sex').innerHTML		= sex;
			document.getElementById('div_mya_profile_window_level').innerHTML	= level;
			document.getElementById('div_mya_profile_window_hp').innerHTML		= parseInt(point).comma3();
			document.getElementById('div_mya_profile_window_comment').innerHTML	= comment;
			xmlHttp = root = null;
			var layer	= document.getElementById('div_mya_profile_window');
			if (layer) layer.style.display = 'block';
		}
	}

	function showPopProfileClosed() {
		var layer	= document.getElementById('div_mya_profile_window_closed');
		if (layer) layer.style.display = 'block';
	}

	function sendPopupProfileMinimail() {
		if (!requireLogin()) return false;
		var form = document.forms['frm_mya_profile_window_minimail'];
		if (form) {
			//form.action = 'http://minimail.mgame.jp/mail_send.html';
			form.action = 'http://minimail.mgame.jp/mail_send.html';
			if ((form.vc_rec_nick.value.length > 0) && (form.vc_rec_nid.value.length > 0)) form.submit();
		}
		return false;
	}

	function hidePopProfile() {
		var layer1	= document.getElementById('div_mya_profile_window');
		var layer2	= document.getElementById('div_mya_profile_window_closed');
		if (layer1) layer1.style.display = 'none';
		if (layer2) layer2.style.display = 'none';
		return false;
	}
	
	function insertTableTd() {
		var objParams	= arguments;
		var objNewTD	= document.createElement('TD');
		for (var i=0; i<objParams.length; i=i+2) {
			if (objParams.length >= (i+2)) {
				if (objParams[i].toLowerCase() == 'class') {
					objNewTD.className = objParams[i+1];
				}else if (objParams[i].toLowerCase() == 'html') {
					objNewTD.innerHTML = objParams[i+1];
				}else{
					objNewTD.setAttribute(objParams[i], objParams[i+1]);
				}		
			}
		}
		return objNewTD;
	}


	var userNotifyCount = 0;

	function getUserNotify() {
		f_executeXHRequest('get', '/square/member/proc_user_notify.php', true, null, getUserNotifyEnd, null);
	}

	function getUserNotifyEnd(xmlHttp) {
		if ( xmlHttp ) {
			var root	= xmlHttp.responseXML.documentElement;
			if (!root)	return false;
			if (!root.hasChildNodes()) return false;
			var msgs = root.getElementsByTagName('msg');
			if (msgs.length > 0) {
				for (var i=0; i<msgs.length; i++) {
					showUserNotify( msgs[i].firstChild.nodeValue );
				}
			}
			xmlHttp = root = null;
		}
		return false;
	}
	
	function showUserNotify(msg) {
		var seq		= userNotifyCount++;
		var thisId	= 'divUserNotify_' + seq.toString();
		var notifyWin	= document.createElement('DIV');
		notifyWin.setAttribute('id', thisId);
		notifyWin.className			= 'sys_mini_window';
		notifyWin.style.visibility	= 'hidden';
		notifyWin.style.zIndex		= 10000 + seq;
		notifyWin.innerHTML			= '<div class="txt_mini_win">'+ msg +'</div><a class="btn_close_mini img_css" href="#" onClick="return closeUserNotify(\''+ thisId +'\')">このウインドウを閉じる</a>';
		notifyWin.style.position	= (LPlib.is_ie && !LPlib.is_ie7_2) ? 'absolute' : 'fixed';
		document.body.appendChild(notifyWin);

		notifyWin.setAttribute('targetTop', (seq*20) );
		if (LPlib.is_ie && (!LPlib.is_ie7_2)) {
			notifyWin.style.top		= (LPlib.body().scrollTop + LPlib.body().clientHeight - (seq*20)).toString() + 'px' ;
			notifyWin.style.setExpression('left',	'LPlib.body().scrollLeft + LPlib.body().clientWidth - 250' );
		}else{
			notifyWin.style.right	= '0px';
			notifyWin.style.bottom	= (seq*20).toString() + 'px';
		}
		notifyWin.style.height = '0px';
		notifyWin.style.visibility	= 'visible';
		moveUserNotify(seq);
	}

	function moveUserNotify(seq) {
		var step = 20;
		var notifyWin = document.getElementById('divUserNotify_' + seq.toString());
		if (!notifyWin) return;
		var curHeight	= parseInt(f_getStyle(notifyWin, 'height'));
		var nextHeight	= ((curHeight+step) > 140) ? 140 : (curHeight+step);
		if (LPlib.is_ie && (!LPlib.is_ie7_2)) {
			notifyWin.style.top		= (LPlib.body().scrollTop + LPlib.body().clientHeight - nextHeight - (seq*20)).toString() + 'px' ;
		}
		notifyWin.style.height = nextHeight.toString() + 'px';
		if (nextHeight < 140) {
			setTimeout( 'moveUserNotify('+ seq.toString() +')', 50 );
		}else{
			if (LPlib.is_ie && (!LPlib.is_ie7_2)) {
				notifyWin.style.setExpression('top',	'LPlib.body().scrollTop + LPlib.body().clientHeight - 140 - ' + (seq*20).toString() );
			}
		}
	}

	function closeUserNotify(id) {
		var obj = document.getElementById(id);
		if (obj) obj.style.visibility	= 'hidden';
		return false;
	}
