<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="FormsChildContainer.aspx.vb" Inherits="WebFoundations.WFForms.UI.FormsChildContainer" %>

<!DOCTYPE html>
<html>
<head>
    <title><%=Request.QueryString("titulo")%></title>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="format-detection" content="telephone=no">
    <meta http-equiv="pragma" content="no-cache">
    <base target="_self">
    <script src="/theme/html5" type="text/javascript"></script>
    <link href="/theme/styles" rel="stylesheet" type="text/css" />
    <link rel="shortcut icon" href="/favicon.ico?v=2" type="image/x-icon" />
    <script src="/theme/scripts"></script>
    <script type="text/javascript">
        function RefreshOpener() {
            try {
                var p = window.opener || window.parent;
                if (p && p.NinkiWeb && p.NinkiWeb.UpdateForm) {
                    p.NinkiWeb.UpdateForm();
                }
            } catch (error) { console.log("RefreshOpener " + error); }
            if (window.self == window.top) {
                window.close();
            }
        }
        $(document).ready(
            function () {
                if (window.self != window.top) {
                    var actions = $("section.form-action.actions");
                    if (actions && actions.length) {
                        var btn = document.createElement("button");
                        btn.innerText = "Cancelar";
                        btn.onclick = function (e) {
                            RefreshOpener();
                            if (e) { e.preventDefault(); }
                            return false;
                        };
                        actions.append(btn);
                    }
                }
                $("body").removeClass("loading");
            });
    </script>
</head>
<body class="wf-form-web-child loading" title="<%=Request.QueryString("titulo")%>">
    <form runat="server">
        <asp:ScriptManager runat="server" />
        <asp:PlaceHolder ID="pchForm" runat="server" />
        <asp:PlaceHolder ID="lblPostBack" runat="server" Visible="False">
            <script type="text/javascript">
                window.onload = RefreshOpener;
            </script>
        </asp:PlaceHolder>
    </form>
</body>
</html>
