<?php

/**
 *
 * @copyright  2012-2016 izend.org
 * @version    7
 * @link       http://www.izend.org
 */
?>
<?php extract($errors); ?>
<form action="" method="post">
<input type="hidden" name="subscribe_token" value="<?php echo $token; ?>" />
<p class="inlabel<?php if ($missing_mail or $bad_mail or $duplicated_mail): ?> inerror<?php endif; ?>">What is your email address?</p>
<p><input type="text" name="subscribe_mail" id="subscribe_mail" size="40" maxlength="100" title="name@domain.net" onkeypress="return focusonenter(event, 'subscribe_code')" value="<?php echo htmlspecialchars($user_mail, ENT_COMPAT, 'UTF-8'); ?>" /></p>
<p class="info">Your email address is strictly confidential.</p>
<?php if ($with_locale): ?>
<p class="inlabel">In which language do you want to receive the letter?</p>
<p><?php foreach ($system_languages as $lang): ?><?php echo PHP_EOL; ?><input name="subscribe_locale" type="radio" value="<?php echo $lang; ?>" title="<?php echo $lang; ?>"<?php if ($lang == $user_locale) echo ' checked="checked"'; ?> />&nbsp;<span class="lang <?php echo $lang; ?>" title="<?php echo $lang; ?>"><?php echo $lang; ?></span><?php endforeach; ?><?php echo PHP_EOL; ?></p>
<?php endif; ?>
<p class="inlabel<?php if ($missing_confirmation): ?> inerror<?php endif; ?>">Please confirm your registration:</p>
<p><input name="subscribe_confirmed" id="subscribe_confirmed" type="checkbox" title="Confirmation" <?php if ($confirmed) echo 'checked="checked"'; ?> />&nbsp;I want to receive the newsletter by email</p>
<?php if ($with_captcha): ?>
<p>
<img src="<?php echo $base_path; ?>/captcha/subscribe" alt="" height="40" title="Verification code" />
:
<input type="text" name="subscribe_code" id="subscribe_code" size="4" maxlength="4" title="4 letters" autocomplete="off" onkeypress="return submitonenter(event, 'subscribe_send')" value="" />
</p>
<?php endif; ?>
<p><input type="submit" class="submit submit_send" name="subscribe_send" id="subscribe_send" value="Send" /></p>
</form>
<div class="errors">
<?php if ($missing_code): ?>
<p>Enter the verification code displayed in the image.</p>
<?php elseif ($bad_code): ?>
<p>The verification code is incorrect.</p>
<?php endif; ?>
<?php if ($missing_mail): ?>
<p>Enter a valid email address.</p>
<?php elseif ($bad_mail): ?>
<p>The email address is invalid.</p>
<?php elseif ($duplicated_mail): ?>
<p>This email address is already registered.</p>
<?php endif; ?>
<?php if ($missing_confirmation): ?>
<p>Check the confirmation box.</p>
<?php endif; ?>
</div>
<?php extract($infos); ?>
<div class="infos">
<?php if ($internal_error): ?>
<p>An internal error has occurred.
<?php if ($contact_page): ?>If you can describe the problem, please <a href="<?php echo $contact_page; ?>" rel="nofollow">contact us</a>.<?php endif; ?></p>
<?php endif; ?>
<?php if ($email_registered): ?>
<p>Your email address has been registered.</p>
<?php endif; ?>
<?php if ($unsubscribe_page): ?>
<p>To stop receiving the newsletter, <a href="<?php echo $unsubscribe_page; ?>">click here</a>.</p>
<?php endif; ?>
</div>
<?php
$focus=false;
if ($missing_code or $bad_code) {
	$focus='#subscribe_code';
}
else if ($missing_mail or $bad_mail or $duplicated_mail) {
	$focus='#subscribe_mail';
}
?>
<?php if ($focus): ?>
<script type="text/javascript">
$(function() {$('<?php echo $focus; ?>').focus();});
</script>
<?php endif; ?>
