<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="SignIn.aspx.vb" Inherits="InovarPAA.SignIn" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"  style="width:100%; height: 100%; background-color: white; overflow: hidden;">
<head runat="server">
    <script src="Resources.Gizmox.WebGUI.Forms.Skins.CommonSkin.Interfaces.js.wgx" type="text/javascript"></script>
	<title></title>
</head>
<body style="width:100%; height: 100%; background-color: white; overflow: hidden; margin: 0 !important;">
	<iframe style="width:100%; height: 100%; border:none;" src="https://apoio.inovarmais.com/WebComponent/GoogleSignIn/SignInExterno.aspx" title="X"></iframe>

	<script>
		if (window.addEventListener) {
			window.addEventListener("message", onMessage, false);        
		} 
		else if (window.attachEvent) {
			window.attachEvent("onmessage", onMessage, false);
		}

		function onMessage(event) {
			// Check sender origin to be trusted
			//if (event.origin !== "http://example.com") return;

			var data = event.data;

			console.log(data);
			
			if (typeof(window[data.func]) == "function") {
				window[data.func].call(null, data.message);
			}
		}

		// Function to be called from iframe
		function parentFunc(message) {
			console.log(message);
			setTimeout(function () { 
                var objEvent = VWG.Events.CreateEvent("<%= PageContext.ID %>", "goToken"); 
                VWG.Events.SetEventAttribute(objEvent, "Token", message); 
                VWG.Events.RaiseEvents(); 
            }, 0);
		}
	</script>
</body>
</html>