// prepare the form when the DOM is ready 
$(document).ready(function() { 
    var options = { 
        target:        '#signup',   // target element(s) to be updated with server response 
        beforeSubmit:  verifyRequired,  // pre-submit callback 
        type:      	   'get'        // 'get' or 'post', override for form's 'method' attribute 
    }; 
 
    // bind to the form's submit event 
    $('#icpsignup').submit(function() { 
        // inside event callbacks 'this' is the DOM element so we first 
        // wrap it in a jQuery object and then invoke ajaxSubmit 
        $(this).ajaxSubmit(options); 
 
        // !!! Important !!! 
        // always return false to prevent standard browser submit and page navigation 
        return false; 
    }); 
}); 

function verifyRequired() {
	if (document.icpsignup["fields_email"].value == "") {
		document.icpsignup["fields_email"].focus();
		alert("The Email field is required.");
		return false;
	}

	$('.signup').hide();
	$('.signup').html("<h1>Thank You!</h1>");
	$('.signup').fadeIn("slow");
	
	return true;
}