<%--
    Document   : index
    Created on : 29.3.2010, 18:14:44
    Author     : Pavel Jandera
--%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!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=UTF-8">
        <title>Registrace</title>
        <link rel="stylesheet" type="text/css" href="style.css" />
        <script type="text/JavaScript">
            function validate(form){
                reg = /^.{0,40}$/
                prazdne = /^\s$/
 
                for(i=0;i<=5;i++){
                    if (reg.test(form.elements[i].value)==false || form.elements[i].value==""){
                        window.alert("Moc dlouhé nebo prázdné.");
                        form.elements[i].focus();
                    return false;
                    }
                }
                if(form.heslo.value!=form.reHeslo.value){
                    window.alert("Hesla musí být shodná.");
                    form.heslo.focus();
                    return false;
                }
                return true;
            }
        </script>
    </head>

    <body>
        <div id="header"></div>
        <div id="content">
            <h1>Registrace nového uživatele</h1>
            <form style="padding: 0" onsubmit="return validate(this)" name="registerForm" action="Register" method="GET">
                <div id="register">
                    <c:choose>
                    <c:when test="${RequestData.login == 'Zadaný login již existuje'}">
                        <p>Login: <input class="important" type="text" name="login" size="30" value="${RequestData.login}"></p>
                    </c:when>
                    <c:otherwise>
                        <p>Login: <input type="text" name="login" size="30"></p>
                    </c:otherwise>
                    </c:choose>
                        <p>Heslo: <input type="password" name="heslo" size="30" value="${RequestData.heslo}"></p>
                    <p>Heslo znovu: <input type="password" name="reHeslo" size="30" value="${RequestData.heslo}"></p>
                    <p>Jméno: <input type="text" name="jmeno" size="30" value="${RequestData.jmeno}"></p>
                    <p>Příjmení: <input type="text" name="prijmeni" size="30" value="${RequestData.prijmeni}"></p>
                    <p>E-mail: <input type="text" name="mail" size="30" value="${RequestData.mail}"></p>
                    <p>URI: <input type="text" name="uri" size="30" value="${RequestData.uri}"></p>
                    <p>Telefonní číslo: <input type="text" name="telefon" size="30" value="${RequestData.telefon}"></p>
                    <p><input style="clear: both" type="submit" name="odeslat" value="Odeslat"></p><br />
                </div>
            </form>
        </div>
    </body>
</html>
