function writeForm(account, subname) {
	var txt = new Array();
	var _ = 0;
	txt[_++] = '<tr>';
	txt[_++] = '	<form action="https://at.yeg.jp/gw/LoginCheck.do" method="post" onSubmit=writeCookie(this)>';
	txt[_++] = '	<td style="font-weight:bold">アカウント</td>';
	txt[_++] = '	<td><input name="account" id="account" type="text" size="16" value="' + account + '" /></td>';
	txt[_++] = '</tr>';
	txt[_++] = '<tr>';
	txt[_++] = '	<td style="font-weight:bold">パスワード</td>';
	txt[_++] = '	<td><input name="password" id="password" type="password" size="16" id="password" />';
	txt[_++] = '	<br><a href="https://at.yeg.jp/password/OpenSearchByMail.do">パスワードをお忘れの方</a></td>';
	txt[_++] = '</tr>';
	txt[_++] = '<tr>';
	txt[_++] = '	<td nowrap="nowrap" style="font-weight:bold">サブネーム</td>';
	txt[_++] = '	<td><select name="subName" id="subName">';
	txt[_++] = '	<option value="1"' + (subname == 1 ? ' selected="selected"' : '') + '>blue</option>';
	txt[_++] = '	<option value="2"' + (subname == 2 ? ' selected="selected"' : '') + '>green</option>';
	txt[_++] = '	<option value="3"' + (subname == 3 ? ' selected="selected"' : '') + '>red</option>';
	txt[_++] = '	<option value="4"' + (subname == 4 ? ' selected="selected"' : '') + '>yellow</option>';
	txt[_++] = '	</select></td>';
	txt[_++] = '</tr>';
	txt[_++] = '<tr>';
	txt[_++] = '	<th colspan="2"><input type="image" src="http://edesk.jp/at/linkkit/img/at_login.gif" width="84" height="18" border="0" alt="ログイン" name="login" style="margin-bottom: 5px;"></th>';
	txt[_++] = '</tr></form>';
	document.write(txt.join(""));
}
function writeCookie(el) {
	var limit = new Date();
	limit.setTime(limit.getTime() + 14 * 24 * 60 * 60 * 1000);
	document.cookie = createCookieString("ACCOUNT", el.account.value, limit);
	document.cookie = createCookieString("SUBNAME", el.subName.options[el.subName.selectedIndex].value, limit);
}
function createCookieString(key, value, limit) {
	var txt = new Array();
	var _ = 0;
	return key + '=' + escape(value) + '; expires=' + limit.toGMTString() + ';';
}
function getCookie(name){
  var list = document.cookie.split("; ");
  for( i in list )
  {
    var dat = list[i].split("=");
    if( dat[0] == name )
      return dat[1];
  }
  return "";
}
document.write('<script type="text/javascript">writeForm(getCookie("ACCOUNT"), getCookie("SUBNAME"));</script>');
