$(function() {
					
	var submit = function() {
		$('#brandLogo').after('<p id="spin" class="mt-3"><i class="fa fa-spin fa-spinner fa-2x"></i></p>');
			
		$.post($('#signForm').attr('action'), $('#signForm').serialize(), function(data) {
			if(data.success) {
		      window.location = $('#redirectURL').val().replace("{response}", data.response);
		    }
		    $('#spin').remove();
		    JadaptiveUtils.error(null, data.message);
		}, 'json');
	};
	
	if($('#fingerprintDropdown .jdropdown').length === 1) {
		submit();
	} else {
		$('#fingerprint').change(function(e) {
			e.preventDefault();
			if($(this).val()!=='') {
				submit();	
			}
		});
	}	
});