<%@ page language="java"
	contentType="text/html;charset=Shift_JIS"
	import="java.util.*,java.io.*,openolap.viewer.common.Messages"
%>
<%

	String loginErrorMessage = "";
	if ( (request.getAttribute("loginResult") != null) && 
         (request.getAttribute("loginResult").equals("failed")) ) {
		loginErrorMessage = Messages.getString("loginJSP.loginFailMSG");

	}

%>

<html>
<head>
	<title>OpenOLAP Viewer</title>
	<meta http-equiv="Content-Type" content="text/html">
	<script type="text/javascript" src="./spread/js/spreadFunc.js"></script>
	<link rel="stylesheet" href="css/common.css" type="text/css">
		<style type="text/css">
	<!--
		body {
			background-image : url("images/bg.gif");
			text-align : center;
		}
		
		th,td{
			color : navy;
		}
		th {
			text-align : right;
		}
		
		td {
			padding-left : 20px;
		}

		/* Button Login*/
		input.normal_login, input.up_login, input.out_login{
			width : 97;
			height : 28;
			background : url("images/button/login.gif") no-repeat;
			border-style : none;
			font-family : Arial;
			color : navy;
		}

		input.over_login, input.down_login{
			width : 97;
			height : 28;
			background : url("images/button/login_r.gif") no-repeat;
			border-style : none;
			font-family : Arial;
			color : white;
		}

		/* Button Reset */
		input.normal_reset, input.up_reset, input.out_reset{
			width : 97;
			height : 28;
			background : url("images/button/reset.gif") no-repeat;
			border-style : none;
			font-family : Arial;
			color : navy;
		}

		input.over_reset, input.down_reset{
			width : 97;
			height : 28;
			background : url("images/button/reset_r.gif") no-repeat;
			border-style : none;
			font-family : Arial;
			color : white;
		}


	-->
	</style>

</head>
<body onload="init();IE6check();" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form name="form_main" method="post" action="">
<table width="600" border="0" align="center" bgcolor="white" height="100%" cellpadding="0" cellspacing="0">
	<tr>
	<td align="center">
	<h1 style="margin-bottom:0">
<img src="images/login_title.jpg">

	</h1>
	<table width="321" style="margin-bottom:50">
	</table>
	<table id="tableForm" style="display:block;">
		<tr>
			<th>ユーザー名：</th>
			<td>
				<input name="user" type="text" value="">
			</td>
		</tr>
		<tr>
			<th>パスワード：</th>
			<td>
				<input name="password"  type="password" value="">
			</td>
		</tr>
	</table>

	<div id="divSubmitBtn" style="display;block;" class="command">
		<input type="button" name="" value="" class="normal_login" onClick="login();" onMouseOver="className='over_login'" onMouseDown="className='down_login'" onMouseUp="className='up_login'" onMouseOut="className='out_login'">
		<input type="button" name="" value="" class="normal_reset" onClick="resetText();" onMouseOver="className='over_reset'" onMouseDown="className='down_reset'" onMouseUp="className='up_reset'" onMouseOut="className='out_reset'">
	</div>
</td>
</tr>
</table>

</form>
</body>
</html>

<script language="JavaScript">

	var errorMessage = "<%= loginErrorMessage %>";


	function IE6check(){
		if(navigator.appVersion.indexOf("MSIE 6")==-1){
			document.all.tableForm.style.display="none";
			document.all.divSubmitBtn.innerHTML="OpenOLAPのサポートブラウザは　Microsoft Internet Explorer 6　となっております。";
		}
	}

	function init() {
		document.form_main.user.focus();
		document.form_main.user.select();

		if (errorMessage != "") {
			showErrorMessage(errorMessage);
		}
	}

	function showErrorMessage(message) {
		alert(message);
	}

	function login() {

		if ( ( document.form_main.user.value == "" ) && ( document.form_main.password.value == "" ) ) {
			showMessage("8");
			document.form_main.user.focus();
			document.form_main.user.select();
			return;
		} else if ( document.form_main.user.value == "" ) {
			showMessage("9");
			document.form_main.user.focus();
			document.form_main.user.select();
			return;
		} else if( document.form_main.password.value == "" ) {
			showMessage("10");
			document.form_main.password.focus();
			document.form_main.password.select();
			return;
		}

		document.form_main.action = "Controller?action=login";
		document.form_main.target = "_self";
		document.form_main.submit();
	}


	function resetText() {
		document.form_main.user.value = "";
		document.form_main.password.value = "";

		document.form_main.user.focus();
		document.form_main.user.select();
	}

</script>
