<%@ Page Language="VB" AutoEventWireup="true" CodeBehind="Recaptcha.aspx.vb" Inherits="EnsinoBasico.Recaptcha.AspxPage" %>

<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
    <title>reCaptcha</title>
    <script src="Resources.Gizmox.WebGUI.Forms.Skins.CommonSkin.Interfaces.js.wgx" type="text/javascript"></script>
    <script type="text/javascript">
        var onloadCallback = function () {
            grecaptcha.render('html_element', { 'sitekey': '<%= SiteKey %>', 'callback': 'onValidResponse' });

            ShowButton()
        };

        function ShowButton() {
            var buttonID = '<%= btnGo.ClientID %>';
            var button = document.getElementById(buttonID);
            if (button) { button.style.display = 'inherit'; }
        }

        function RaiseEvents() {
            VWG.Events.RaiseEvents();
        }

        function onValidResponse(response) {
            // Simulamos o click
            document.getElementById("btnGo").click();
        }
    </script>
    <style type="text/css">
        .html_element{
            float: left;
        }
            
        #hidden{
            display: none;
        }
    </style>
</head>
<body>
    <form id="Form1" runat="server">
    <div id="html_element" style="float: left;">
    </div>
    <div class="hidden" style="display: none;">
        <asp:Button ID="btnGo" runat="server" OnClick="btnGo_Click" Text="Entrar" Style="display: none;"
            CssClass="hidden" />
    </div>
    </form>
    <script type="text/javascript" src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit&hl=pt-PT"
        async defer></script>
</body>
</html>
