function doSubmit(objForm){
  retVal = true;

  switch(objForm.name)
  {
  case "stuMainForm":
    objForm.txtLastName.value = removePercentSign(objForm.txtLastName.value);
    objForm.txtFirstName.value = removePercentSign(objForm.txtFirstName.value);
        
    if (isBlank(objForm.txtLastName.value) && isBlank(objForm.txtFirstName.value) ){
		alert("Please enter the first few letters of the person's first or last name.\n");
		objForm.txtLastName.focus();
		retVal = false;
	}
    
    break    
  case "facMainForm":
    objForm.txtLastName.value = removePercentSign(objForm.txtLastName.value);
    objForm.txtFirstName.value = removePercentSign(objForm.txtFirstName.value);
    objForm.txtMailStopCode.value = removePercentSign(objForm.txtMailStopCode.value);
    
    if (isBlank(objForm.txtLastName.value) && isBlank(objForm.txtFirstName.value) && objForm.txtDept.selectedIndex<1 && isBlank(objForm.txtMailStopCode.value)){
		alert("Please enter the first few letters of any field or select a department.\n");
		objForm.txtLastName.focus();
		retVal = false;
	}
	break
  
  default:
    //code to be executed if n is
    //different from case 1 and 2
  }
return retVal ;
}

function removePercentSign(strText){
	strText = strText.replace(/%/g,"");
	return strText;
}	


function isBlank(str){
/*	Pass this function a string and it will determine whether or not
	there is text or only whitespace.
*/
	for (i=0;i<str.length;i++){
		if (str.charAt(i) != " " || str.charAt(i) != "\n" || str.charAt != "\t" || str.charAt != null){
			return false;
		}
	}

	return true;
}

function giveFocus(){
//	document.forms[0].txtLastName.focus();
}

function newWindow(strURL){
	window.open(strURL, '', 'scrollbars=yes,height=400,width=500,resizeable=no,menubar=no,toolbar=no');
}
 
function reverse(inp) {
/*
Takes any string and reverses the order of the characters.
*/
    var outp="";
    for (i=0;i<inp.length;i++) {
     outp=inp.charAt(i) + outp;
    }
    return outp ;
}
 
function setFacMain(){
		
	document.getElementById('mainDepts').style.display='inline';
	document.getElementById('mainStop').style.display='inline';
	document.getElementById('searchform').name="facMainForm";
	document.getElementById('searchform').action="eDirectoryResults.asp";
	

}

function setStu(){

	document.getElementById('mainDepts').style.display='none';
	document.getElementById('searchform').action="StudentDirectoryResults.asp";
	document.getElementById('searchform').name="stuMainForm";			
	}
