//	Performs the validation of the Search Again form.
//	Must be included after the communfunctions.js file.
//
//	Returns:
//	false:	If any validation fails.
//	true:	If validation passes.
function validateSearchAgainForm(type)
{
	var form = document.searchagainform;
	var bReturn = true;
	var bEmpty = false;
	var msgInvalid = "";
	var bIsNav = true;
	
	bIsNav = isNav4();
	if (bIsNav) {
 		return true;
	}
	
	//alert("type = " + type);
		
	//**
	//	FREETEXT FIELD VALIDATION.
	//**
	
	// Determine if value is entered
	bEmpty = isEmptyNoSpace(form.FreeText);

	if(bEmpty)
	{
		bReturn = false;
		form.FreeText.focus();
		alert("I'm sorry, in order to complete your search you "
				+ "need to provide more information. Please check "
				+ "the spelling and try again.");
	} // End if
	
	// Determine if 
	if(bReturn)
	{
		if(!isValidLength(form.FreeText, 1))
		{
			bReturn = false;
			form.FreeText.focus();
			alert("I'm sorry, in order to complete your search you need "
				+ "to provide more information. Please enter at least two "
				+ "characters.");
		} // End if
	} // End if
	
	// Determine if free text field contains not allowed characters.
	if(bReturn)
	{
		msgInvalid = validateSearchFreeText(form.FreeText)
		
		if(msgInvalid != "")
		{
			bReturn = false;
			alert("I'm sorry, you have supplied letters or numerals "
					+ "that will not function in this form. " + msgInvalid);
		} // End if
	} // End if
	
	
	//**
	//	SEARCH TYPE LIST FIELD VALIDATION.
	//**
	// Determine if a value was selected.
	if(bReturn && !checkSelectListNoMsg(form.searchbooleantype))
	{
		bReturn = false;
		form.searchbooleantype.focus();
		
		alert("I'm sorry, in order to complete your search you need "
			+ "to provide more information. Please select one valid "
			+ "containing option.");		
	} // End if

	// Determine if a value was as per the pre-defined values.
	var sValue = getSelectValue(form.searchbooleantype);
	
	if(bReturn && sValue != "any" && sValue != "all" && sValue != "exact")
	{
		bReturn = false;
		form.searchbooleantype.focus();
		
		alert("I'm sorry, in order to complete your search you need "
			+ "to provide more information. Please select one valid "
			+ "containing option.");		
	} // End if
	
	//**
	//	SHOW RADIO BUTTON FIELD VALIDATION.
	//**
	
	if(bReturn && getRadioValue(form.displayOption) == null)
	{
		bReturn = false;
		//form.displayOption.focus();
		
		alert("I'm sorry, in order to complete your search you need "
			+ "to provide more information. Please select one valid "
			+ "display option.");		
	} // End if.
	
	//**
	//	IN RADION BUTTON FIELD VALIDATION
	//	ONLY PERFORMED IF 'MORE' IS INCLUDED.
	//**
	if(bReturn && (type != null && type == "more"))
	{
		if(getRadioValue(form.inoption) == null)
		{
			bReturn = false;
			alert("I'm sorry, in order to complete your search you need "
				+ "to provide more information. Please select one valid "
				+ "Search in option.");
		} // End if
	} // End if	
	return bReturn
} // End validateSimpleSearchForm
