login = loginCheck();
function loginCheck(){
	tmp = document.cookie + ";";
	index1 = tmp.indexOf("login",0)
	if(index1 != -1){
		tmp = tmp.substring(index1,tmp.length);
		index2 = tmp.indexOf("=",0)+1;
		index3 = tmp.indexOf(";",index2);
		return(unescape(tmp.substring(index2,index3)));
	}
	return("*");
}
function setCookie(){
	name = document.loginform.i_mid.value;
	tmp = "login=" + escape(name) + ";";
	tmp += "expires = Mon,31-Dec-2010 23:59:59;";
	tmp += "path = /;"
	document.cookie = tmp;
}
function clearCookie(){
	name = loginCheck();
	tmp = "login=" + escape(name) + ";";
	tmp += "expires = Mon,31-Dec-2000 23:59:59;";
	tmp += "path = /;"
	document.cookie = tmp;
}
function getlogin(id){

	if(login != "*"){
		document.writeln("こんにちは、<span class='name'>",login,"</span>さん。<br />");
		document.writeln("<form action='../PMwapp/PWCU0015_set.do' method='post' name='loginform' onsubmit='clearCookie();'>");
		document.writeln("<input type='hidden' name='targetid' value=''>");
		document.loginform.targetid.value=id;
		document.writeln("<div align='right'><input type='image' src='../PMfiles/all/logout.gif' value='ログアウト' class='button'/></div>");
		document.writeln("</form>");
	}else{
		document.writeln("<form action='../PMwapp/PWCU0010_set.do' method='post' name='loginform' onsubmit='setCookie();'>");
		document.writeln("<input type='hidden' name='targetid' value=''>");
		document.loginform.targetid.value=id;
		document.writeln("ユーザーID<input type='text' name='i_mid' size='10'><br>パスワード<input type='password' name='i_pwd' size='10'>");
		document.writeln("<input type='image' src='../PMfiles/all/login_xs.gif' value='ログイン' class='button' align='right'/>");
		document.writeln("</form>");
	}
}
