<?php use_helper('UrlFunctions'); ?>
<?php use_helper( 'IncludePartial' ); ?>
<script>
mostrarCargaImg = function(){ $('#s_ImagenLoad')[0].style.display = 'inline'; }
ocultarCargaImg = function(){ $('#s_ImagenLoad')[0].style.display = 'none'; }

mostrarMensajeError = function( s_MensajeError )
{
    $( "#resultContent" ).html( '<div id="mensaje_error_content" class="error">' + s_MensajeError + '</div>' );
    setTimeout( function(){ $( "#mensaje_error_content" ).fadeOut( 800 ).fadeIn( 800 ).fadeOut( 500 ).fadeIn( 500 ).fadeOut( 300 ); }, 4000 );
}
</script>
<script>
ejecutarEliminar = function()
{
    mostrarCargaImg();
    var strFormSerialize = $( 'form' ).serialize();
    executeAjaxJson( 
                        "<?php echo buildUrl( $NomMod.'/deleteRow' ) ?>", 
                        strFormSerialize,
                        function( o_json )
                        {
                            if( o_json.error )
                            {
                                ocultarCargaImg();
                                mostrarMensajeError( o_json.mensaje_error );
                                return false;
                            }
                            parent.findControl();
                            parent.$( '#dialog' ).dialog( 'close' );
                            return true;
                        } 
                   );
}
</script>
<table class="cuerpo" width="98%" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td valign="top">
            <form id="form1" name="form1" method="POST" onsubmit="return false;"  enctype="multipart/form-data">
                <input type="hidden" name="s_TipoProc" id="s_TipoProc" value="<?=$TipoProc?>">
                <input type="hidden" name="TypeSub" id="TypeSub" value="0">
                <table class="" width="100%">
                    <tr>
                        <td valign="top">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td class="marco marcoTitle">
                                        <table class="" width="100%" border="0" cellspacing="0" cellpadding="0">
                                            <tr>
                                                <td width="100%" valign="top">

                                                    <?php include_partial( 
                                                                            "addedit", 
                                                                            array( 
                                                                                    "o_DefaultBN" => $o_DefaultBN,
                                                                                    "NomMod" => $NomMod,
                                                                                 )
                                                                         ); ?>
                                                    <script> $( "#form1 input:text, select, textarea" ).prop( "disabled", true ); </script>
                                                    <script> $( "#form1 input:checkbox" ).attr( "disabled", true ); </script>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <table width="100%" border="0" style="margin-top: 10px;">
                                            <tr>
                                                <td align="right" width="55%">
                                                    <input type="button" class="button" value="Cerrar" onclick="parent.$( '#dialog' ).dialog( 'close' );">
                                                    <?php if( $TipoProc ==  "dlt" ){ ?>
                                                    <input type="button" class="button" value="Eliminar" onclick="eliminarRegistro();">
                                                    <?php } ?>
                                                </td>
                                                <td width="45%">
                                                    <div id="s_ImagenLoad" style="display: none;"><img src="<?php echo Constantes::ROOT_DIR_APP ?>web/images/progress.gif" border="0"/>&nbsp;<label class="laber req">Grabando...</label></div>
                                                    &nbsp;
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </form>
        </td>
    </tr>
    
</table>

<script>
eliminarRegistro = function()
{
    x = confirm( "Esta seguro de eliminar el registro?" )
    if( x )
    {
        ejecutarEliminar();
    }
}
</script>