function before_destinationCheck3(DnEvents)
{
	K = navigator.appName=="Netscape" ? DnEvents.which : DnEvents.keyCode
	if (K==13) {return checkform3(); }
}

function checkform3()
{	
//alert("hello form 3");
	var check_flag = true;
	var a = 'Please enter a keyword or phrase';
 
if ( document.frm_free_txt_srch.anyQuery.value == "" && check_flag)	
 	{	
 		alert(a);
 		document.frm_free_txt_srch.anyQuery.focus();
 		check_flag = false;
 	}
 
if (check_flag)
	{		
	document.frm_free_txt_srch.action = "/fts/code/smplrslt.asp";
	document.frm_free_txt_srch.submit();				
	}
else
	{
		return check_flag;
	}		

}

function before_destinationCheck2(DnEvents, sponsor)
{
	K = navigator.appName=="Netscape" ? DnEvents.which : DnEvents.keyCode
	if (K==13) {return checkform2(sponsor); } 
}


function checkform2(sponsor)
{	
//alert("hello form 2");
	var check_flag = true;
	var namesearch = document.getElementById('instName');
	//alert(namesearch);
	var a = 'Please enter all or part of an institution' + "'" + 's name';
 
if ( namesearch.value == "" && check_flag)	
 	{	
 		alert(a);
 		namesearch.focus();
 		check_flag = false;
 	}
 
if (check_flag)
	{	
	document.frm_name_srch.action = "ug_searchresults.asp?sponsor=" + sponsor;
	document.frm_name_srch.submit();				
	}
else
	{
		return check_flag;
	}		

}

function checkform(sponsor)

// make sure all required fields are populated
{
//alert("hello");
var check_flag = true;
  for (i=0; i<document.frm_ug_srch.elements.length; i++)
     {
    //alert(document.frm_ug_srch.elements[i].name + ' = ' + document.frm_ug_srch.elements[i].selectedIndex);
      // these are drop down lists
      
          if (document.frm_ug_srch.elements[i].selectedIndex > 0)
            {
   	         check_flag = true;
			 break
   	        } 
   	      else
   	        {
		
		check_flag = false; 
   	        
     	    } 
     } 
     
   if (check_flag)
   
	{	
	 
     document.frm_ug_srch.action = "ug_searchresults.asp?sponsor=" + sponsor;
     
     //for (i=0; i<frm_ug_srch.elements.length-1; i++)
     //{
    //alert(frm_ug_srch.elements[i].name + ' = ' + document.frm_ug_srch.elements[i].value);
      // these are drop down lists
   //}
	 document.frm_ug_srch.submit();	
	} 
   else
   {
   alert('Please select a criterion');
   }
} 

function checkform4()
{
//alert(document.frm_ugsrch.degree_option.selectedIndex)	
//alert("hello form 4");
	var check_flag = true;
	var message = 'Please select a Degree Type';
	var dest = document.frm_ugsrch.degree_option.selectedIndex;
 //alert(dest);
if ( document.frm_ugsrch.degree_option.selectedIndex < 1 && check_flag )	
 	{	
 		alert(message);
 		document.frm_ugsrch.degree_option.focus();
 		check_flag = false;
 	}
 
if (check_flag)

	if (dest == 1)
		{		
		document.frm_ugsrch.action = "ug-search.asp";
		document.frm_ugsrch.submit();				
		}

}

