function processSearch(theForm)
{
  //var selectedCatName = '';
  //selectedCatName = theForm.Databases.options[theForm.Databases.selectedIndex].text;
  //selectedCatName = selectedCatName.replace(/\&/g, '%26');
  var wf_term1 = '';
  wf_term1 = theForm.q.value;
  if (wf_term1 == '')
  {
    alert('Please enter a search term!')
    return false;
  }
  wf_term1 = wf_term1.replace(/\"/g, '');
  wf_term1 = wf_term1.replace(/\'/g, '');
  var nexturl = '';
  nexturl = 'http://wfsearch.webfeat.org.pallas2.tcl.sc.edu/cgi-bin/WebFeat.Dll?Command=Search&Client_ID=univsouthcaro&BypassSessData=yes&noserial=1&usesessions=1';
  nexturl += '&format=JS&rtmpl=js&wf_field1=wf_keyword&wf_term1=' + wf_term1;
  nexturl += '&Databases=' + theForm.Databases.value;
  nexturl = nexturl.replace(/\?/g, '%3F');
  nexturl = nexturl.replace(/\&/g, '%26');

  //document.location = " http://wfsearch.webfeat.org.pallas2.tcl.sc.edu/clients/univsouthcaro/univsouthcaro_Auth.asp?selectedCatName=" + selectedCatName + "&wfselecteddatabases=" + theForm.Databases.value + "&nexturl=" + nexturl;
  document.location = " http://wfsearch.webfeat.org.pallas2.tcl.sc.edu/clients/univsouthcaro/univsouthcaro_Auth.asp?nexturl=" + nexturl;
  return false;
}

function showCategoryBox(selectName, categoryOmit)
{
  var sOptionValue = '';
  var sOptionText = '';

  document.write('<form onSubmit="return processSearch(this);">');
  document.write('<font color="990000"><strong><i>Search multiple databases at once.</i></strong></font><br />');
  document.write('<TABLE><TR><TD VALIGN="MIDDLE" ALIGN="left"><input type="text" name="q" id="q" size="31" maxlength="255" value=""></TD></tr>');
 
  document.write('<tr><TD VALIGN="MIDDLE" ALIGN="RIGHT">');
  document.write('<select name="' + selectName + '">');
  // We want General Purpose to come first
  for (i=0; i< category.length; i++)
  {
    if (category[i][0][0] == 'General Purpose Databases')
    {
      sOptionText = 'General Purpose Databases';
      for (j = 0; j < category[i][1].length; j++)
      {
        sOptionValue += ',' + category[i][1][j];
      }
      sOptionValue = sOptionValue.substr(1);
      document.write('<option value="' + sOptionValue + '">');
      document.write(sOptionText + '</option>\n');
    }
  }

  for (i=0; i< category.length; i++)
  {
    if (categoryOmit.indexOf(category[i][0][0]) >= 0 || category[i][0][0] == 'General Purpose Databases')
    {
      continue;
    }
    sOptionValue = '';
    sOptionText = '';
    sOptionText = category[i][0][0];
    for (j = 0; j < category[i][1].length; j++)
    {
      sOptionValue += ',' + category[i][1][j];
    }
    sOptionValue = sOptionValue.substr(1);
    document.write('<option value="' + sOptionValue + '">');
    document.write(sOptionText + '</option>\n');
  }
  document.write('</select></TD>');
  document.write('<TD ALIGN="LEFT" VALIGN="MIDDLE"><input type="submit" value="GO" /></TD></TR></TABLE></form>');
  document.write("<font color='#990000' size='1'><a href='http://wfsearch.webfeat.org/clients/univsouthcaro/wf3_univsouthcaro.html'>Advanced Power Search option</a><br /><br />");
}
