function initialize()
{
	return;
}


function checkForm(formId)
{
	//alert("Check Form.");
	
	
	
	var isFormAcceptable = true,
		isQuestionAcceptable,
		i = 0,
		j = 0,
		options,
		oneOption,
		targetForm = document.getElementById(formId),
		questions = targetForm.getElementsByTagName("li"), //Get each <li>
		oneQuestion;
	
	while( oneQuestion = questions[i++] )
	{
		if( oneQuestion.className.match("required") )
		{
			isQuestionAcceptable = false;  
	
			//Check for <textareas>, they get a free pass.
			var options = oneQuestion.getElementsByTagName("textarea");
			j = 0;
			while( oneOption = options[j++] )
				isQuestionAcceptable = true;
			
			
			//Get each <input> inside each <li>, cancelling anything from a text area
			var options = oneQuestion.getElementsByTagName("input");
			j = 0;
			while( oneOption = options[j++] )
			{
				//For radios and checkboxes, iterate until a checked is found
				if( oneOption.type == "radio" || oneOption.type == "checkbox" )
				{
					if( oneOption.checked )
					{
						isQuestionAcceptable = true;
						break;	
					}
					else
						isQuestionAcceptable = false;
				}
				
				
				//For text inputs, make every single one has a value
				else if( oneOption.type == "text" )
				{
					//Has a value
					if( oneOption.value )
						isQuestionAcceptable = true;
					
					//Does not have a value, stops all
					else
						isQuestionAcceptable = false;
				}
			} //For each <input>
			
			
			
			//If the question is not acceptable, mark it as wrong
			if( !isQuestionAcceptable )
			{
				//Flag as wrong if not already flagged
				if( !oneQuestion.className.match("wrong"))
				{
					oneQuestion.innerHTML = "<p class=\"errorNote\">" +
											"This question is incomplete.</p>" +
											oneQuestion.innerHTML;				
					oneQuestion.className += " wrong";
				}

				isFormAcceptable = false;
			}
			else
			{
				oneQuestion.className = String(oneQuestion.className).replace(" wrong", "");
				j = 0;
				options = oneQuestion.getElementsByTagName("p");
				while(oneOption = options[j++])
				{
					if(oneOption.className.match("errorNote"))
						oneQuestion.removeChild(oneOption);
				}
			}
		} //if( className.match("required") )
	
	} //For each <li>



	if(isFormAcceptable)
		return true;

	document.getElementById("errorNote").innerHTML = "<div class=\"error\">The page appears to be incomplete. Please check over the flagged questions to make sure that they are correct. Thank you.</div>";	


	return false;
}
