$(document).ready(function() {
	event_listener();
});

// This function waits until the specified form has been submitted, then sends the # field to the new processor
function event_listener() {
	$('#submit_btn').click(function() {
	if (!(UPTvalidateform(document.UPTml38529))) {
  	  var checkbox = $('#mobile_check');
    	var numfield = $('#mobile_num').val();
  	  if (checkbox.attr('checked')) {
        $.ajax({
    			url: 'curl.php?n=' + numfield,
    			success: function(r) {
    				$('#spm_form').submit();
    			}
  		  });
  		} else {
        $('#spm_form').submit();
      }
    }
	});
}
