<header class="g-ui-user-select-none">
	<a href="#" class="close" data-bind="click: close">×</a>
	<h3 data-bind="visible: !edit()" data-i18n="POPUPS_IDENTITY/TITLE_ADD_IDENTITY"></h3>
	<h3 data-bind="visible: edit" data-i18n="POPUPS_IDENTITY/TITLE_UPDATE_IDENTITY"></h3>
</header>
<form id="identityform" class="modal-body" autocomplete="off" spellcheck="false" data-bind="submit: submitForm">
	<div class="alert" data-bind="visible: '' !== submitError()">
		<a href="#" class="close" data-bind="click: function () { submitError('') }">×</a>
		<span data-bind="text: submitError"></span>
	</div>

	<div class="tabs" data-bind="with: identity">
		<input type="radio" name="identitytabs" id="tab-identity" checked>
		<label data-i18n="SETTINGS_LABELS/GENERAL" for="tab-identity" role="tab" aria-selected="true" aria-controls="panel1" tabindex="0"></label>
		<div class="form-horizontal tab-content" role="tabpanel" aria-hidden="false">
			<div class="control-group">
				<label data-i18n="POPUPS_IDENTITY/LABEL"></label>
				<div>
					<input name="Label" type="text" class="input-xlarge" autofocus=""
						autocomplete="off" autocorrect="off" autocapitalize="off"
						data-bind="value: label, hasfocus: $root.labelFocused">
				</div>
			</div>
			<div class="control-group">
				<label data-i18n="GLOBAL/EMAIL"></label>
				<div>
					<div class="textEmail" data-bind="text: email, visible: !id()"></div>
					<input name="Email" type="email" class="input-xlarge" autofocus=""
						autocomplete="off" autocorrect="off" autocapitalize="off"
						data-bind="visible: id, value: email, attr: {required: id}">
				</div>
			</div>
			<div class="control-group">
				<label data-i18n="GLOBAL/NAME"></label>
				<input name="Name" type="text" class="input-xlarge"
					autocomplete="off" autocorrect="off" autocapitalize="off"
					data-bind="value: name, hasfocus: $root.nameFocused">
			</div>
		</div>

		<input type="radio" name="identitytabs" id="tab-identity-signature">
		<label data-i18n="POPUPS_IDENTITY/SIGNATURE" for="tab-identity-signature" role="tab" aria-selected="false" aria-controls="panel2" tabindex="0"></label>
		<div class="form-horizontal tab-content" role="tabpanel" aria-hidden="false">
			<div class="e-signature-place" data-bind="editor: signature"></div>
			<div data-bind="component: {
				name: 'Checkbox',
				params: {
					label: 'POPUPS_IDENTITY/LABEL_SIGNATURE_INSERT_BEFORE',
					value: signatureInsertBefore,
					name: 'SignatureInsertBefore'
				}
			}"></div>
		</div>

		<input type="radio" name="identitytabs" id="tab-identity-crypto">
		<label data-i18n="CONTACTS/TAB_CRYPTO" for="tab-identity-crypto" role="tab" aria-selected="false" aria-controls="panel3" tabindex="0"></label>
		<div class="form-horizontal tab-content" role="tabpanel" aria-hidden="false">
			<div class="control-group">
				<div data-bind="component: {
					name: 'Checkbox',
					params: {
						label: 'CRYPTO/SIGN',
						value: pgpSign,
						name: 'pgpSign'
					}
				}"></div>
			</div>
			<div class="control-group">
				<div data-bind="component: {
					name: 'Checkbox',
					params: {
						label: 'CRYPTO/ENCRYPT',
						value: pgpEncrypt,
						name: 'pgpEncrypt'
					}
				}"></div>
			</div>
<!--
			<div class="control-group">
				<label data-i18n="CRYPTO/ENCRYPT"></label>
				<select name="PgpEncrypt" data-bind="value: pgpEncrypt">
					<option value="Ask" data-i18n="CONTACTS/ASK"></option>
					<option value="Never" data-i18n="CONTACTS/NEVER"></option>
					<option value="Always" data-i18n="CONTACTS/ALWAYS"></option>
					<option value="IfPossible" data-i18n="CONTACTS/ALWAYS_IF_POSSIBLE"></option>
				</select>
			</div>
-->
			<details>
				<summary><strong>S/MIME</strong></summary>
				<div class="control-group" data-bind="css: {'error': smimeKey() && !smimeKeyValid()}">
					<label data-i18n="CRYPTO/PRIVATE_KEY"></label>
					<textarea name="smimeKey" class="input-xxlarge" rows="14" autofocus="" autocomplete="off" data-bind="value: smimeKey"></textarea>
				</div>
<!--				<div class="control-group" data-bind="visible:smimeKeyValid() && !smimeKeyEncrypted()"> -->
				<div class="control-group" data-bind="visible:smimeKeyValid">
					<label></label>
					<button type="button" data-bind="click: $root.setSMimeKeyPass" data-i18n="CRYPTO/CHANGE_PASS"></button>
				</div>
				<div class="control-group" data-bind="css: {'error': smimeCertificate() && !smimeCertificateValid()}">
					<label data-i18n="SMIME/CERTIFICATE"></label>
					<textarea name="smimeCertificate" class="input-xxlarge" rows="14" autofocus="" autocomplete="off" data-bind="value: smimeCertificate"></textarea>
				</div>
				<div class="control-group" data-bind="hidden:smimeCertificate">
					<label></label>
					<button type="button" data-bind="click: $root.createSelfSigned" data-i18n="CRYPTO/CREATE_SELF_SIGNED"></button>
				</div>
			</details>
		</div>

		<input type="radio" name="identitytabs" id="tab-identity-advanced">
		<label data-i18n="SETTINGS_FILTERS/ADVANCED" for="tab-identity-advanced" role="tab" aria-selected="false" aria-controls="panel4" tabindex="0"></label>
		<div class="form-horizontal tab-content" role="tabpanel" aria-hidden="false">
			<div class="control-group">
				<label data-i18n="GLOBAL/REPLY_TO"></label>
				<input name="ReplyTo" type="email" class="inputReplyTo input-xlarge"
					autocomplete="off" autocorrect="off" autocapitalize="off"
					data-bind="value: replyTo">
			</div>
			<div class="control-group">
				<label data-i18n="GLOBAL/BCC"></label>
				<input name="Bcc" type="email" class="inputBcc input-xlarge"
					autocomplete="off" autocorrect="off" autocapitalize="off"
					data-bind="value: bcc">
			</div>
			<div class="control-group">
				<label data-i18n="FOLDER_LIST/SENT_NAME"></label>
				<select name="sentFolder" data-bind="options: $root.folderSelectList, value: sentFolder,
					optionsText: 'name', optionsValue: 'id', optionsAfterRender: $root.defaultOptionsAfterRender"></select>
			</div>
		</div>
	</div>
</form>
<footer>
	<button form="identityform" class="btn buttonAddIdentity">
		<i data-bind="visible: !edit(), css: {'icon-user-add': !submitRequest(), 'icon-spinner': submitRequest()}"></i>
		<span data-bind="visible: !edit()" data-i18n="POPUPS_IDENTITY/BUTTON_ADD_IDENTITY"></span>
		<i data-bind="visible: edit, css: {'icon-ok': !submitRequest(), 'icon-spinner': submitRequest()}"></i>
		<span data-bind="visible: edit" data-i18n="POPUPS_IDENTITY/BUTTON_UPDATE_IDENTITY"></span>
	</button>
</footer>
