
  function submitForm(){
    if(validateForm()){
      document.getElementById('login-form').submit()
    }
  }
  
  function validateForm(){
		var message = ""
		var highlighColour = '#F4D8D6';
		document.getElementById('email').style.backgroundColor = '#FFFFFF';
		document.getElementById('password').style.backgroundColor = '#FFFFFF';
		
		if (!validateEmailAddress(document.getElementById('email'))){
		  document.getElementById('email').style.backgroundColor = highlighColour ;
		  message += "   Please enter a valid email address\n";
		}
		if (document.getElementById('password').value==''){
		  document.getElementById('password').style.backgroundColor = highlighColour ;
		  message += "   Please enter a password\n";
		}
		if (!validatePostcode(document.getElementById('password'))) document.getElementById('password').focus();
		if (!validateEmailAddress(document.getElementById('email'))) document.getElementById('email').focus();
		
		if (message.length == 0){
			return true;
		}
		else {
			message = "Please check the following information:\n\n" + message;
			alert(message);
			return false;
		}
  }

  
  

