<div id="vtabContent">
<form id="sitesettings" name="settings" method="post" action="index.php?fuse=admin&action=UpdateSettings&group={settingGroup}&setting={selectedSetting}">

        <dl class="form noborder automation-options">
        <!-- BEGIN DYNAMIC BLOCK: settingRow -->

            <dt><label>{settingName}</label></dt>

                <!-- BEGIN DYNAMIC BLOCK: yesnoType -->
                <dd>
                    <input type="radio" id="value_{settingId}" name="value_{settingId}" value="0" {noSelected} {settingIsDisabled}> [l]No[/l]&nbsp;&nbsp;
                    <input type="radio"  id="value_{settingId}" name="value_{settingId}" value="1" {yesSelected} {settingIsDisabled}> [l]Yes[/l]&nbsp;&nbsp;
                </dd>
                <!-- Setting Description -->
                <dd class="full desc">
                    <span>
                    {settingDescription}
                    <!-- BEGIN DYNAMIC BLOCK: settingHelp -->
                        <br />
                        (<a href="#"  onMouseDown="openHelpWindow('{settingModule}', '{settingClass}', '{untranslatedEncodedSettingName}', 'menubar=no,scrollbars=yes,width=240,height=420')">{helpLinkLabel}</a>)<br />
                    <!-- END DYNAMIC BLOCK: settingHelp -->
                    </span>
                </dd>
                <!-- END DYNAMIC BLOCK: yesnoType -->

                <!-- BEGIN DYNAMIC BLOCK: passwordType -->
                <dd class="nextline">
                    <input type='password' class="x-form-text x-form-field" name='value_{settingId}' style="width: 507px;" value='{settingValue}' {settingIsDisabled}/>
                </dd>
                <!-- Setting Description -->
                <dd class="full desc">
                    <span>
                    {settingDescription}
                    <!-- BEGIN DYNAMIC BLOCK: settingHelp -->
                        <br />
                        (<a href="#"  onMouseDown="openHelpWindow('{settingModule}', '{settingClass}', '{untranslatedEncodedSettingName}', 'menubar=no,scrollbars=yes,width=240,height=420')">{helpLinkLabel}</a>)<br />
                    <!-- END DYNAMIC BLOCK: settingHelp -->
                    </span>
                </dd>
                <!-- END DYNAMIC BLOCK: passwordType -->

                <!-- BEGIN DYNAMIC BLOCK: textType -->
                <dd class="full desc">
                    <span>
                    {settingDescription}
                    <!-- BEGIN DYNAMIC BLOCK: settingHelp -->
                        (<a href="#"  onMouseDown="openHelpWindow('{settingModule}', '{settingClass}', '{untranslatedEncodedSettingName}', 'menubar=no,scrollbars=yes,width=240,height=420')">{helpLinkLabel}</a>)<br />
                    <!-- END DYNAMIC BLOCK: settingHelp -->
                    </span>
                </dd>
                <dd class="nextline">
                    <input type='text' name='value_{settingId}' class="x-form-text x-form-field" style="width: 507px;" value='{settingValue}' {settingIsDisabled}/>
                </dd>
                <!-- END DYNAMIC BLOCK: textType -->


                <!-- BEGIN DYNAMIC BLOCK: optionsType -->
                <dd>
                    <select name="value_{settingId}" {settingIsDisabled}>
                        <!-- BEGIN DYNAMIC BLOCK: optionsTypeItem -->
                        <option value="{optionTypeItemValue}" {optionTypeItemSelected}>{optionTypeItemLabel}&nbsp;&nbsp;</option>
                        <!-- END DYNAMIC BLOCK: optionsTypeItem -->
                    </select>
                </dd>
                <!-- Setting Description -->
                <dd class="full desc">
                    <span>
                    {settingDescription}
                    <!-- BEGIN DYNAMIC BLOCK: settingHelp -->
                        <br />
                        (<a href="#"  onMouseDown="openHelpWindow('{settingModule}', '{settingClass}', '{untranslatedEncodedSettingName}', 'menubar=no,scrollbars=yes,width=240,height=420')">{helpLinkLabel}</a>)<br />
                    <!-- END DYNAMIC BLOCK: settingHelp -->
                    </span>
                </dd>
                <!-- END DYNAMIC BLOCK: optionsType -->

                <!-- BEGIN DYNAMIC BLOCK: multipleoptionsType -->
                <dd>
                    <select name="multiplevalue_{settingId}[]" multiple="true" size="5" style="width:230px;" {settingIsDisabled}>
                        <!-- BEGIN DYNAMIC BLOCK: multipleoptionsTypeItem -->
                        <option value="{optionTypeItemValue}" {optionTypeItemSelected}>{optionTypeItemLabel}&nbsp;&nbsp;</option>
                        <!-- END DYNAMIC BLOCK: multipleoptionsTypeItem -->
                    </select>
                </dd>
                <!-- Setting Description -->
                <dd class="full desc">
                    <span>
                    {settingDescription}
                    <!-- BEGIN DYNAMIC BLOCK: settingHelp -->
                        <br />
                        (<a href="#"  onMouseDown="openHelpWindow('{settingModule}', '{settingClass}', '{untranslatedEncodedSettingName}', 'menubar=no,scrollbars=yes,width=240,height=420')">{helpLinkLabel}</a>)<br />
                    <!-- END DYNAMIC BLOCK: settingHelp -->
                    </span>
                </dd>
                <!-- END DYNAMIC BLOCK: multipleoptionsType -->

                <!-- BEGIN DYNAMIC BLOCK: colorType -->
                    <!-- BEGIN DYNAMIC BLOCK: settingHelp -->
                    <!-- END DYNAMIC BLOCK: settingHelp -->
                <!-- END DYNAMIC BLOCK: colorType -->


                <!-- BEGIN DYNAMIC BLOCK: smallTextareaType -->
                    <!-- Setting Description -->
                    <dd class="full desc" style="border-bottom:0px;">
                        <span>
                        {settingDescription}
                        <!-- BEGIN DYNAMIC BLOCK: settingHelp -->
                            <br />
                            (<a href="#"  onMouseDown="openHelpWindow('{settingModule}', '{settingClass}', '{untranslatedEncodedSettingName}', 'menubar=no,scrollbars=yes,width=240,height=420')">{helpLinkLabel}</a>)<br />
                        <!-- END DYNAMIC BLOCK: settingHelp -->
                        </span>
                    </dd>
                    <dd class="full textarea">
                        <textarea name="value_{settingId}" cols="" rows="10" {settingIsDisabled}>{settingValue}</textarea>
                    </dd>
                <!-- END DYNAMIC BLOCK: smallTextareaType -->


                <!-- BEGIN DYNAMIC BLOCK: textareaType -->
                    <!-- Setting Description -->
                    <dd class="full desc" style="border-bottom:0px;">
                        <span>
                        {settingDescription}
                        <!-- BEGIN DYNAMIC BLOCK: settingHelp -->
                            <br />
                            (<a href="#"  onMouseDown="openHelpWindow('{settingModule}', '{settingClass}', '{untranslatedEncodedSettingName}', 'menubar=no,scrollbars=yes,width=240,height=420')">{helpLinkLabel}</a>)<br />
                        <!-- END DYNAMIC BLOCK: settingHelp -->
                        </span>
                    </dd>
                    <dd class="full textarea">
                        <textarea name='value_{settingId}' cols="" rows="20" {settingIsDisabled}>{settingValue}</textarea>
                    </dd>
                <!-- END DYNAMIC BLOCK: textareaType -->

                <!-- BEGIN DYNAMIC BLOCK: richTextareaType -->
                    <!-- Setting Description -->
                    <dd class="full desc" style="border-bottom:0px;">
                        <span>
                        {settingDescription}
                        <!-- BEGIN DYNAMIC BLOCK: settingHelp -->
                            <br />
                            (<a href="#"  onMouseDown="openHelpWindow('{settingModule}', '{settingClass}', '{untranslatedEncodedSettingName}', 'menubar=no,scrollbars=yes,width=240,height=420')">{helpLinkLabel}</a>)<br />
                        <!-- END DYNAMIC BLOCK: settingHelp -->
                        </span>
                    </dd>
                    <dd class="full textarea">
                        <script type="text/javascript">
                            var HTMLfieldEditor;

                            $(document).ready(function() {
                                HTMLfieldEditor = new Ext.form.HtmlEditor({
                                    id:       'value_{settingId}',
                                    name:     'value_{settingId}',
                                    renderTo: 'ExtRichTextAreaEditor{settingId}',
                                    value:    '{settingValue}',
                                    x:        5,
                                    y:        40,
                                    width:    650,
                                    height:   250,
                                    {ExtSettingIsDisabled}
                                    hideMode: 'offsets'
                                });
                            });
                        </script>

                        <span id='ExtRichTextAreaEditor{settingId}'></span>
                    </dd>
                <!-- END DYNAMIC BLOCK: richTextareaType -->

                <!-- BEGIN DYNAMIC BLOCK: html -->
                    <dd class="full desc"  style="border-bottom:0px;">
                        <span>
                        {settingDescription}
                        <!-- BEGIN DYNAMIC BLOCK: settingHelp -->
                            <br />
                            (<a href="#"  onMouseDown="openHelpWindow('{settingModule}', '{settingClass}', '{untranslatedEncodedSettingName}', 'menubar=no,scrollbars=yes,width=240,height=420')">{helpLinkLabel}</a>)<br />
                        <!-- END DYNAMIC BLOCK: settingHelp -->
                        </span>
                    </dd>
                     <dd class="full textarea">
                        <script type="text/javascript">
                            $(document).ready(function() {
                                var HTMLfieldEditor = new Ext.form.HtmlEditor({
                                    id:       'value_{settingId}_0',
                                    name:     'value_{settingId}_0',
                                    value:    '{settingHTML}',
                                    renderTo: 'ExtDualTextAreaEditor{settingId}',
                                    x:        5,
                                    y:        40,
                                    enableAlignments: false,
                                    enableLists: false,
                                    enableLinks: false,
                                    enableFontSize: false,
                                    enableColors:false,
                                    {ExtSettingIsDisabled}
                                    hideMode: 'offsets'
                                });
                            });
                        </script>
                        <div id='ExtDualTextAreaEditor{settingId}'></div>
                    </dd>
                <!-- END DYNAMIC BLOCK: html -->

                <!-- BEGIN DYNAMIC BLOCK: dualTextareaType -->
                    <!-- Setting Description -->
                    <dd class="full desc"  style="border-bottom:0px;">
                        <span>
                        {settingDescription}
                        <!-- BEGIN DYNAMIC BLOCK: settingHelp -->
                            <br />
                            (<a href="#"  onMouseDown="openHelpWindow('{settingModule}', '{settingClass}', '{untranslatedEncodedSettingName}', 'menubar=no,scrollbars=yes,width=240,height=420')">{helpLinkLabel}</a>)<br />
                        <!-- END DYNAMIC BLOCK: settingHelp -->
                        </span>
                    </dd>
                    <dd class="full textarea">
                        <script type="text/javascript">
                            var HTMLfieldEditor;
                            var PlainTextFieldEditor;
                            var DualTextAreaEditor;

                            $(document).ready(function() {
                                HTMLfieldEditor = new Ext.form.HtmlEditor({
                                    id:       'value_{settingId}_0',
                                    name:     'value_{settingId}_0',
                                    value:    '{settingValueHTML}',
                                    x:        5,
                                    y:        40,
                                    {ExtSettingIsDisabled}
                                    hideMode: 'offsets'
                                });

                                PlainTextFieldEditor = new Ext.form.TextArea({
                                    id:     'value_{settingId}_1',
                                    name:   'value_{settingId}_1',
                                    {ExtSettingIsDisabled}
                                    value:  '{settingValuePlainText}'
                                });

                                DualTextAreaEditor = new Ext.TabPanel({
                                    id:                 'DualTextAreaEditor{settingId}',
                                    renderTo:           'ExtDualTextAreaEditor{settingId}',
                                    //activeTab:          'tabPlainTextFieldEditor{settingId}',
                                    x:                  5,
                                    y:                  55,
                                    width:              650,
                                    height:             250,
                                    autoScrollTabs:     true,
                                    plain:              true,
                                    deferredRender :    false,
                                    layoutOnTabChange:  true,
                                    defaults:           {
                                        bodyStyle:  'padding:5px'
                                    },
                                    items:              [
                                        {
                                            id:     "tabHTMLfieldEditor{settingId}",
                                            name:   "tabHTMLfieldEditor{settingId}",
                                            cls:    'x-plain',
                                            title:  'HTML',
                                            layout: "fit",
                                            items:  [
                                                HTMLfieldEditor
                                            ]
                                        },
                                        {
                                            id:     "tabPlainTextFieldEditor{settingId}",
                                            name:   "tabPlainTextFieldEditor{settingId}",
                                            cls:    'x-plain',
                                            title:  lang('Plain Text'),
                                            layout: "fit",
                                            items:  [
                                                PlainTextFieldEditor
                                            ]
                                        }
                                    ],
                                    listeners:          {
                                        'render': {
                                            fn: function(){
                                                this.activate('tabPlainTextFieldEditor{settingId}');
                                                this.activate('tabHTMLfieldEditor{settingId}');
                                            }
                                        }
                                    }
                                });
                            });
                        </script>

                        <span id='ExtDualTextAreaEditor{settingId}'></span>
                    </dd>
                <!-- END DYNAMIC BLOCK: dualTextareaType -->


        <!-- END DYNAMIC BLOCK: settingRow -->
        </dl>
    
        <!--BEGIN DYNAMIC BLOCK: showNextViewArg -->
        <input type="hidden" name="nextView" value='{nextView}' />
        <!--END DYNAMIC BLOCK: showNextViewArg -->
        
        <!--BEGIN DYNAMIC BLOCK: updateButton -->
        <input type="hidden" name="settingsArray" value='{settingIds}' />
        <input id="updatesettingbtn" style="margin-left: 351px;" type="submit" class="button" value='[l]update settings[/l]' />
        <!--END DYNAMIC BLOCK: updateButton -->
</form>
</div>

<script type="text/javascript">
$(function() {  
  $("#updatesettingbtn").click(function() {  
  
    if (check($("#sitesettings").get(0),$("#sitesettings").get(0).elements.length,false)) {
	    var contactForm = $("#sitesettings");
	  	$.ajax( {
	      url: contactForm.attr( 'action' ) + "&skipforward=true",
	      type: contactForm.attr( 'method' ),
	      data: contactForm.serialize(),
	      success: function (){
			ce.msg("Settings Updated");
	      }
	    } );
    }
    return false;
  });  
});
</script>