//	Performs the validation of the QA forum form (used for both suggesting a topic and asking a question)
//	Must be included after the communfunctions.js file.
//
//	Returns:
//	false:	If any validation fails.
//	true:	If validation passes.
function validateQAForumForm()
{
	var form = document.qaForumForm;
	var comments = form.Comments;
	var email = form.Email;
	var name = form.SubmitterName;
	var subject = form.Subject;
	var bReturn = true;
	var bEmpty = false;
	var sErrorMessage = "";
	
	var submissionType;
	// Determine what type of submission was made
	if(subject.value == "QA Forum Question")
	{
	    submissionType = "question";
	}
	else
	{
	    submissionType = "suggested topic";
	}
	
	// Determine if value is entered

	bEmpty = isEmptyNoSpace(comments);

	if(bEmpty)
	{
		bReturn = false;
		alert("I'm sorry, you cannot complete this form unless all the mandatory information "
			+ "(marked with a red asterix) is complete. Please enter your " + submissionType + ".");
		chgFocus(comments);
	} // End if
	
	// Determine if 
	if(bReturn)
	{
		if(!isValidLength(comments, 14))
		{
			bReturn = false;
			alert("I'm sorry, you have not supplied enough letters or numerals for your " + submissionType + "."
				+ " Please enter at least fifteen characters.");
			chgFocus(comments);
		} // End if
	} // End if

	// Determine if text area field contains invalide characters
	if(bReturn)
	{
		sErrorMessage = validateTextBox(comments);
		bReturn = (sErrorMessage=="");
		
		if(!bReturn)
		{
			alert(sErrorMessage);
			chgFocus(comments);
		} // End if
	} // End if	



	//validate name field
	if(bReturn)
	{
		sErrorMessage = validateName(name);
		bReturn = (sErrorMessage=="");
		
		if(!bReturn)
		{
			alert(sErrorMessage);
			chgFocus(name);
		} // End if
	} // End if	
	
	//validate email field
	if(bReturn) {

		sErrorMessage = validateEmail(email);

		if(sErrorMessage != "")
		{
		  alert (sErrorMessage);
			bReturn = false;
			chgFocus(email);
		 }	
	}	

	return bReturn;
	
} // End validateQAForumForm

