Вслывающее окошко с формой входа

В HTML-низ:

<script language="JavaScript">
function showLDiv()
{
if(  document.getElementById("loginDiv").style.display == 'none' )
     document.getElementById("loginDiv").style.display = ''
else document.getElementById("loginDiv").style.display = 'none'

return false;
}
function check_form()
{
if(document.forms["form_login"].req_username.value=='' || document.forms["form_login"].req_username.value=='') {
alert('Оба поля обязательны для заполнения');
return false;
}
return true
}
url=document.URL
if(url.indexOf("login.php")==-1  && document.getElementById('navlogin')){
document.getElementById('navlogin').innerHTML  = "<a href=\"login.php\" onclick=\"return showLDiv()\"><span>Войти</span></a>"
login = "<center><div id=loginDiv style=\"display: none; \">"

login += "<form id=form_login name=login method=post action=\"login.php?action=in\" onsubmit=\"return check_form()\">"
login += "<fieldset>"
login += "<legend>Введите ваше имя и пароль ниже</legend>"
login += "<input type=hidden name=form_sent value=1 />"
login = login + "<input type=hidden name=redirect_url value="+document.URL+" />"
login += "<br><table width=\"100%\" align=left>"
login += "<tr><td align=left><b>Имя :</b></td><td align=left><input type=\"text\" id=\"fld1\" name=\"req_username\" size=\"30\" maxlength=\"25\" /></td></tr>"
login += "<tr><td align=left><b>Пароль :</b></td><td align=left><input type=\"password\" id=\"fld2\" name=\"req_password\" size=\"30\" maxlength=\"16\" /></td></tr>"
login += "</table>"
login += "</fieldset>"
login += "<p class=formsubmit><input type=submit class=button name=login value=\"Войти\" /><br /> <a href=\"register.php\">Еще не зарегистрированы?</a><br /> <a href=\"login.php?action=forget\">Забыли пароль?</a></p>"
login += "</form>"
login += "</div></center>"

document.getElementById('pun-navlinks').innerHTML += login
}
</script>