adding another filed to login script

hi all,

I need some help with the following script for the hotpsot login page. I am trying to add a field for a pin number. before this, i could enter a pin as my username and it worked. having made changes to my script however, no login is working (pin or username) can someone point out what im doing wrong?

heres my script

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
html, body {
	margin: 0;
	padding: 0;
}

body {
	background-color: #FFcc00;
}
-->
</style></head>

<body>
<table width="100%" height="189"  border="0" cellpadding="0">
  <tr>
    <td bordercolor="#666666"><table width="100%" height="189"  border="0" cellpadding="1">
      <tr valign="top">
        <td width="39%">$(if chap-id)
	<form name="sendin" action="$(link-login-only)" method="post">
		<input type="hidden" name="username" />
		<input type="hidden" name="password" />
		<input type="hidden" name="dst" value="$(link-orig)" />
		<input type="hidden" name="popup" value="true" />
	</form></td>
        <td width="61%">
		
					<form name="login" action="$(link-login-only)" method="post"
					    $(if chap-id) onSubmit="return doLogin()" $(endif)>
						<input type="hidden" name="dst" value="$(link-orig)" />
						<input type="hidden" name="popup" value="true" />
						
							<table width="249" height="120" style="background-color: #ffcc00">
								<tr><td align="right">pinnumber</td>
										<td><input style="width: 100px" name="pinnumber" type="text" value=""/></td>
								</tr>
								
								<tr><td align="right">login</td>
										<td><input style="width: 100px" name="username" type="text" value="$(username)"/></td>
								</tr>
								<tr><td align="right">password</td>
										<td><input style="width: 100px" name="password" type="password"/></td>
								</tr>
								<tr><td>&nbsp;</td>
										<td><input type="submit" value="OK" /></td>
								</tr>
					  </table>
					</form>
					<script type="text/javascript">
<!--
  document.login.username.focus();
//-->
</script>
		</td>
      </tr>
    </table></td>
	<script type="text/javascript" src="/md5.js"></script>
	<script type="text/javascript">
	<!--
	    function doLogin() {
	     var pins = document.login.pinnumber.value;
	    if (pins.length > 0) {
	      document.sendin.username.value = document.login.pinnumber.value + '@mydomain.com';
	      
		  document.sendin.password.value = hexMD5('$(chap-id)' + 'mypassword' + '$(chap-challenge)');
	    }
			else{  
				document.sendin.username.value = document.login.username.value + '@mydomain.com'; 	
				document.sendin.password.value = hexMD5('$(chap-id)' + document.login.password.value + '$(chap-challenge)');
			}
	    document.sendin.submit();
		return false;
		}
	//-->
	</script>
	
  </tr>
</table>
<table width="100%" height="600px"  border="0" cellpadding="0" >
  <tr>
    <td bordercolor="#333333">
	
<iframe src="http://www.google.com/" height="600px" width="100%" scrolling="no" frameborder="0"></iframe>



</td>
  </tr>
</table>
</body>
</html>

can anyone help me out with this? i still ahvent figured it out… :question: