<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
  <% 
  String user = (String)request.getParameter("user");
  String pass = (String)request.getParameter("pass");
  String email = (String)request.getParameter("email");
  String address = (String)request.getParameter("address");
  String phone = (String)request.getParameter("phone");
  String realname = (String)request.getParameter("realname");
  String cmnd = (String)request.getParameter("cmnd");
  String usercokies = (String)session.getAttribute("user");
  String failmail = (String)request.getAttribute("failmail");
  String failuser = (String)request.getAttribute("failuser");
  
  
  %>  
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=UTF-8">
<link rel="stylesheet" href="images/style.css" type="text/css">
<link rel="stylesheet" type="text/css" href="images/AjaxForm.css" />
<script>
document.title=":: Đăng Kí Khách Hàng";
function numberonly(event) {
	 var chCode = (event.charCode === undefined) ? event.keyCode : event.charCode;
	 if (chCode > 31 && (chCode < 48 || chCode > 57))
	 {return false;}
	 else { return true;}
	  }
document.getElementById("titleCustomer").innerHTML = "Đăng Ký Khách Hàng";
</script>
<script type="text/javascript" src="js/Register.js"></script>
<script type="text/javascript" src="js/CheckRegister.js"></script>
<script type="text/javascript" src="js/Ajaxmsg.js"></script>
<title>Register</title>
</head>

<body>
<% if (usercokies != null) { %>
<div align="Center" style="border:1px solid #cfcfcf;padding:20px 10px 15px 10px;background-color:#f3f3f3; width:410px "><b>Không Thể Đăng Kí Khách Hàng Khi Đang Đăng Nhập</b><br><p></div>
<% } else { %>
<% if (user == null) { %>
<div id="wrapper">
<form name="form" class="form" id="formRegister" action="Register" onsubmit="return validate(this)" method="post">
<div align="Center" style="border:1px solid #cfcfcf;padding:20px 10px 10px 10px;background-color:#f3f3f3; width:350px ">
<B><font color = "Black">ĐĂNG KÍ KHÁCH HÀNG</font></B><BR>
<BR>
<br>
<Table>
<tr><td>Tài khoản</td><td><input type="text" name="user" id="user" onkeypress="this.style.backgroundColor = 'white';">&nbsp;<span id="msguserbox" style="display:none; position: absolute;"></span></td></tr>
<tr><td>Mật khẩu</td><td><input type="password" name="pass" id="pass" onkeydown="this.style.backgroundColor = 'white';"></td></tr>
<tr><td>Nhập lại mật khẩu</td><td><input type="password" name="cpass" id="cpass" onkeydown="this.style.backgroundColor = 'white';"></td></tr>
<tr><td>Email</td><td><input type="text" name="email" id="email" onkeydown="this.style.backgroundColor = 'white';">&nbsp;<span id="msgemailbox" style="display:none; position: absolute;"></span></td></tr>
<tr><td>Tên thật</td><td><input type="text" name="realname" id="realname" onkeydown="this.style.backgroundColor = 'white';"></td></tr>
<tr><td>CMND</td><td><input type="text" name="cmnd" id="cmnd" onkeypress="return numberonly(event); this.style.backgroundColor = 'white';"></td></tr>
<tr><td>Địa chỉ</td><td><input type="text" name="address" id="address" onkeydown="this.style.backgroundColor = 'white';"></td></tr>
<tr><td>Số điện thoại</td><td><input type="text" name="phone" id="phone" onkeydown="return numberonly(event); this.style.backgroundColor = 'white';"></td></tr>
<tr><td><input type="submit" align="right" class="UniXT" value="Đăng Ký"></td><td><input class="UniXT" type="reset" value="Nhập Lại"></td></tr>
 </table> 
 <p> 
 </div>
  </form>
</div>
  <% } else { %>
  
  <!--  Xu Ly Trung User -->
  
 <div align="Center" style="border:1px solid #cfcfcf;padding:20px 10px 20px 10px;background-color:#f3f3f3; width:350px "><% if (failuser !=null){ %><font color="Red"><b> Tài Khoản Này Đã Có Người Sử Dụng</b> </font><% } %>
 <% if (failmail !=null){ %><br><font color="Red"><b>Email Này Đã Có Người Sử Dụng</b></font> <% } %>
</div> 
  <br>
  
<div id="wrapper">
<form name="form" class="form" id="formRegister" action="Register" onsubmit="return validate(this)" method="post">
<div align="Center" style="border:1px solid #cfcfcf;padding:20px 10px 20px 10px;background-color:#f3f3f3; width:350px ">
<B>ĐĂNG KÍ KHÁCH HÀNG</B><BR>
<span id="msgbox" style="display:none"></span>
<BR>
<br>
<Table>
<tr><td>Tài khoản</td><td><input type="text" name="user" value="<%= user %>" id="user">&nbsp;<span id="msguserbox" style="display:none; position: absolute;"></span></td></tr>
<tr><td>Mật khẩu</td><td><input type="password" name="pass" value="<%= pass %>" id="pass"></td></tr>
<tr><td>Nhập lại mật khẩu</td><td><input type="password" name="cpass" value="<%= pass %>"  id="cpass"></td></tr>
<tr><td>Email</td><td><input type="text" name="email" value="<%= email %>"  id="email">&nbsp;<span id="msgemailbox" style="display:none; position: absolute;"></span></td></tr>
<tr><td>Tên thật</td><td><input type="text" name="realname" value="<%= realname %>"  id="realname"></td></tr>
<tr><td>CMND</td><td><input type="text" name="cmnd" value="<%= cmnd %>" id="cmnd" onkeypress="return numberonly(event);"></td></tr>
<tr><td>Địa chỉ</td><td><input type="text" name="address" value="<%= address %>"  id="address"></td></tr>
<tr><td>Số điện thoại</td><td><input type="text" name="phone" value="<%= phone %>"  id="phone" onkeypress="return numberonly(event);"></td></tr>
<tr><td><input type="submit" align="right" class="UniXT" value="Đăng Ký"></td><td><input class="UniXT" type="reset" value="Nhập Lại"></td></tr>
 </table>  
  <p> 
 </div>
  </form>
</div>
  
  <!-- Ket Thuc Su Ly Trung User -->
  <% } } %>
  
  
</body></html>