// JavaScript Document - Search
function checkQuery() {
   var queryFld = document.keyword.query;
   if (queryFld.value == "") {
     alert ("Please enter a term to search");
     queryFld.focus();
     return(false);
     }
   return(true);
   }

function checkName() {
   var nameFld = document.ccso.NAME;
   if (nameFld.value == "") {
     alert ("Please enter a name");
     nameFld.focus();
     return(false);
     }
   return(true);
   }

function convertString( temp ) {
   var newString = "";
   var i=0;
   for( i=0; i < temp.length; i++ ) {
     if( temp.charAt(i) != " " ) {
       newString += temp.charAt(i);
       }
     else {
       newString += "+";
       }
     }
   return newString;
   }

function startSearch() {
		
		//vcu via Google
		
		if( document.keyword.searchnav[0].checked ) {
		   if( checkQuery() ) {
			 var header = "http://search.vcu.edu/search?";
			 var options = "&access=p";
			 var searchVal = "q=" + convertString(document.keyword.query.value);
			 eval( "location = " + "\"" + header + searchVal + options + "\"");
		     }
		   }
		
		//people
		
		if( document.keyword.searchnav[1].checked ) {
		   if( checkQuery() ) {
			 var header = "http://phonebook.vcu.edu?";
			 options = "TYPE=All";
			 searchVal = "&NAME=" + convertString(document.keyword.query.value);
			 eval( "location = " + "\"" + header + options + searchVal + "\"" );
			 }
		   }
		   
		  //Medschool via Google
		
		if( document.keyword.searchnav[2].checked ) {
		   if( checkQuery() ) {
			 var header = "http://search.vcu.edu/search?";
			 var options = "&access=p&sitesearch=www.vcu.edu/biochem";
			 var searchVal = "q=" + convertString(document.keyword.query.value);
			 eval( "location = " + "\"" + header + searchVal + options + "\"");
		     }
		   } 
   
}

//searchSearch

function cleartextbox() {
   if (document.keyword.query.value == "Search") {
     document.keyword.query.value = "";
     }
   }

