// Javascript for VCU search

function checkQuery() {
	var queryFld = document.keyword.query
	if (queryFld.value == "") {
		alert ("Please enter a query")
		queryFld.focus()
		return(false)
	}
	return(true)
}//checkQuery

function convertString( temp ) 
//Convert spaces in a string to "+" for performing search
//queries.
{
	var newString = "";
	var i=0;
	for( i=0; i < temp.length; i++ ) {
		if( temp.charAt(i) != " " ) {
			newString += temp.charAt(i);
		}
		else {
			newString += "+";
		}
	}
	return newString;
}//convertString

function startSearch() {


//vcu via HtDig

 if( checkQuery() ) {
  var header = "http://search.vcu.edu/cgi-bin/htsearch?";
  var options = "config=htdig&restrict=";
  var restrict = "http://www.vcu.edu/uplink";
  var exclude = ""
  var restrictsas = "";
  var excludesas = "&exclude=http://www.at.vcu.edu/manuals/"
  var options2 = "&method=and&format=long&sort=score&matchesperpage=20";
  var searchVal = "&words=" + convertString(document.keyword.query.value);
  eval( "location = " + "\"" + header + options + restrict + exclude + restrictsas + excludesas + options2 + searchVal + "\"");
  }


}

//searchSearch
