
//## 카페_코드__길이
  var piree_cafe_code_len_min_n;
  var piree_cafe_code_len_max_n;


  function piree_cafe_code_check_ajax()
  {

      var check_result_s = '';

      var piree_cafe_n      = $("#piree_cafe_n").val();
      var piree_cafe_code_c = $("#piree_cafe_code_c").val();

      var piree_cafe_code_len_n = piree_cafe_code_c.length;

      piree_cafe_code_len_min_n = $("#piree_cafe_code_len_min_n").val();
      piree_cafe_code_len_max_n = $("#piree_cafe_code_len_max_n").val();

      if ( !$("#piree_cafe_code_c").val() )
      {
      }

      if ( piree_cafe_code_len_n < piree_cafe_code_len_min_n )
      {
      }

      if ( piree_cafe_code_len_max_n < piree_cafe_code_len_n )
      {
      }

      if ( check_result_s )
      {
        $("#piree_cafe_code_check_result").html( '<span class="font_4466ff_11">'+ check_result_s +'</span>' );
        return false;
      }

      if ( !check_result_s )
      {

        $.ajax({
          url: piree_cafe_code_check_file_url,
          method: 'POST',
          data: {
            "piree_cafe_n": piree_cafe_n,
            "piree_cafe_code_c": piree_cafe_code_c
          },
        })
        .done(function(data) {

          data = JSON.parse(data);

          $("#piree_cafe_code_error_n").val(data.piree_cafe_code_error_n);

          if ( data.piree_cafe_code_error_n > 1 )
          {

            check_result_s = '<span style="color:#ff2222">'+ data.piree_cafe_code_result_s +'</span>';

          }
          else
          {

            check_result_s = '<span style="color:#2222ff">'+ data.piree_cafe_code_result_s +'</span>';

          } 

          $("#piree_cafe_code_check_result").html(check_result_s);

        });

      }

      return false;

  }


  function piree_cafe_name_check_ajax()
  {

      var check_result_s = '';

      var piree_cafe_n      = $("#piree_cafe_n").val();
      var piree_cafe_name_s = $("#piree_cafe_name_s").val();

      if ( !$("#piree_cafe_name_s").val() )
      {
      }

      if ( !check_result_s )
      {

        $.ajax({
          url: piree_cafe_name_check_file_url,
          method: 'POST',
          data: {
            "piree_cafe_n": piree_cafe_n,
            "piree_cafe_name_s": piree_cafe_name_s
          },
        })
        .done(function(data) {

          data = JSON.parse(data);

          $("#piree_cafe_name_error_n").val(data.piree_cafe_name_error_n);

          if ( data.piree_cafe_name_error_n > 1 )
          {

            check_result_s = '<span style="color:#ff2222">'+ data.piree_cafe_name_result_s +'</span>';

          }
          else
          {

            check_result_s = '<span style="color:#2222ff">'+ data.piree_cafe_name_result_s +'</span>';

          } 

          $("#piree_cafe_name_check_result").html(check_result_s);

        });

      }

      return false;

  }


  function piree_cafe_make_form_submit(gform)
  {

    if ( !gform.piree_cafe_code_c.value )
    {
      alert("카페 코드를 입력해 주세요.");
      gform.piree_cafe_code_c.focus();
      return false;
    }

    if ( !gform.piree_cafe_name_s.value )
    {
      alert("카페 코드를 입력해 주세요.");
      gform.piree_cafe_name_s.focus();
      return false;
    }

    if ( gform.piree_cafe_code_error_n.value != 0 && gform.piree_cafe_code_error_n.value != 1 )
    {
      alert("카페 코드가 올바르지 않습니다. 다시 입력해 주세요.");
      gform.piree_cafe_code_c.focus();
      return false;
    }

    if ( gform.piree_cafe_name_error_n.value != 0 && gform.piree_cafe_name_error_n.value != 1 )
    {
      alert("카페 이름 올바르지 않습니다. 다시 입력해 주세요.");
      gform.piree_cafe_name_c.focus();
      return false;
    }

    return true;

  }
