﻿
function submitme()
{
	var focusOn  = "";
	var alertMsg = "";
	/*
  if(trim($("tbFirstName").value) == "")
  {
  	focusOn = "tbFirstName";
  	$(focusOn).style.backgroundColor = "yellow";
  	
  	alertMsg += " - Please enter your first name\n";
  }
  
  if(trim($("tbLastName").value) == "")
  {
  	focusOn = "tbLastName";
  	$(focusOn).style.backgroundColor = "yellow";
  	
  	alertMsg += " - Please enter your last name\n";
  }
  */
  if(trim($("tbEmailAddress").value) == "")
  {
  	focusOn = "tbEmailAddress";
  	$(focusOn).style.backgroundColor = "yellow";
  	
  	alertMsg += " - Please enter your email address\n";
  }
  else if(validEmail(trim($("tbEmailAddress").value)) == false)
  {
  	focusOn = "tbEmailAddress";
  	$(focusOn).style.backgroundColor = "yellow";
  	
  	alertMsg += " - Your email address seems badly formatted\n";
  }
  
  if(trim($("tbComments").value) == "")
  {
  	focusOn = "tbComments";
  	$(focusOn).style.backgroundColor = "yellow";
  	
  	alertMsg += " - Please enter at least one comment or question\n";
  }
  /*
  if(trim($("tbAddress").value) == "")
  {
  	focusOn = "tbAddress";
  	$(focusOn).style.backgroundColor = "yellow";
  	
  	alertMsg += " - Please enter your mailing address\n";
  }
  
  if(trim($("tbCity").value) == "")
  {
  	focusOn = "tbCity";
  	$(focusOn).style.backgroundColor = "yellow";
  	
  	alertMsg += " - Please enter your city\n";
  }
  
  if(trim($("tbState").value) == "")
  {
  	focusOn = "tbState";
  	$(focusOn).style.backgroundColor = "yellow";
  	
  	alertMsg += " - Please enter your state or province of residence\n";
  }
  */
  if(alertMsg != "")
  {
  	alert("There are a few required fields in this form.\n\nPlease correct the following before continuing:\n" + alertMsg);
  	return false;
  }
  else
  {
  	$("Form1").submit();
  }
}
