// checks to see if a text field is empty  (general function)	
	function IsEmpty(aTextField) 
	{
 	  if ((aTextField.value.length==0) || (aTextField.value==null)) 
	  {
 	     return true;
 	  }
 	  else 
	  { return false; }
	}	

// checks to see if radio buttons or checkboxes are not selected  (general function)	
function buttonSelected(BtnArr)
{


	// Loop from zero to the one minus the number of radio button selections
	for (counter = 0; counter < BtnArr.length; counter++)
	{
	// If a radio button has been selected it will return true
	// (If not it will return false)
	if (BtnArr[counter].checked)
		return (true); 
	}

	return (false);
}

// turns labels red (uses styles with ID's for the labels) Specific to alumni
	function turnRed(num)
	{  
	  // turn all navy
		for (index = 0; index <= 4; index++)
		  document.getElementById(index).style.color="navy";
	  // turn one red
		document.getElementById(num).style.color="red";
	}


// fills in the date and put focus on name  specific to alumni
function fillDate(frm)
{ 	var now = new Date();
	var mth = now.getMonth() + 1;
	var dy = now.getDate();
        var yr = now.getYear();
        if (yr < 2000) 
		yr = (yr % 100) + 2000; // fix for firefox
	if (mth < 10) 
		mth = '0' + mth;
	if (dy < 10)
		dy = '0' + dy;
	var theDateStr = yr + '-' + mth + '-' + dy;
	frm.elements["theDate"].value = theDateStr;
	frm.elements["alumName"].focus();
}


// checks the alumniSurvey form  specific to alumni
	function checkform( frm )
	{	
		if (IsEmpty(frm.elements["yearGraduated"]) )
		{
			turnRed(0);
			frm.elements["yearGraduated"].focus(); 
			return false; 	
		}
		else if (!buttonSelected(frm.elements["moreTraining"]))
		{
		  turnRed(1);
		  frm.elements["yearGraduated"].focus();
		  alert("Please indicate if you have had additional training/schooling.");
		  return false;
		}
		  
		else if (!buttonSelected(frm.elements["industryType"]))
		{
		  turnRed(2);
		  frm.elements["yearGraduated"].focus();
		  alert("Please select an Industry type for your employer.");
		  return false;
		}
		else if (!buttonSelected(frm.elements["WorkType[]"]))
		{
		  turnRed(3);
		  frm.elements["otherType"].focus();
		  alert("Please select at least one work category for your job.");
		  return false;
		}
		else if (!buttonSelected(frm.elements["profMember"]))
		{
		  turnRed(4);
		  frm.elements["otherWork"].focus();
		  alert("Please tell us if you are a member of a professional organization.");
		  return false;
		}
		else
		{	
			frm.submit();
		}
	}
