{* Smarty *}

{literal}
<script type="text/javascript">
//<![CDATA[
function showResponseConfig(responseText){
  if(typeof(responseText['error'])=='undefined'){
    DialogStandartMessageOpen("message", responseText['message']);
  }
  else{
    DialogStandartMessageOpen("error", responseText['error']);
  }
}

$(function() {
  $("input:text").css("width","400px");
});

$(function() {
  var options = {
    success: showResponseConfig,
    timeout: 3000
  };
  $("#FormConfigAdd").validate({
    submitHandler: function(form) {
      $(form).ajaxSubmit(options);
    },
    rules : {},
    errorPlacement: function(error, element) {
      var er = element.attr("name");
      error.appendTo($("label[for='" + er + "']").next() );
    }
  });
});
//]]>
</script>
{/literal}

{foreach $ArrConfig as $val}
  {if $val@first}
<form action="{$MS_SP->Sp_PathTop}{$MS_SP->Sp_PathToSite}/AjaxServer/ConfigSave.ajax.php" method="post" name="FormConfigAdd" id="FormConfigAdd">
  <table>
  {/if}
    <tr>
      <td><label for="{$val.config_var}">{$val.config_name} :&nbsp;</label><span></span></td>
      <td><input type="text" id="{$val.config_var}" name="{$val.config_var}" value="{$val.config_value}" /></td>
    </tr>
  {if $val@last}
    <tr>
      <td colspan="3" class="MsFormSubmit"><input class="AltButtons" name="FormSubmit" value="сохранить" type="submit" /></td>
    </tr>
  </table>
</form>
  {/if}
{/foreach}