<script language="javascript">
function sameAsEmail()
{
    if (document.forms['signupform'].elements['checkboxUsername'].checked) {
        document.forms['signupform'].elements['username'].value = document.forms['signupform'].elements['email'].value;
        document.forms['signupform'].elements['username'].readOnly = true;
    } else {
        document.forms['signupform'].elements['username'].readOnly = false;
    }
}
</script>

<form method="POST" action="dosignup.action" name="signupform">

        <div class="form-block">
            <div class="form-element-large">$action.getText("signup.personal.details")</div>
            <p>
            $action.getText('fullname.email.desc')
            </p>
            <p>
                #fielderror ('fullname')
                <div class="steplabel">$action.getText("fullname.name.bothcaps"): </div><input type="text" name="fullname" size="30" value="$generalUtil.htmlEncode($!fullname)"><br/>
                #fielderror ('email')
                <div style="padding-top: 4px"><div class="steplabel">$action.getText("email.name"): </div><input type="text" name="email" size="30" value="$generalUtil.htmlEncode($!email)"></div>
            </p>
        </div>

        <div class="form-divider"></div>

        <div class="form-block">
            <div class="form-element-large">$action.getText('choose.username')</div>
            <p>
                $action.getText('username.desc')
            </p>
            <p>
                #fielderror ('username')
                <div class="steplabel">$action.getText("username.name"): </div><input type="text" name="username" size="30" value="$generalUtil.htmlEncode($!username)">
                <input type="checkbox" name="checkboxUsername" onClick="sameAsEmail()" style="vertical-align:middle"><span class="smallfont">$action.getText('same.as.email')</span>
            </p>
        </div>

        <div class="form-block">
            <div class="form-element-large">$action.getText('choose.password')</div>
            <p>
                $action.getText('password.desc')
            </p>
            <p>
                #fielderror ('password')
                <div class="steplabel">$action.getText("password.name"): </div><input type="password" name="password" size="30" value="$generalUtil.htmlEncode($!password)"><br/>
                #fielderror ('confirm')
                <div style="padding-top: 4px"><div class="steplabel">$action.getText("confirm.name"): </div><input type="password" name="confirm" size="30" value="$generalUtil.htmlEncode($!confirm)"></div>
            </p>
        </div>

        #if($captchaManager.showCaptchaForCurrentUser())
        <div class="form-divider"></div>
        <div class="form-block">
            <div class="form-element-large">$action.getText("confirm.signup")</div>
            <p>
                $action.getText("captcha.challenge")
            </p>

            <p>
            <div class="steplabel">&nbsp;</div>
                #captchaImage()
            <br>
                #fielderror('captcha')

            <div class="steplabel">$action.getText("confirm.name"):</div>
            <input type='text' name='captchaResponse' value='' size="31">
            </p>
        </div>
        #end

        <div class="form-buttons">
        #tag ("Submit" "value='signup.name'" "align='center'" "theme='notable'" "template='submit.vm'")
        </div>
</form>