/* Special purpose routine to check the fields that are supposed to be filled have been filled
   or else return back to the form. */
function joinForm(theForm) {
  allCorrect=true ;
  
  if (theForm.FirstName.value=="" || 
      theForm.LastName.value=="" ||
	  theForm.Phone.value=="" ||
	  theForm.Email.value=="" ) {
    allCorrect=false ;
  }
  if (allCorrect==false)
  {
    alert("Please fill in all fields marked *") ;
	return false ;
  } 
    return true ;
}

function checkForm(theForm) {
	var radioChecked, strClass, radioValue;
	for(i=0; i<theForm.elements.length; i++) {
		strClass = theForm.elements[i].className;
		if (strClass == 'Required' || strClass == 'FlashBG') {
			if (theForm.elements[i].type == 'radio' || theForm.elements[i].type == 'checkbox') {
				radioObject = theForm.elements[theForm.elements[i].name];
				radioChecked = false;
				for(r=0;r<radioObject.length; r++){
					if (radioObject[r].checked) {
						radioChecked = true;
					}
				}
				if (theForm.elements[i].className == 'FlashBG' && radioChecked)
					theForm.elements[i].className = 'Required';
									
				if (!radioChecked) {
					alert('Please check an option for ' + theForm.elements[i].name + '.');
					theForm.elements[i].className = 'FlashBG';
					//setTimeout("theForm.elements[i].className='" + strClass + "'",800);
					return false;
				}
			}
			else {
				if (theForm.elements[i].className == 'FlashBG' && theForm.elements[i].value != '')
					theForm.elements[i].className = 'Required';
				
				if (theForm.elements[i].value == '') {
					alert('Please fill in a value for ' + theForm.elements[i].name + '.');
					theForm.elements[i].className = 'FlashBG';
					//setTimeout("theForm.elements[i].className='" + strClass + "'",800);
					return false;
				}
			}
		}
	}
}
