<META http-equiv=Content-Type content="text/html; charset=utf-8">
<HTML>
<HEAD><TITLE>TL-WR1043ND</TITLE>
<META http-equiv=Pragma content=no-cache>
<META http-equiv=Expires content="wed, 26 Feb 1997 08:21:57 GMT">
<SCRIPT language="javascript" type="text/javascript"><!--
//--></SCRIPT>
<SCRIPT language="javascript" type="text/javascript">
var httpAutErrorArray = new Array(
4, 
0,0 );
</SCRIPT>
<SCRIPT language="javascript" type="text/javascript">
var fileParaFS = new Array(
"", "OZTHDEJBAKVVDLMC*Ӕ4OZTHDEJBAKVVDLMC*Ӕ4", 
0,0 );
</SCRIPT>
<script type="text/javascript">var gCmp=fileParaFS[0];var gSession=fileParaFS[1];</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>TP-LINK Wireless N Gigabit Router WR1043N.</title>
<style type="text/css">
body{
	font-family:Arial, sans-serief;
	background-color:#E5E5E5;
	margin:0px;
	padding:0px;
}
div.loginBox
{
	display: block;
	position:relative;
	margin-top:10%;	
	text-align:center;
}
.noteDiv{
	color:gray;
	font-family:Arial;
	width:395px;
	text-align:left;
	margin:0px auto;
	font-size:14px;
}
#note{
	display:inline-block;
	vertical-align:top;
	_display:inline;
	_zoom:1;
	width:50px;
	font-weight:bold;
}
#tip{
	display:inline-block;
	vertical-align:top;
	_display:inline;
	_zoom:1;
	width:340px;
	font-weight:regular;
}
div.panelThre{
	margin-top:10px;
}
div.picDiv{
	width:395px;
	height:276px;
	background:url(../login/loginbg.png);
	position:relative;
}
input.pcPassword{
	width:300px;
	height:50px;
	line-height:50px;
	padding-left:20px;
}
div.PCBtnDiv{
	position:relative;
	margin-top:20px;
}
img.logoPic{
	width:100%;
}
#copyright{
	-webkit-text-size-adjust:none;
	font-size:8px;
	color:#6a6969;
	font-family:"Verdana";
	font-weight:regular;
	margin-top:40px;
	display:inline-block;
}
.topLogo{
	background:url(../login/top_bg.jpg);
	height:90px;
}
.style1 {
	font-family: "Arial";
	color: #FFFFFF;
	font-size: 16px;
	padding-right: 50;
	text-align: right;
	font-weight: bold;
	white-space: nowrap;
}
.style2 {
	font-size: 12px;
	font-family: "Arial";
	font-weight: bold;
	padding-right: 50;
	text-align: right;
	white-space: nowrap;
	color: #FFFFFF;
}
ul{
	padding:60px 0px 0px 0px;
	margin:0px;
	list-style:none;
}
ul li{
	height:34px;
	width:222px;
}
li.unLi{
	background:url(../login/loginUserH.png);
}
li.pwLi{
	background:url(../login/loginPwd.png);
}
li.blank{
	height:15px;
}
input.text{
	border:0px;
	height:26px;
	line-height:26px;
	width:175px;
	padding:0px;
	margin:4px 0px 0px 40px;
	font-size:14px;
	color:#6a6969;
	font-family:"Verdana","Arial";
	font-weight:regular;
}
label.loginBtn{
	height:34px;
	display:inline-block;
	width:113px;
	margin-top:30px;
	background:url(../login/loginBtn.png);
	cursor:pointer
}
</style>
<script type="text/javascript">
function Base64Encoding(input) 
{
	var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
	var output = "";
	var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
	var i = 0;

	input = utf8_encode(input);

	while (i < input.length) 
	{

		chr1 = input.charCodeAt(i++);
		chr2 = input.charCodeAt(i++);
		chr3 = input.charCodeAt(i++);

		enc1 = chr1 >> 2;
		enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
		enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
		enc4 = chr3 & 63;

		if (isNaN(chr2)) {
			enc3 = enc4 = 64;
		} else if (isNaN(chr3)) {
			enc4 = 64;
		}

		output = output +
		keyStr.charAt(enc1) + keyStr.charAt(enc2) +
		keyStr.charAt(enc3) + keyStr.charAt(enc4);

	}
 
	return output;
}

function utf8_encode (string) 
{
	string = string.replace(/\r\n/g,"\n");
	var utftext = "";

	for (var n = 0; n < string.length; n++) {

		var c = string.charCodeAt(n);

		if (c < 128) {
			utftext += String.fromCharCode(c);
		}
		else if((c > 127) && (c < 2048)) {
			utftext += String.fromCharCode((c >> 6) | 192);
			utftext += String.fromCharCode((c & 63) | 128);
		}
		else {
			utftext += String.fromCharCode((c >> 12) | 224);
			utftext += String.fromCharCode(((c >> 6) & 63) | 128);
			utftext += String.fromCharCode((c & 63) | 128);
		}

	}

	return utftext;
}

function CheckUserPsw(szElementName)
{
	var obj = $(szElementName);
	var szValue = $(szElementName).value;
	
	if(szValue.length == 0)
	{
		return false;
	}

	var c;
	var ch = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";

	for (var i = 0; i < szValue.length; i++)
	{
		c = szValue.charAt(i);
		if (ch.indexOf(c) == -1)
		{
			return false;
		}
	}
	return true;
}

function PCWin(event)
{	
	if (event.keyCode == 13)
	{
		PCSubWin();
	}
}
function ResetUserPsw(elementName)
{
	$(elementName).value = "";
	$(elementName).focus();
}
function PCSubWin()
{

	if(isLocked == true)
	{
		return;
	}
		
	if(!CheckUserPsw("userName"))
	{
		$("note").innerHTML = "NOTE:";
		$("tip").innerHTML = "The username should only consist of letters, numbers or quotation marks.";
		$("userName").value = "";
		$("userName").focus();
		return;
	}
	
	if(!CheckUserPsw("pcPassword"))
	{
		$("note").innerHTML = "NOTE:";
		$("tip").innerHTML = "The password should only consist of letters, numbers or quotation marks.";
		$("pcPassword").value = "";
		$("pcPassword").focus();
		return;
	}

	
	var auth, pos, posTwo, str, strF;
	var strtemp = location.href;

	var password = $("pcPassword").value;
	var userName = $("userName").value;

	auth = "Basic "+Base64Encoding(userName+":"+password);

	document.cookie = "Authorization="+escape(auth)+";path=/";

	pos = strtemp.indexOf("cmp");
	if (pos >= 0)
	{
		str = strtemp.substring(0, pos+4);
		strF = strtemp.substring(pos+4);
		pos = strF.indexOf("&");
		if (pos >= 0)
		{
			strF = strF.substring(pos);
		}
		else
		{
			strF = "";
		}
		
		str = str + fileParaFS[0] + strF;
		location.href = str;
	}
	else
	{
		if (strtemp.indexOf("?") >= 0)
		{
			location.href = strtemp + "&cmp=" + fileParaFS[0]+"&session=" + fileParaFS[1];
		}
		else
		{
			location.href = strtemp;
		}
	}
}

var isLocked = false;
function w(str)
{
	document.write(str);
}

function $(id)
{
	return document.getElementById(id);
}

function pageLoad()
{
	var count = 14, tip = $("tip"), tipStr="", note = $("note");
	
	var min = 0, sec = 0;
	var unLi = $("unLi");
	var pwLi = $("pwLi");
	var userName = $("userName");
	var pcPassword = $("pcPassword");
	
	pcPassword.onfocus = function(){
		pwLi.style.background = "url(../login/loginPwdH.png)";
	};
	pcPassword.onblur = function(){
		pwLi.style.background = "url(../login/loginPwd.png)";
	};
	userName.onfocus = function(){
		unLi.style.background = "url(../login/loginUserH.png)";
	};
	userName.onblur = function(){
		unLi.style.background = "url(../login/loginUser.png)";
	};
	
	userName.focus();
	/* set tip */

	var ErrNum = httpAutErrorArray[0];
	switch(ErrNum)
	{
		case 0:/* deny */
			note.innerHTML = "NOTE:";
			tip.innerHTML = "The router allows only one administrator to login at the same time, please try again later.";	
		break;
		case 2:/* lock */
			isLocked = true;
			
			count = 180;
			note.innerHTML = "NOTE:";
			tipStr = "You have exceeded three attempts, please try again in ";		
			tip.innerHTML = tipStr + "180s.";
			
			/* set timeout func */
			window.setTimeout(function(){		
				if (count <= 1)
				{
					isLocked = false;
					tip.innerHTML = "";
					note.innerHTML = "";
					return;
				}		
				count--;
				tip.innerHTML = tipStr + count + "s.";	
				window.setTimeout(arguments.callee, 1000);
			}, 1000);		
		break;
		case 3:/* auth error */
			note.innerHTML = "NOTE:";
			tip.innerHTML = "The username or password is incorrect, please input again.";
		break;
		case 4:/* no error */
		case 1:/* timeout */
		default:
			tip.innerHTML = "";
			note.innerHTML = "";
		break;
	}
}
</script>
</head>
<body onkeypress="PCWin(event)" onload="pageLoad()">
	<div class="topLogo">
		<table cellpadding=0 cellspacing=0 width="100%">
			<tr><td><table border="0" cellpadding="0" cellspacing="0" width="100%">
			<tr><td><a href="http://www.tp-link.com" target="blank" ><img src="../login/top1_1.jpg" border="0" style="cursor:pointer"></a></td>
				<td width="490" align=right background="../login/top1_2.jpg" style="padding-top:23">
					<table>
						<tr><td class="style1">300M Wireless N Gigabit Router</td></tr>
						<tr><td class="style2"> Model No. TL-WR1043ND </td></tr>
					</table>
				</td>
			</tr>
			</table></td></tr>
		<tr><td><IMG height=3 src="../login/top2.jpg" width="100%" align=top border=0></td></tr>
		</table>
	</div>
	<div class="loginBox">	
		<div class="noteDiv">
			<span id="note"></span>
			<span id="tip"></span>
		</div>
		<div class="panelThre" align="center">
			<div align="center" class="picDiv" align="center">
				<ul>
					<li id="unLi" class="unLi"><input class="text" id="userName" type="input" maxlength="14"/></li>
					<li class="blank"></li>
					<li id="pwLi" class="pwLi"><input class="text" id="pcPassword" type="password" maxlength="14"/></li>
				</ul>
				<label id="loginBtn" class="loginBtn" onclick="PCSubWin()"/></label>
				<div>
				<label id="copyright">Copyright &copy; 2013 TP-LINK Technologies Co., Ltd. All rights reserved. </label>			
				</div>
			</div>
		</div>
	</div>
</body>
</html>