<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="Meeting.ascx.vb" Inherits="WebFoundations.WFWorkflow.Modules.UI.Meeting1" %>
<%@ Register TagPrefix="wfhtml" Namespace="WebFoundations.WFWorkflow.Services.UI" Assembly="WebFoundations.WFWorkflow.Services" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<link href='~/WFResources/Process/Styles/zuri-admin.css' rel='stylesheet' type='text/css' runat="server" />
<style type="text/css">
    .displayNone {
        display: none !important;
    }
</style>
<script type="text/javascript">
    function MaskDate(obj) {
        var chk; var prefix;
        if (obj.id.length > 11) {
            if (obj.id.substring(obj.id.length - 12) == 'txtFinalDate') prefix = obj.id.substring(0, obj.id.length - 12)
            if (obj.id.length > 13) {
                if (obj.id.substring(obj.id.length - 14) == 'txtInicialDate') prefix = obj.id.substring(0, obj.id.length - 14)
            }
        }
        var chk = obj;
        var objectInicialName = prefix + 'txtInicialDate';
        var objectFinalName = prefix + 'txtFinalDate';
        if (obj.id == objectInicialName) chk = document.getElementById(prefix + 'chkInicialDate');
        else chk = document.getElementById(prefix + 'chkFinalDate');
        if (!chk.checked) {
            var intKeyCode = event.keyCode || event.which;
            var strValor = obj.value;
            var intLengthValor = parseInt(strValor.length);
            if (intLengthValor == 16) return false;
            if (parseInt(intKeyCode) != 13) {
                if ((parseInt(intKeyCode) < 48) || (parseInt(intKeyCode) > 57)) {
                    return false;
                }
                else {
                    if (intLengthValor == 13) obj.value = strValor + ":";
                    if (intLengthValor == 10) obj.value = strValor + " ";
                    if (intLengthValor == 5 || intLengthValor == 2) obj.value = strValor + "/";
                    return true;
                }
            }
            else {
                return true;
            }
        }
        return true;
    }
    function RefreshData(objeto) {
        var txt; var txtContext; var ddl; var btn; var prefix;
        if (objeto.id.length > 11) {
            if (objeto.id.substring(objeto.id.length - 12) == 'chkFinalDate' || objeto.id.substring(objeto.id.length - 12) == 'chkLocations') prefix = objeto.id.substring(0, objeto.id.length - 12)
            if (objeto.id.length > 13) {
                if (objeto.id.substring(objeto.id.length - 14) == 'chkInicialDate') prefix = objeto.id.substring(0, objeto.id.length - 14)
            }
        }
        var chk = objeto;
        var objectInicialName = prefix + 'chkInicialDate';
        var objectFinalName = prefix + 'chkFinalDate';
        var objectLocationName = prefix + 'chkLocations';
        var hid = document.getElementById(prefix + 'hidValue');
        if (hid.value == '') hid.value = '00;00;00';
        if (objeto.id != objectInicialName && objeto.id != objectFinalName && objeto.id != objectLocationName) {
            var coll = objeto.children;
            for (var i = 0; i < coll.length; i++) {
                if (objeto.children[i].id == objectInicialName || objeto.children[i].id == objectFinalName || objeto.children[i].id == objectLocationName) chk = objeto.children[i];
            }
        }
        if (chk.id == objectInicialName) {
            txt = document.getElementById(prefix + 'txtInicialDate');
            txtContext = document.getElementById(prefix + 'txtConInicDate');
            ddl = document.getElementById(prefix + 'ddlInicialDate');
            btn = document.getElementById(prefix + 'btnInicialDate');
            if (chk.checked) {
                btn.className = btn.className.replace(' displayNone', '');
                hid.value = '1' + hid.value.substring(1);
                if (hid.value.substring(1, 2) == '0') {
                    ddl.className = ddl.className.replace(' displayNone', '');
                    txtContext.className = txtContext.className.replace(' displayNone', '');
                    txtContext.className += ' displayNone';
                    txt.className = txt.className.replace(' displayNone', '');
                    txt.className += ' displayNone';
                } else {
                    txtContext.className = txtContext.className.replace(' displayNone', '');
                    txt.className = txt.className.replace(' displayNone', '');
                    txt.className += ' displayNone';
                    ddl.className = ddl.className.replace(' displayNone', '');
                    ddl.className += ' displayNone';
                }
            } else {
                btn.className = btn.className.replace(' displayNone', '');
                btn.className += ' displayNone';
                hid.value = '0' + hid.value.substring(1);
                ddl.className = ddl.className.replace(' displayNone', '');
                ddl.className += ' displayNone';
                txtContext.className = txtContext.className.replace(' displayNone', '');
                txtContext.className += ' displayNone';
                txt.className = txt.className.replace(' displayNone', '');
            }
        } else if (chk.id == objectFinalName) {
            txt = document.getElementById(prefix + 'txtFinalDate');
            txtContext = document.getElementById(prefix + 'txtCoFinDate');
            ddl = document.getElementById(prefix + 'ddlFinalDate');
            btn = document.getElementById(prefix + 'btnFinalDate');
            if (chk.checked) {
                btn.className = btn.className.replace(' displayNone', '');
                hid.value = hid.value.substring(0, 3) + '1' + hid.value.substring(4);
                if (hid.value.substring(4, 5) == '1') {
                    txt.className = txt.className.replace(' displayNone', '');
                    txt.className += ' displayNone';
                    txtContext.className = txtContext.className.replace(' displayNone', '');
                    ddl.className = ddl.className.replace(' displayNone', '');
                    ddl.className += ' displayNone';
                } else {
                    txt.className = txt.className.replace(' displayNone', '');
                    txt.className += ' displayNone';
                    txtContext.className = txtContext.className.replace(' displayNone', '');
                    txtContext.className += ' displayNone';
                    ddl.className = ddl.className.replace(' displayNone', '');
                }
            } else {
                btn.className = btn.className.replace(' displayNone', '');
                btn.className += ' displayNone';
                hid.value = hid.value.substring(0, 3) + '0' + hid.value.substring(4);
                ddl.className = ddl.className.replace(' displayNone', '');
                ddl.className += ' displayNone';
                txtContext.className = txtContext.className.replace(' displayNone', '');
                txtContext.className += ' displayNone';
                txt.className = txt.className.replace(' displayNone', '');
            }
        } else {
            txt = document.getElementById(prefix + 'txtLocations');
            ddl = document.getElementById(prefix + 'ddlLocations');
            //btn = document.getElementById('btnLocations');
            if (chk.checked) {
                //btn.className = '';
                hid.value = hid.value.substring(0, 6) + '11';
                ddl.className = ddl.className.replace(' displayNone', '');
                txt.className = txt.className.replace(' displayNone', '');
                txt.className += ' displayNone';
            } else {
                //btn.className = 'displayNone';
                hid.value = hid.value.substring(0, 6) + '00';
                ddl.className = ddl.className.replace(' displayNone', '');
                ddl.className += ' displayNone';
                txt.className = txt.className.replace(' displayNone', '');
            }
        }
    }
    function ChangeControl(obj) {
        var ddl; var txt; var txtContext; var prefix;
        if (obj.id.length > 11) {
            if (obj.id.substring(obj.id.length - 12) == 'btnFinalDate') prefix = obj.id.substring(0, obj.id.length - 12)
            if (obj.id.length > 13) {
                if (obj.id.substring(obj.id.length - 14) == 'btnInicialDate') prefix = obj.id.substring(0, obj.id.length - 14)
            }
        }

        var objectInicialName = prefix + 'btnInicialDate';
        var objectFinalName = prefix + 'btnInicialDate';
        var hid = document.getElementById(prefix + 'hidValue');
        if (obj.id == objectInicialName) {
            ddl = document.getElementById(prefix + 'ddlInicialDate');
            txt = document.getElementById(prefix + 'txtInicialDate');
            txtContext = document.getElementById(prefix + 'txtConInicDate');
            if (hid.value.substring(1, 2) == '0') {
                hid.value = hid.value.substring(0, 1) + '1' + hid.value.substring(2);
                ddl.className = ddl.className.replace(' displayNone', '');
                ddl.className += ' displayNone';
                txt.className = txt.className.replace(' displayNone', '');
                txt.className += ' displayNone';
                txtContext.className = txtContext.className.replace(' displayNone', '');
            } else {
                hid.value = hid.value.substring(0, 1) + '0' + hid.value.substring(2);
                ddl.className = ddl.className.replace(' displayNone', '');
                txt.className = txt.className.replace(' displayNone', '');
                txt.className += ' displayNone';
                txtContext.className = txtContext.className.replace(' displayNone', '');
                txtContext.className += ' displayNone';
            }
        } else {
            ddl = document.getElementById(prefix + 'ddlFinalDate');
            txt = document.getElementById(prefix + 'txtFinalDate');
            txtContext = document.getElementById(prefix + 'txtCoFinDate');
            if (hid.value.substring(4, 5) == '0') {
                hid.value = hid.value.substring(0, 4) + '1';
                ddl.className = ddl.className.replace(' displayNone', '');
                ddl.className += ' displayNone';
                txt.className = txt.className.replace(' displayNone', '');
                txt.className += ' displayNone';
                txtContext.className = txtContext.className.replace(' displayNone', '');
            } else {
                hid.value = hid.value.substring(0, 4) + '0';
                ddl.className = ddl.className.replace(' displayNone', '');
                txt.className = txt.className.replace(' displayNone', '');
                txt.className += ' displayNone';
                txtContext.className = txtContext.className.replace(' displayNone', '');
                txtContext.className += ' displayNone';
            }
        }
        return false;
    }
</script>
<style type="text/css">
    .labelMeeting {
        display: inline-block;
        width: 100px;
    }

    .textboxMeeting {
        float: none !important;
        display: inline-block !important;
        width: 45% !important;
    }

    .buttonMeeting, input[type=image] {
        width: auto !important;
        margin: 3px 8px -8px 8px !important;
        float: none !important;
        display: inline-block !important;
    }

    .comboMeeting {
        float: none !important;
        display: inline-block !important;
    }

    .displayNone {
        display: none !important;
    }

    .checkMeeting {
        float: none !important;
        display: inline-block !important;
        width: 120px !important;
    }

        .checkMeeting label {
            width: 85px !important;
        }
</style>
<section class="geralForm">
    <div class="itemForm">
        <div class="tituloModEmail">
            <asp:Label ID="lbltitulo" runat="server" />
        </div>
    </div>
    <asp:Panel ID="pnldestination" Visible="false" CssClass="itemForm" runat="server">
        <label>
            <asp:Label ID="lbltitdest" runat="server" Text="Destinatários" />
        </label>
        &nbsp(<asp:Label ID="lbldest" runat="server" Text="Destinatários" />)<br>
        <asp:TextBox ID="txtdestinatarios" Width="250px" runat="server" />
    </asp:Panel>
    <asp:Panel ID="pnldestinationCopy" Visible="false" CssClass="itemForm" runat="server">
        <label>
            <asp:Label ID="lblTitDestCopy" runat="server" Text="Destinatários cópia" />
        </label>
        &nbsp(<asp:Label ID="lblDestCopy" runat="server" Text="Destinatários cópia" />)<br>
        <asp:TextBox ID="txtDestinatariosCopy" Width="250px" runat="server" />
    </asp:Panel>
    <asp:Panel ID="pnldestinationHiddenCopy" Visible="false" CssClass="itemForm" runat="server">
        <label>
            <asp:Label ID="lblTitDestHiddenCopy" runat="server" Text="Destinatários cópia oculta" />
        </label>
        &nbsp(<asp:Label ID="lblDestHiddenCopy" runat="server" Text="Destinatários cópia oculta" />)<br>
        <asp:TextBox ID="txtDestinatariosHiddenCopy" Width="250px" runat="server" />
    </asp:Panel>
    <div class="linhaPontilhada"></div>
    <asp:Panel ID="pnlData" Visible="false" CssClass="itemForm" runat="server">
        <asp:HiddenField ID="hidValue" runat="server" Value="00;00;00" />
        <table>
            <tr style="height: 32px;">
                <td>
                    <asp:Label ID="lblInicialDate" runat="server" Text="Data início" CssClass="labelMeeting" /></td>
                <td style="width: 400px;">
                    <telerik:RadComboBox CssClass=" comboMeeting displayNone" ID="ddlInicialDate" runat="server" />
                    <asp:TextBox CssClass="textboxMeeting" ID="txtConInicDate" runat="server" />
                    <asp:TextBox CssClass="textboxMeeting" ID="txtInicialDate" runat="server" onKeyPress="return MaskDate(this, event);" />
                    <asp:ImageButton CssClass="buttonMeeting displayNone" ID="btnInicialDate" runat="server" OnClientClick="return ChangeControl(this);" ImageUrl="~/WFResources/Process/images/meeting.png" />
                    <asp:CheckBox ID="chkInicialDate" CssClass="checkMeeting" runat="server" Text="Utilizar contexto" Checked="false" onClick="RefreshData(this);" />
                </td>
            </tr>
            <tr style="height: 32px;">
                <td>
                    <asp:Label ID="lblDataFim" runat="server" Text="Data fim" CssClass="labelMeeting" /></td>
                <td style="width: 400px;">
                    <telerik:RadComboBox CssClass=" comboMeeting displayNone" ID="ddlFinalDate" runat="server" />
                    <asp:TextBox CssClass="textboxMeeting" ID="txtCoFinDate" runat="server" />
                    <asp:TextBox CssClass="textboxMeeting" ID="txtFinalDate" runat="server" onKeyPress="return MaskDate(this, event);" />
                    <asp:ImageButton CssClass="buttonMeeting displayNone" ID="btnFinalDate" runat="server" OnClientClick="return ChangeControl(this);" ImageUrl="~/WFResources/Process/images/meeting.png" />
                    <asp:CheckBox ID="chkFinalDate" CssClass="checkMeeting" runat="server" Text="Utilizar contexto" Checked="false" onClick="RefreshData(this);" />
                </td>
            </tr>
            <tr style="height: 32px;">
                <td>
                    <asp:Label ID="lblLocation" runat="server" Text="Local" CssClass="labelMeeting" /></td>
                <td style="width: 400px;">
                    <telerik:RadComboBox CssClass=" comboMeeting displayNone" ID="ddlLocations" runat="server" />
                    <asp:TextBox CssClass="textboxMeeting" ID="txtLocations" runat="server" MaxLength="500" />
                    <asp:CheckBox ID="chkLocations" CssClass="checkMeeting" runat="server" Text="Utilizar contexto" Checked="false" onClick="javascript:RefreshData(this);" />
                </td>
            </tr>
        </table>
    </asp:Panel>
    <div class="linhaPontilhada"></div>
    <asp:Panel ID="pnlMensagem" Visible="false" CssClass="itemForm" runat="server">
        <label>
            <asp:Label ID="lblmensagem" runat="server" Text="Mensagem" /></label><br>
        <br>
        <wfhtml:ZuriHTMLEditor width="100%" Height="600px" runat="server" ID="HTMLContent" />
    </asp:Panel>
    <div class="posBtnAnexoModulos">
        <asp:Button ID="btnok" CssClass="btn_itemProcesso" runat="server" Text="OK" />
    </div>
</section>
