function check_login() {
	$("#loader").html("<img src='../site_core/images/35-2.gif' alt='Validating Account...' style='vertical-align: middle'/>").fadeIn('slow');
	$("#log-message").html("").fadeOut('slow');
	un = $("#un").val();
	pw = $("#pw").val();
	
	email_check = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
        nc = /^(([a-z]+)(\.)([a-z]+))$/;
	
	error = false;
	if (!nc.test(un) || !pw) {
		error = true;
		$("#log-message").html("<div style='background: pink;padding: 5px;'>Invalid Username/Password, please try again. If you continue to have troubles please use the link above.</div>").fadeIn('slow');
		$("#un").focus();
	} else {
		error = false;
		$("#log-message").html("");
	}
	params = $("form").serialize();
	if (error == false) {
		$("#loader").html("").fadeOut('slow');
		$.post("/site_core/libs/ajax_validate.php",params,function(data) {
			if (data.login == "good") {
				var goto = "http://academymortgage.com/dashboard/";
				location.href = goto;
			} else {
				$("#log-message").html("<div style='background: pink;padding: 5px;'>Invalid Username/Password, please try again. If you continue to have troubles please use the link above.</div>").fadeIn('slow');
				$("#un").focus();
			}
		},"json");
	}
	
	//console.log(error);
	return false;
}
