<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=euc-jp" />
		<link rel="stylesheet" type="text/css" href="./css/common.css">
		<link rel="stylesheet" type="text/css" href="./css/login.css">
		<title>Yacafe Sample Application</title>
		<script type="text/javascript">
			function load()
			{
				var message = document.getElementById("message");
				
				if(message)
				{
					if(message.innerHTML != "")
					{
						message.style.display = "block";
					}
				}

				var password = document.getElementById("password");
				
				if(password && password.value != "")
				{
					document.getElementById("ignore").style.display = "inline";
				}
			}

			function exclude()
			{
				var elements = document.getElementsByTagName("input");

				for(var i = 0; i < elements.length; i++)
				{
					if(elements[i].type == "submit")
					{
						elements[i].disabled = true;
					}
				}
			}

			function saveValue(elem)
			{
				var tmp = document.createElement("input");

				tmp.type  = "hidden";
				tmp.name  = elem.name;
				tmp.value = elem.value;

				elem.form.appendChild(tmp);
			}
		</script>
	</head>
	<body onload="load()">
		<div id="container">
			<div id="login">
				<h1>Yacafe Sample Application</h1>
				<span id="message">{{type=property; target=message; property=text}}</span>
				<p>Yacafe Sample Application にログインします</p>
				<form name="login" action="./" method="post" onsubmit="exclude()">
					<input type="hidden" name="app" value="login" />
					<label>
						<span>ユーザー名</span>
						<input id="username" class="{{type=property; target=username; property=class}}" type="text" name="username" value="{{type=property; target=username; property=value}}" maxlength="16" />
					</label>
					<label>
						<span>パスワード</span>
						<input id="password" class="{{type=property; target=password; property=class}}" type="password" name="password" value="{{type=property; target=password; property=value}}" maxlength="16" />
					</label>
					<div class="bottom">
						<input id="submit" class="button" type="submit" name="submit" value="ログイン" onclick="saveValue(this)" /><input id="ignore" class="button" type="submit" name="submit" value="無視" onclick="saveValue(this)" />
					</div>
				</form>
			</div>
		</div>
	</body>
</html>
