<inp2:adm_SetPopupSize width="750" height="560"/>

<inp2:m_include t="incs/header"/>
<inp2:m_RenderElement name="combined_header" section="in-portal:site_domains"  prefix="site-domain" title_preset="site_domain_edit" tab_preset="Default"/>

<!-- ToolBar -->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
	<tr>
  	<td>
  		<script type="text/javascript">
				a_toolbar = new ToolBar();
				a_toolbar.AddButton( new ToolBarButton('select', '<inp2:m_phrase label="la_ToolTip_Save" escape="1"/>', function() {
							submit_event('site-domain', '<inp2:site-domain_SaveEvent/>');
						}
					) );
				a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
							cancel_edit('site-domain', 'OnCancelEdit','<inp2:site-domain_SaveEvent/>','<inp2:m_Phrase label="la_FormCancelConfirmation" escape="1"/>');
						}
				 ) );

			 a_toolbar.AddButton( new ToolBarButton('reset_edit', '<inp2:m_phrase label="la_ToolTip_Reset" escape="1"/>', function() {
						reset_form('site-domain', 'OnReset', '<inp2:m_Phrase label="la_FormResetConfirmation" escape="1"/>');
					}
			 	) );

				a_toolbar.AddButton( new ToolBarSeparator('sep1') );

				a_toolbar.AddButton( new ToolBarButton('prev', '<inp2:m_phrase label="la_ToolTip_Prev" escape="1"/>', function() {
							go_to_id('site-domain', '<inp2:site-domain_PrevId/>');
						}
				 ) );
				a_toolbar.AddButton( new ToolBarButton('next', '<inp2:m_phrase label="la_ToolTip_Next" escape="1"/>', function() {
							go_to_id('site-domain', '<inp2:site-domain_NextId/>');
						}
				 ) );

				a_toolbar.Render();

				<inp2:m_if check="site-domain_IsSingle">
					a_toolbar.HideButton('prev');
					a_toolbar.HideButton('next');
					a_toolbar.HideButton('sep1');
				<inp2:m_else/>
					<inp2:m_if check="site-domain_IsLast">
						a_toolbar.DisableButton('next');
					</inp2:m_if>
					<inp2:m_if check="site-domain_IsFirst">
						a_toolbar.DisableButton('prev');
					</inp2:m_if>
				</inp2:m_if>
			</script>
		</td>
	</tr>
</tbody>
</table>

<inp2:site-domain_SaveWarning name="grid_save_warning"/>
<inp2:site-domain_ErrorWarning name="form_error_warning"/>

<inp2:m_DefineElement name="inp_edit_regexp_box" class="" format="" is_last="" maxlength="" onblur="" onchange="" size="" onkeyup="" hint_label="" style="width: 400px">
	<inp2:m_RenderElement design="form_row" pass_params="1">
		<td class="control-cell">
			<input type="hidden" id="<inp2:{$prefix}_InputName field='{$field}UsesRegExp'/>" name="<inp2:{$prefix}_InputName field='{$field}UsesRegExp'/>" value="<inp2:{$prefix}_Field field='{$field}UsesRegExp' db='db'/>">
			<input tabindex="<inp2:m_get param='tab_index'/>" title="<inp2:m_Phrase name='la_hint_UsingRegularExpression' html_escape='1'/>" type="checkbox" id="_cb_<inp2:{$prefix}_InputName field='{$field}UsesRegExp'/>" <inp2:{$prefix}_Field field="{$field}UsesRegExp" checked="checked" db="db"/> onchange="update_checkbox(this, document.getElementById('<inp2:{$prefix}_InputName field='{$field}UsesRegExp'/>'));"/>

			<input style="<inp2:m_Param name='style'/>" type="text" name="<inp2:{$prefix}_InputName field='$field'/>" id="<inp2:{$prefix}_InputName field='$field'/>" value="<inp2:{$prefix}_Field field='$field' format='$format'/>" tabindex="<inp2:m_get param='tab_index'/>" size="<inp2:m_param name='size'/>" maxlength="<inp2:m_param name='maxlength'/>" class="<inp2:m_param name='class'/>" onblur="<inp2:m_Param name='onblur'/>" onkeyup="<inp2:m_Param name='onkeyup'/>" onchange="<inp2:m_Param name='onchange'/>">
		</td>
	</inp2:m_RenderElement>
</inp2:m_DefineElement>

<div id="scroll_container">
	<table class="edit-form">
		<inp2:m_RenderElement name="inp_id_label" prefix="site-domain" field="DomainId" title="la_fld_Id"/>
		<inp2:m_RenderElement name="inp_edit_regexp_box" prefix="site-domain" field="DomainName" title="la_fld_DomainName"/>
		<inp2:m_RenderElement name="inp_edit_regexp_box" prefix="site-domain" field="SSLUrl" title="la_fld_SSLUrl" hint_label="la_hint_SSLUrl"/>
		<inp2:m_RenderElement name="inp_edit_box" prefix="site-domain" field="AdminEmail" title="la_fld_AdminEmail"/>
		<inp2:m_RenderElement name="inp_edit_options" prefix="site-domain" field="Country" title="la_fld_Country" has_empty="1"/>
		<inp2:m_RenderElement name="inp_edit_options" prefix="site-domain" field="PrimaryLanguageId" title="la_fld_Language" has_empty="1"/>
		<inp2:m_RenderElement name="inp_edit_picker" prefix="site-domain" field="Languages" title="la_fld_Languages" optprefix="lang" option_key_field="LanguageId" option_value_field="PackName"/>
		<inp2:m_RenderElement name="inp_edit_options" prefix="site-domain" field="PrimaryThemeId" title="la_fld_Theme" has_empty="1"/>
		<inp2:m_RenderElement name="inp_edit_picker" prefix="site-domain" field="Themes" title="la_fld_Themes" optprefix="theme" option_key_field="ThemeId" option_value_field="Name"/>

		<inp2:m_RenderElement name="inp_edit_radio" prefix="site-domain" field="RedirectOnIPMatch" title="la_fld_RedirectOnIPMatch"/>
		<inp2:m_RenderElement name="inp_edit_textarea" prefix="site-domain" field="DomainIPRange" title="la_fld_DomainIPRange" hint_label="la_hint_DomainIPRange" allow_html="0"/>
		<inp2:m_RenderElement name="inp_edit_box" prefix="site-domain" field="ExternalUrl" title="la_fld_ExternalUrl"/>

		<inp2:m_RenderElement name="inp_edit_box" prefix="site-domain" field="Priority" title="la_fld_Priority" style="width: 50px;"/>

		<inp2:m_RenderElement name="inp_edit_filler"/>
	</table>
</div>

<script type="text/javascript">
	var $field_mask = jq('<inp2:site-domain_InputName name="#FIELD_NAME#" js_escape="1"/>');

	$(document).ready(
		function () {
			var $modes = $("input[name='" + $field_mask.replace('#FIELD_NAME#', 'RedirectOnIPMatch') + "']");

			$modes.click(
				function ($e) {
					processRedirectMode( $(this).val() );
				}
			);

			processRedirectMode( $modes.filter(':checked').val() );
		}
	);

	function processRedirectMode($mode) {
		$mode = parseInt($mode);

		$('#' + $field_mask.replace('#FIELD_NAME#', 'DomainIPRange')).attr('disabled', $mode > 0 ? '' : 'disabled');
		$('#' + $field_mask.replace('#FIELD_NAME#', 'ExternalUrl')).attr('disabled', $mode == 2 ? '' : 'disabled');
	}
</script>

<inp2:m_include t="incs/footer"/>
