(function () {
	var app = angular.module("app");
	app.controller('ThankyouPageController', Controller);
	Controller.$inject = ['$scope', '$timeout', '$http'];

	function Controller($scope, $timeout, $http) {
		var vm = this;
		vm.requestInProgress = false;

		var waitIntgrtn = setInterval(function () {
			if (!window.intgrtn) {
				return false;
			}
			clearInterval(waitIntgrtn);

			vm.signupRequestID = window.intgrtn.lookup("signupRequestID", true);
			vm.brokerLogo = window.intgrtn.lookup("brokerLogo", true);
			$scope.$applyAsync();

			vm.goToDepositPage = function (event) {
				event.preventDefault();
				if (window.intgrtn.lookup("signupRequestID", true)) {
					vm.requestInProgress = true;
					window.intgrtn.goToBrokerLoginUrlBySignupRequestID(window.intgrtn.lookup("signupRequestID", true));
				} else {
					vm.requestInProgress = false;
					window.location.href = "/";
				}
			};
		}, 20);
	}
}());