<%@ include file="validate.jsp" %>
<%@ page language="java" contentType="text/html; charset=GBK"
    pageEncoding="GBK"%>
    <%@ page import="cn.sendsms.jdsmsserver.*"%>
<%
response.setHeader("Cache-Control","no-store");
response.setHeader("Pragrma","no-cache");
response.setDateHeader("Expires",0);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title>Ιθ±ΈΧΆ²α</title>
<link href="css.css" type="text/css" rel="stylesheet">
<script type="text/javascript">
 function goback(){
	 window.location.href="/device-config?action=refresh";
 }
 function check1(){
	
	 var serialnum = document.getElementById('serialnum').value;
	 var regcode = document.getElementById('regcode').value;
	 if(serialnum=='0123456789'){
		 alert('<%=ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.device_reg_failure_info4")%>');
		 	return false;
	 }
	 if(serialnum=='')
		 {
		 alert('<%=ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.device_failed_to_get_imei1")%>');
		 	return false;
		 }
	
	 if(regcode==''){
		 alert('<%=ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.device_input_reg_code")%>');
		 return false;
	 }
	
	 if(regcode.length!=23 && regcode.length!=28){
		 alert('<%=ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.device_reg_failure_info5")%>');
		 return false;
	 }
	return true;
	 
 }

</script>
<style type="text/css">
	input{
		height:22px;
		line-height: 22px;
	}
	#center .left_col{
		font-size: 14px;
		color:#202020;
		font-weight: 600;
	}
	.wbtn1,.wbtn2{
		padding:5px 10px;
		line-height: 15px;
		border:1px solid #9cc0c1;
		background: #fff;
		color:#5db3b6;
		border-radius: 5px;
		margin-right:10px;
		width:100px;
		height:auto;
	}
	.wbtn2{
		background: #5db3b6;
		color:#fff;

	}
</style>
</head>
<body>
<div id="top"><span><img src="img/tu1.jpg"></span><%=ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.device_reg")%></div>
<div id="center" style="background: #fcfcfc;">
<%
	String serialnum = (String)request.getAttribute("serialnum");
%>
<form action="/device-config" name="form1" method="post" onsubmit="return check1();" style="background: #fff;">
<input type="hidden" name="action" value="regDevice">
<input type="hidden" name="gatewayid" value="<%=request.getAttribute("gatewayid")%>">

<table>
<% 
if(request.getAttribute("error")!=null)
	{%>
	<tr><td colspan="2" style="color:#ff0000"><%=request.getAttribute("error") %></td></tr>
<%}else if(request.getAttribute("info")!=null) {%>
	<tr><td colspan="2" style="color:#00ff00"><%=request.getAttribute("info") %></td></tr>
<%} %>
<tr>
<td align="right" class="left_col"><%=ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.device_id")%></td>
<td><input type="text" readonly name="serialnum"  id="serialnum"  size="35"  value="<%=serialnum %>"></td>
</tr>
<tr>
<td align="right" class="left_col"><%=ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.device_reg_code")%> </td>
<td><input type="text" name="regcode" id="regcode" maxlength="28" size="35" value="<%=request.getAttribute("regcode")%>"></td>
</tr>
<tr>
	<td></td>
	<td>
		<%=ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.device_reg_info1")%>
		<div></div>
		<a target="_top" href="http://www.sendsms.com.cn/">www.sendsms.com.cn</a> <%=ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.device_reg_info2")%>
	</td>
</tr>

<tr>
<td colspan="2" align="center"><input type="reset" class="wbtn1" value=<%=ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.device_reg_reset")%>> <input type="submit"  class="wbtn2" value=<%=ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.device_reg_submit")%>>  <input type="button" class="wbtn1" value=<%=ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.device_reg_back")%> 

onclick="goback()"></td>
</tr>

</table>
</form>
</div>
<%if(request.getAttribute("message")!=null) {%>
<script type="text/javascript">
alert('<%=request.getAttribute("message")%>');
</script>
<% }%>
</body>
</html>