// jQuery ------------------------------------------------------------------------------//
$(document).ready(function(){ 

// post settings -----------------------------------------------------------------------//
var options = {
	url:	'code/dashboard.cfm?action=login', 
	success: showResponse	};
		
	$('#form_login').ajaxForm(options); 

// End -------------------------------------------------------------------------------- //
});

// login response functions -------------------------------------------------------------- //
function showResponse(responseText) {
		$("#systemMsg").hide();
		setTimeout("hideLoader()",2000); 
		setTimeout("showError("+responseText+")",2000)
		}

function showError(responseText) {
	if(responseText == 0) {
			$("#systemMsg").empty();
			$("#systemMsg").append("Invalid login, please check and try again.");
			$("#systemMsg").show(); } else if(responseText == 1) { 
											  document.location.href='/dashboard';
											  }
	}
// End -------------------------------------------------------------------------------- //

// Loader icon functions -------------------------------------------------------------- //
function showLoader() {
	$(".submitButton").hide();
	$(".loadingButton").show(); }
	
function hideLoader() {
	$(".loadingButton").hide();
	$(".submitButton").show(); }
// End -------------------------------------------------------------------------------- //
