<?php
//set_time_limit(0);
if (isset($_GET['mes']))
    $mes_hoje = $_GET['mes'];
else
    $mes_hoje = date('m');

if (isset($_GET['ano']))
    $ano_hoje = $_GET['ano'];
else
    $ano_hoje = date('Y');
?> 

<div id="guardar" class="modal fade" tabindex="-1" role="dialog">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">
            <div class="modal-body ">
                <div class="alert alert-info alert-dismissable">
                    <strong>Desea Registrar?</strong> 
                </div>
                <div id="resul_fac"></div>
                <div class="">
                <!--  <label>Envio por Email</label>
                    <select  class="form-control" name="fac_estado_email" id="fac_estado_email"  onChange="correo(this)">>
                            <option value="01"> Desactivado</option>
                            <option value="02"> Activado </option>
                    </select>-->
                    <input type="hidden"  name="fac_estado_email" id="fac_estado_email" class="form-control" autocomplete="off"  value="01" >
                </div> <!-- /.form-group -->
                <div id="1" style="display: none">
                    <div class="">
                        <label>Email</label>
                        <input type="number"  name="email" id="email" class="form-control" autocomplete="off"  value="" >
                    </div> <!-- /.form-group -->
                    <div class="">
                        <label>Asunto</label>
                        <input type="number"  name="fac_asunto" id="fac_asunto" class="form-control" autocomplete="off"  value="" >
                    </div> <!-- /.form-group -->
                    <div class="">
                        <label>Mensaje</label>
                        <textarea rows="4" class="form-control" name="fac_msj" id="fac_msj" ></textarea>
                    </div> <!-- /.form-group -->
                </div>
                <div id="0" style="display:">
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
                    <button id="btn_fac" type="submit" class="btn btn-success"><i class="icon-ok"></i> <strong>Registrar</strong></button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div>
</div>
<script>
$( "#form_fac" ).submit(function( event ) {
  $('#btn_fac').attr("disabled", true);
 var parametros = $(this).serialize();
   $.ajax({
      type: "POST",
      url: "php_facturacion_periodica/registrar_contrato.php",
      data: parametros,
        beforeSend: function(objeto){
         $('#resul_fac').html('<center><img src="./img/ajax-loader.gif"> CARGANDO...</center>');
        },
      success: function(datos){
      $("#resul_fac").html(datos);
      $('#btn_fac').attr("disabled", false);
      load(1);
      }
  });
  event.preventDefault();
  loadTabla();
}) 

function correo(sel) {
      if (sel.value=="02"){
           divC = document.getElementById("1");
           divC.style.display = "";
           divT = document.getElementById("0");
           divT.style.display = "none";
      }else  {

           divC = document.getElementById("1");
           divC.style.display="none";

           divT = document.getElementById("0");
           divT.style.display = "";
      }
}
</script>