	/*  ===================================================================================================
	Website Design and Coding by:
	John M Weizenblut / jweizenblut@gmail.com 
	==================================================================================================== */

// JavaScript Document

	function submit_login()
		{
			var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
			
			if ( $('#email').val() == "" )
				{
					$("#contact_error").html("<font color=#FF0000>E-mail is a required field.</font>");		
					$("#email").focus();
					return false;
				}
			else
				{
					if ( $('#email').val().search(emailRegEx) == -1)
						{
							$("#contact_error").html("<font color=#FF0000>A valid e-mail address is required.</font>");	
							$("#email").focus();									
							return false;
						}
				}							
				
			if ( $('#psw').val() == "" )
				{
					$("#contact_error").html("<font color=#FF0000>Password is a required field.</font>");		
					$("#psw").focus();
					return false;
				}

			var html_email = $.ajax({ type: "POST", url: "ajax/check_login.php", data: "email=" + $('#email').val() + "&psw=" + $('#psw').val(), async: false }).responseText;
			if ( html_email == "" )
				{
					document.forms["data_entry"].submit();
//							return false;
				}
			else
				{
					$("#contact_error").html("<font color=#FF0000>E-mail & Password combination not valid or not activated.</font>");
					$("#email").val('');
					$("#psw").val('');
					$("#email").focus();
					return false;
				}
		}
