/**
 * submitDemo.js
 */

$(document).ready(function() {
	
	$("#submitButton").click(function () {
		//Change submission type
		$("#submitType").val("ajax");
	});
	
	$('#login_form').submit(function() {
        $(this).ajaxSubmit(submitOptions);
		return false;
    });	
	
	var submitOptions = {
        target:        '#ajaxResult',   // target element(s) to be updated with server response
        beforeSubmit:  showProcessing,  // pre-submit callback
        success:      hideProcessing,  // post-submit callback
        url: "/components/login/doLogin.cfm"
	};

}); // end of ready function

function showProcessing() {
	$("#submitButton").attr("disabled","disabled");
	$("#ajaxResult").addClass("hideElement");
	$("#processingMessage").removeClass("hideElement");
} //end of showProcessing function

function hideProcessing() {
	$("#processingMessage").addClass("hideElement");
	$("#ajaxResult").removeClass("hideElement");
	$("#submitButton").attr("disabled",false);
} //end of hideProcessing function