<div class="popups">
	<div class="modal hide b-domain-content g-ui-user-select-none"
		data-bind="modal: modalVisibility, css: {'domain-edit': edit, 'domain-second-page': 'main' !== page()}">
		<div class="modal-header">
			<button type="button" class="close" data-bind="command: cancelCommand">&times;</button>
			<h3 data-bind="text: headerText"></h3>
		</div>
		<div class="modal-body">
			<form class="form-horizontal domain-form" action="#/" onsubmit="return false;">
				<div class="row" data-bind="visible: !edit()" style="margin-bottom: 20px;">
					<div class="span5">
						<span data-i18n="POPUPS_DOMAIN/LABEL_NAME"></span>
						&nbsp;
						<span style="color: #aaa">(<span data-i18n="POPUPS_DOMAIN/NAME_HELPER"></span>)</span>
						<br />
						<input type="text" class="span4" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
							data-bind="textInput: name, hasfocus: name.focused" />
						<div data-bind="visible: '' !== savingError()">
							<span class="error-desc" data-bind="text: savingError"></span>
						</div>
					</div>
					<div class="span5 domain-desc" data-bind="visible: '' !== domainDesc()">
						<div data-bind="html: domainDesc"></div>
					</div>
				</div>
				<div class="row">
					<div class="span5">
						<div class="legend imap-header" data-bind="visible: !sieveSettings(), css: { 'testing-done': testingDone, 'testing-error': testingImapError }">
							<span data-placement="bottom" data-bind="tooltipErrorTip: testingImapErrorDesc">
								<span data-i18n="POPUPS_DOMAIN/LABEL_IMAP"></span>
							</span>
						</div>
						<div class="legend sieve-header" data-bind="visible: sieveSettings(), css: { 'testing-done': testingDone, 'testing-error': testingSieveError }">
							<span data-placement="bottom" data-bind="tooltipErrorTip: testingSieveErrorDesc">
								<span data-i18n="POPUPS_DOMAIN/LABEL_SIEVE"></span>
							</span>
						</div>
						<div data-bind="visible: !sieveSettings()">
							<div class="row">
								<div class="span3">
									<span data-i18n="POPUPS_DOMAIN/LABEL_SERVER"></span>
									<br />
									<input type="text" class="span3" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
										data-bind="textInput: imapServer, hasfocus: imapServerFocus" />
								</div>
								<div class="span1">
									<span data-i18n="POPUPS_DOMAIN/LABEL_PORT"></span>
									<br />
									<input type="text" class="span1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
										data-bind="textInput: imapPort" />
								</div>
							</div>
							<br />
							<div class="row">
								<div class="span4">
									<span data-i18n="POPUPS_DOMAIN/LABEL_SECURE"></span>
									<br />
									<select class="span2" data-bind="value: imapSecure">
										<option value="0" data-i18n="POPUPS_DOMAIN/SECURE_OPTION_NONE"></option>
										<option value="1" data-i18n="POPUPS_DOMAIN/SECURE_OPTION_SSL"></option>
										<option value="2" data-i18n="POPUPS_DOMAIN/SECURE_OPTION_STARTTLS"></option>
									</select>
								</div>
							</div>
							<br />
							<div class="row">
								<div class="span5">
									<div data-bind="component: {
										name: 'Checkbox',
										params: {
											label: 'POPUPS_DOMAIN/LABEL_USE_SHORT_LOGIN',
											value: imapShortLogin,
											inline: true
										}
									}"></div>
									&nbsp;&nbsp;
									<span style="color: #aaa">(user@domain.com &rarr; user)</span>
								</div>
							</div>
							<br />
							<br />
							<div class="row" data-bind="visible: allowSieve">
								<div class="span5">
									<span data-bind="command: sieveCommand">
										<i class="icon-filter"></i>
										&nbsp;
										<a href="#" class="g-ui-link" data-i18n="POPUPS_DOMAIN/BUTTON_SIEVE_CONFIGURATION"></a>
										&nbsp;&nbsp;
										<span style="color:red">(<span data-i18n="HINTS/BETA"></span>)</span>
									</span>
								</div>
							</div>
						</div>
						<div data-bind="visible: sieveSettings">
							<div class="row">
								<div class="span5">
									<div data-bind="component: {
										name: 'Checkbox',
										params: {
											label: 'POPUPS_DOMAIN/LABEL_ALLOW_SIEVE_SCRIPTS',
											value: useSieve
										}
									}"></div>
								</div>
							</div>
							<div data-bind="visible: useSieve">
								<div class="row">
									<div class="span5">
										<div data-bind="component: {
											name: 'Checkbox',
											params: {
												label: 'POPUPS_DOMAIN/LABEL_ALLOW_USER_SCRIPT',
												value: sieveAllowRaw
											}
										}"></div>
									</div>
								</div>
								<br />
								<div class="row">
									<div class="span3">
										<span data-i18n="POPUPS_DOMAIN/LABEL_SERVER"></span>
										<br />
										<input type="text" class="span3" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
											data-bind="textInput: sieveServer, hasfocus: sieveServerFocus" />
									</div>
									<div class="span1">
										<span data-i18n="POPUPS_DOMAIN/LABEL_PORT"></span>
										<br />
										<input type="text" class="span1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
											data-bind="textInput: sievePort" />
									</div>
								</div>
								<br />
								<div class="row">
									<div class="span4">
										<span data-i18n="POPUPS_DOMAIN/LABEL_SECURE"></span>
										<br />
										<select class="span2" data-bind="value: sieveSecure">
											<option value="0" data-i18n="POPUPS_DOMAIN/SECURE_OPTION_NONE"></option>
											<option value="1" data-i18n="POPUPS_DOMAIN/SECURE_OPTION_SSL"></option>
											<option value="2" data-i18n="POPUPS_DOMAIN/SECURE_OPTION_STARTTLS"></option>
										</select>
									</div>
								</div>
							</div>
							<br />
							<div class="row">
								<div class="span5">
									<span data-bind="command: sieveCommand">
										<i class="icon-left"></i>
										&nbsp;
										<a href="#" class="g-ui-link" data-i18n="POPUPS_DOMAIN/BUTTON_BACK_TO_IMAP"></a>
									</span>
								</div>
							</div>
						</div>
					</div>
					<div class="span5">
						<div class="legend smtp-header" data-bind="css: { 'testing-done': testingDone, 'testing-error': testingSmtpError }">
							<span data-placement="bottom" data-bind="tooltipErrorTip: testingSmtpErrorDesc">
								<span data-i18n="POPUPS_DOMAIN/LABEL_SMTP"></span>
							</span>
						</div>
						<div data-bind="visible: !smtpPhpMail()">
							<div class="row">
								<div class="span3">
									<span data-i18n="POPUPS_DOMAIN/LABEL_SERVER"></span>
									<br />
									<input type="text" class="span3" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
										data-bind="textInput: smtpServer, hasfocus: smtpServerFocus" />
								</div>
								<div class="span1">
									<span data-i18n="POPUPS_DOMAIN/LABEL_PORT"></span>
									<br />
									<input type="text" class="span1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
										data-bind="textInput: smtpPort" />
								</div>
							</div>
							<br />
							<div class="row">
								<div class="span4">
									<span data-i18n="POPUPS_DOMAIN/LABEL_SECURE"></span>
									<br />
									<select class="span2" data-bind="value: smtpSecure">
										<option value="0" data-i18n="POPUPS_DOMAIN/SECURE_OPTION_NONE"></option>
										<option value="1" data-i18n="POPUPS_DOMAIN/SECURE_OPTION_SSL"></option>
										<option value="2" data-i18n="POPUPS_DOMAIN/SECURE_OPTION_STARTTLS"></option>
									</select>
								</div>
							</div>
							<br />
							<div class="row">
								<div class="span5">
									<div data-bind="component: {
										name: 'Checkbox',
										params: {
											label: 'POPUPS_DOMAIN/LABEL_USE_SHORT_LOGIN',
											value: smtpShortLogin,
											inline: true
										}
									}"></div>
									&nbsp;&nbsp;
									<span style="color: #aaa">(user@domain.com &rarr; user)</span>
									<br />
									<div data-bind="component: {
										name: 'Checkbox',
										params: {
											label: 'POPUPS_DOMAIN/LABEL_USE_AUTH',
											value: smtpAuth
										}
									}"></div>
								</div>
							</div>
							<br />
						</div>
						<div class="row">
							<div class="span5">
								<div data-bind="component: {
									name: 'Checkbox',
									params: {
										label: 'POPUPS_DOMAIN/LABEL_USE_PHP_MAIL',
										value: smtpPhpMail,
										inline: true
									}
								}"></div>
								&nbsp;&nbsp;
								<span style="color:red">(<span data-i18n="HINTS/BETA"></span>)</span>
							</div>
						</div>
					</div>
					<div class="span10" data-bind="visible: 'white-list' === page()">
						<div class="legend white-list-header" data-i18n="POPUPS_DOMAIN/LABEL_WHITE_LIST"></div>
						<div class="alert alert-block span6 alert-null-left-margin" style="width: 562px;" data-i18n="POPUPS_DOMAIN/WHITE_LIST_ALERT"></div>
						<textarea class="input-xxlarge" style="width: 600px" rows="8" data-bind="value: whiteList" tabindex="-1"></textarea>
					</div>
				</div>
			</form>
		</div>
		<div class="modal-footer">
			<a class="btn button-test-connection pull-left" data-bind="visible: 'main' === page(), command: testConnectionCommand, css: {
			   'btn-success': testingDone() && !testingImapError() && !testingSmtpError(),
			   'btn-danger': testingDone() && (testingImapError() || testingSmtpError()) }">
				<i data-bind="css: {'icon-info': !testing(), 'icon-spinner animated': testing(), 'icon-white': testingDone()}"></i>
				&nbsp;&nbsp;
				<span data-i18n="POPUPS_DOMAIN/BUTTON_TEST"></span>
			</a>
			<a class="btn button-white-list pull-left" data-bind="command: whiteListCommand, visible: 'main' === page()">
				<i class="icon-users"></i>
				&nbsp;&nbsp;
				<span data-i18n="POPUPS_DOMAIN/BUTTON_WHITE_LIST"></span>
			</a>
			<a class="btn button-white-list pull-left" data-bind="command: backCommand, visible: 'main' !== page()">
				<i class="icon-left"></i>
				&nbsp;&nbsp;
				<span data-i18n="POPUPS_DOMAIN/BUTTON_BACK"></span>
			</a>
			<a class="btn buttonClose" data-bind="command: cancelCommand">
				<i class="icon-remove"></i>
				&nbsp;&nbsp;
				<span data-i18n="POPUPS_DOMAIN/BUTTON_CLOSE"></span>
			</a>
			<a class="btn buttonClear" data-bind="command: createOrAddCommand">
				<i data-bind="css: edit() ? 'icon-ok' : 'icon-plus', visible: !saving()"></i>
				<i class="icon-spinner animated" data-bind="visible: saving"></i>
				&nbsp;&nbsp;
				<span data-bind="visible: !edit()" data-i18n="POPUPS_DOMAIN/BUTTON_ADD"></span>
				<span data-bind="visible: edit()" data-i18n="POPUPS_DOMAIN/BUTTON_UPDATE"></span>
			</a>
		</div>
	</div>
</div>