function catSelect(chkBox, catId) {
  var chk = chkBox.checked;
  dojo.query('#subcontent' + catId + ' [@name=Databases]').forEach(
    function(elm) {
        elm.checked = chk;
    }
);
}

function showCats(cols, showDbs) {
  document.write("<table class='categories'>");
  var rows = Math.ceil(category.length / cols);
  category.shift();
  var catNum = 0;
  
  document.write("<td><B><input type='checkbox' name='select' onclick='toggleAll(this);'>Select/Deselect All</B></td>");
  for (var i = 0; i< rows; i++) {
    document.write("<tr>");
    for (var k = 0; k < cols; k++ ) {
      catNum++;
      catId = k*rows + i;
      if (catId < category.length) {
        document.write("<td>");
		
	  
        if (showDbs) {
          document.write('<input id="advCatBox');
          document.write(catId);
          document.write('" type="checkbox" class="categoryBox" onclick="javascript: catSelect(this,' + catId + ');"/>');
          document.write(category[catId][0][0]);
          document.write(" | ");
          document.write('<a onclick="return overlay(\'subcontent' + catId + '\')" href="#" id="catLink' + catId + '">Show all</a>');
          document.write(makeCatDiv(catId));
        } else {
          document.write('<input id="basicCatBox' + catId + '" type="checkbox" name="Databases" value="' + category[catId][1].join(',') + '"/>');
          document.write(category[catId][0][0]);
        }
        document.write("</td>");
      }
      else if (catId == category.length) {
        //document.write("<td><input type='checkbox' name='select' onclick='toggleAll(this);'>Select/Deselect All</td>");
      }
      else {
        document.write("<td>&nbsp;</td>");
      }
    }
    document.write("</tr>");
  }
  document.write("</table>");
}


//Called from makeCatDiv(), this will ensure that the category checkboxes get checked if the individual DB checkboxes are
function checkMain(catId)
{
if (catId == 0)
{
//alert (document.wfformadv.Databases.checked);
 	//if (document.wfformadv.Databases)
 	//{
 	//alert("It is not null, so must be checked?");
	document.wfformadv.advCatBox0.checked = true;
	//}
	//else
	//{
	//alert("All boxes have been unchecked, and so should the category");
	//}
}
else if (catId == 1)
{
document.wfformadv.advCatBox1.checked = true;
}
else if (catId == 2)
{
document.wfformadv.advCatBox2.checked = true;
}
else if (catId == 3)
{
document.wfformadv.advCatBox3.checked = true;
}
else if (catId == 4)
{
document.wfformadv.advCatBox4.checked = true;
}
else if (catId == 5)
{
document.wfformadv.advCatBox5.checked = true;
}
else if (catId == 6)
{
document.wfformadv.advCatBox6.checked = true;
}
else if (catId == 7)
{
document.wfformadv.advCatBox7.checked = true;
}
else if (catId == 8)
{
document.wfformadv.advCatBox8.checked = true;
}
else if (catId == 9)
{
document.wfformadv.advCatBox9.checked = true;
}
else if (catId == 10)
{
document.wfformadv.advCatBox10.checked = true;
}
else if (catId == 11)
{
document.wfformadv.advCatBox11.checked = true;
}
else if (catId == 12)
{
document.wfformadv.advCatBox12.checked = true;
}
else if (catId == 13)
{
document.wfformadv.advCatBox13.checked = true;
}
else if (catId == 14)
{
document.wfformadv.advCatBox14.checked = true;
}
else if (catId == 15)
{
document.wfformadv.advCatBox15.checked = true;
}
else if (catId == 16)
{
document.wfformadv.advCatBox16.checked = true;
}
else if (catId == 17)
{
document.wfformadv.advCatBox17.checked = true;
}
else if (catId == 18)
{
document.wfformadv.advCatBox18.checked = true;
}
else if (catId == 19)
{
document.wfformadv.advCatBox19.checked = true;
}
else if (catId == 20)
{
document.wfformadv.advCatBox20.checked = true;
}
else if (catId == 21)
{
document.wfformadv.advCatBox21.checked = true;
}
else if (catId == 22)
{
document.wfformadv.advCatBox22.checked = true;
}
else if (catId == 23)
{
document.wfformadv.advCatBox23.checked = true;
}
else if (catId == 24)
{
document.wfformadv.advCatBox24.checked = true;
}
else if (catId == 25)
{
document.wfformadv.advCatBox25.checked = true;
}
}


function makeCatDiv(catId) {
  var result = '';
  result += '<div class="dbList" id="subcontent' + catId + '">';
  result += '<p class="close_x"><a title="CLOSE" onclick="overlayclose(\'subcontent' + catId + '\'); return false" href="#">X</a></p>';
  result += '<ul>';
  

  for (var j = 0; j < category[catId][1].length; j++) {
    result += '<li>';
    result += '<input name="Databases" value="' + category[catId][1][j] + '" type="checkbox" onClick="checkMain(' + catId + ')">';
    result += '<a class="wfdblink" href="' + getDBLinks(category[catId][1][j]) + '">' + getCatName(category[catId][1][j]) + '</a><br>';
    result += '</li>';
  }
  result += '</ul>';
  result += '<p class="done"><a title="SELECT RESOURCE(S)" onclick="overlayclose(\'subcontent' + catId + '\'); return false" href="#">SELECT</a></p>';
  result += '</div>';
  return result;
}

function getCatName(wfName) {
  for (var i = 0; i < databaseList.length; i++) {
    if (databaseList[i][0] == wfName) {
      return databaseList[i][1];
    }
  }
  return false;
}

function getDBLinks(wfName) {
  for (var i = 0; i < databaseList.length; i++) {
    if (databaseList[i][0] == wfName) {
      return databaseList[i][6];
    }
  }
  return false;
}


function positionCats() {
  for (var i = 0; i < category.length; i++ ) {
    var showElm = dojo.byId('catLink' + i);
    var catList = dojo.byId('subcontent' + i);
    var coords = dojo.coords(showElm);
    catList.style.left = coords.x + 'px';
    catList.style.top = coords.y + 'px';
  }
}


function overlay(elm) {
  dojo.byId(elm).style.display = 'block';
}

function overlayclose(elm) {
  dojo.byId(elm).style.display = 'none';
}

function dbDescList(masterDB) {
  var wrkArray = new Object();
  wrkArray = eval(masterDB);

  document.write('<table id="descriptions">');
  
  		document.write('<TR><TD COLSPAN="3">');
  		document.write('<B>Browse By Resource : </B><a href="#A">A</a> | <a href="#B">B</a> | <a href="#C">C</a> | <a href="#D">D</a>  | <a href="#E">E</a> | <a href="#F">F</a> | <a href="#G">G</a>');
  		document.write(' | <a href="#H">H</a> | <a href="#I">I-K</a> | <a href="#L">L</a> | <a href="#M">M</a> | <a href="#N">N</a> | <a href="#O">O</a> | <a href="#P">P-Q</a>');
		document.write(' | <a href="#R">R</a> | <a href="#S">S-T</a> | <a href="#U">U-V</a> | <a href="#W">W-Z</a></TD></TR>');
		
  document.write('<tr><th>DATABASE</th><th>LIBRARY ACCESS</th><th>REMOTE ACCESS</th></tr>');

  
 //Begin use of API code
  	    for (var i = 0; i < wrkArray.clientTranslators.length; i++)
  {
    var wfAvailable = wrkArray.clientTranslators[i].availability;
	var wfName = wrkArray.clientTranslators[i].wfName;
    var assignedName = wrkArray.clientTranslators[i].assignedName;
    var nativeLink = wrkArray.clientTranslators[i].nativeLink;
    var helpText = wrkArray.clientTranslators[i].helpText;
	
	var linkOnly = wrkArray.clientTranslators[i].linkOnly;
	var auxiliaryData = wrkArray.clientTranslators[i].auxiliaryData;
	
	var shortDescription = wrkArray.clientTranslators[i].shortDescription;
	var shortDescriptionArray = shortDescription.split(":::");
	
	//document.write("SHORTDESC: " + shortDescription + "<BR>");
//Checking the values of the following two fields, setting appropriate icon for each one
var useImage = '';
	  	  if ((wfAvailable == "REMOTE") || (shortDescriptionArray[0] == "REMOTE"))
	  {
      useImage = '<td class="access"><img src="images/becpl-all.gif"></td>';
	  }
	  else if ((wfAvailable == "LOCAL") || (shortDescriptionArray[0] == "LOCAL"))
	  {
      useImage = '<td class="access"><img src="images/becpl-limited.gif"></td>';
	  }
	  else
	  {
	  useImage = '<td class="access"> &nbsp;</td>';
	  }
	  
//Checking the value of the variable created when we split the descriptions in the WAC using :::.  All we want to know is if the DB is accessible remotely.  If it is, we'll print out the extra icon.  Also checking the auxiliaryData field for searchable translators.
	  var useRemote = '';
	  if ((shortDescriptionArray[1] == "REMOTE") || (auxiliaryData == "REMOTE"))
	  {
	  useRemote = '<td class="access"><img src="images/remoteHouse.jpg"></td>';
	  }

	  //Now, we finally get to write out the databases and all appropriate data
	  
	//document.write(nativeLink + "<BR>");
	 //if (linkOnly == 1)
	 //{
	 if (nativeLink == "http://nolink.com")
	 {
	 document.write("");
	 }
	 //}
	 else
	 {
      document.write('<tr>');
      document.write('<td class="info"><A NAME="' + assignedName.charAt(0) + '">&nbsp</A>');
      if (nativeLink == "") {
        document.write('<strong>' + assignedName + '</strong>');
      } else {
        document.write('<strong><a href="' + nativeLink + '">' + assignedName + '</a></strong>');
      }
      document.write('<p>' + helpText + '</p>' + linkOnly);
      document.write('</td>');

	 document.write(useImage);
	 document.write(useRemote);

      document.write('</tr>');
	  }
	 }  //End if linkOnly
	  //End use of API code

  document.write('</table>');
}



function toggleAll(elm) {
  var form = elm.form;
  var checkedStatus = elm.checked;
  //dojo.query('.categories input[@type=checkbox]',form).forEach(
  dojo.query('input[@name=Databases], .categoryBox', form).forEach(
      function(input) {
        input.checked = checkedStatus;
      });
}

function writeBranding(brandingVar, type) {
  for (var i = 0; i<brandingVar.clientHtmls.length; i++) {
    if (brandingVar.clientHtmls[i].clientHtmlType == type) {
      document.write(brandingVar.clientHtmls[i].html);
      return true;
    } 
  }
  return false;
}

function switchTab(tabName) {
  dojo.query('.content').forEach(
      function(elm) {
        elm.style.display = "none";
      });
  dojo.query('#main_nav li').forEach(
      function(elm) {
        elm.className = "";
      });
  dojo.byId(tabName).style.display = "block";
  dojo.byId(tabName + "Tab").className = "current";
  dojo.cookie("wfTab", tabName);
  
  if (tabName == "advanced") {
    positionCats();
  }
}

function startTabs() {
  switch (dojo.cookie("wfTab")) {
    case "advanced":
      switchTab("advanced");
    break;
    case "basic":
    default :
      switchTab("basic");
  }
}

function showDateRangeBuffalo(startYear)
{
  var today = new Date();
  currentYear = today.getYear();
  if (currentYear < 1900)
    currentYear += 1900;

  //wf_from_year
  document.write('From: ');
  document.write('<select name="wf_from_year" size="1" disabled>');
  document.write('<option value="' + startYear + '" selected>' + startYear + '</option>');
  for (i=startYear +  1; i <= currentYear ; i++)
  {
    document.write('<option value="' + i + '">' + i + '</option>');
  }
  document.write('</select>&nbsp;&nbsp;&nbsp;&nbsp;To: ');

  //wf_to_year
  document.write('<select name="wf_to_year" size="1" disabled>');
  document.write('<option value="' + currentYear + '" selected>' + currentYear + '</option>');
  for (i=currentYear - 1; i >= startYear ; i--)
  {
    document.write('<option value="' + i + '">' + i + '</option>');
  }
  document.write('</select>');
}




//This is for the Basic form
function validateTerms(formElm)
{
var formType = "basic";
document.cookie = 'formType=' + formType + '; Path=/';
  var sCookieText = '';
  var sDatabaseCookie = '';
  var count = document.wfform.Databases.length;
  var noneSelected = true;
  var missing = 1;
  var temp = '';

  if (document.wfform.wf_term1.value.length > 0)
  {
    missing = 0;
  }
  if (document.wfform.wf_term2)
  {
    if (document.wfform.wf_term2.value.length > 0)
    {
      missing = 0;
    }
  }
  if (document.wfform.wf_term3)
  {
    if (document.wfform.wf_term3.value.length > 0)
    {
      missing = 0;
    }
  }

  if (missing == 1)
  {
	alert('Please enter a search term');
  	return false;
  }


  if (document.wfform.wf_field1.value != 'wf_keyword')
  {
    sCookieText += document.wfform.wf_field1.options[document.wfform.wf_field1.selectedIndex].value + "):(";
    sCookieText += document.wfform.wf_term1.value + "):(";
  }
  else
  {
    sCookieText += "wf_keyword):(";
    sCookieText += document.wfform.wf_term1.value + "):(";
  }
  if (document.wfform.wf_term2)
  {
    sCookieText += document.wfform.wf_op2.options[document.wfform.wf_op2.selectedIndex].value + "):(";
    sCookieText += document.wfform.wf_field2.options[document.wfform.wf_field2.selectedIndex].value + "):(";
    sCookieText += document.wfform.wf_term2.value + "):(";
  }
  else
  {
    sCookieText += '):():():(';
  }
  if (document.wfform.wf_term3)
  {
    sCookieText += document.wfform.wf_op3.options[document.wfform.wf_op3.selectedIndex].value + "):(";
    sCookieText += document.wfform.wf_field3.options[document.wfform.wf_field3.selectedIndex].value + "):(";
    sCookieText += document.wfform.wf_term3.value + "):(";
  }
  else
  {
    sCookieText += '):():():(';
  }
  
  if (document.wfform.wf_all_years)
  {
    if (document.wfform.wf_all_years.value != null)
    {
      sCookieText += document.wfform.wf_all_years.value + '):(0):(0):(';
    }
    else
    {
      if (document.wfform.wf_all_years[0].checked == true)
      {
        sCookieText += 'yes):(0):(0):(';
      }
      else
      {
        sCookieText += document.wfform.wf_all_years[1].value + '):(';
        sCookieText += document.wfform.wf_from_year.selectedIndex + '):(';
        sCookieText += document.wfform.wf_to_year.selectedIndex + '):(';
      }
    }
  }
  if (document.wfform.wf_ftonly)
  {
    sCookieText += document.wfform.wf_ftonly.checked + '):(';
  }
  if (document.wfform.wf_peeronly)
  {
    sCookieText += document.wfform.wf_peeronly.checked + '):(';
  }

  sCookieText = sCookieText.substr(0, sCookieText.length - 3);
  document.cookie = 'wf_search_structure=' + sCookieText + '; Path=/';

  if (document.wfform.Databases.value != null)
  {
    sDatabaseCookie += document.wfform.Databases.value;
    document.cookie = 'wf_selected_databases=' + sDatabaseCookie + '; Path=/';
    return true;
  }
  else
  {
    if (document.wfform.Databases.length == null)
    {
      // Only one checkbox present
      if (document.wfform.Databases.checked == true)
      noneSelected = false;
    }
    else
    {
      noneSelected = true;
      for (i=0; i< document.wfform.Databases.length; i++)
      {
        if (document.wfform.Databases[i].checked == true)
        {
          noneSelected = false;
          sDatabaseCookie += document.wfform.Databases[i].value + ',';
          //break;
        }
      }//end of for
    }//end of else
    if (noneSelected == true)
    {    
      alert('Please select at least one database');
      return false;
    }
    else
    {
      sDatabaseCookie = sDatabaseCookie.substr(0, sDatabaseCookie.length - 1);
      document.cookie = 'wf_selected_databases=' + sDatabaseCookie + '; Path=/';
      return true;
    }
  }
}


//This is for the Advanced form
function validateTermsAdv(formElm)
{
var formType = "advanced";
document.cookie = 'formType=' + formType + '; Path=/';
  var sCookieText = '';
  var sDatabaseCookie = '';
  var count = document.wfformadv.Databases.length;
  var noneSelected = true;
  var missing = 1;
  var temp = '';

  if (document.wfformadv.wf_term1.value.length > 0)
  {
    missing = 0;
  }
  if (document.wfformadv.wf_term2)
  {
    if (document.wfformadv.wf_term2.value.length > 0)
    {
      missing = 0;
    }
  }
  if (document.wfformadv.wf_term3)
  {
    if (document.wfformadv.wf_term3.value.length > 0)
    {
      missing = 0;
    }
  }

  if (missing == 1)
  {
	alert('Please enter a search term');
  	return false;
  }


  if (document.wfformadv.wf_field1.value != 'wf_keyword')
  {
    sCookieText += document.wfformadv.wf_field1.options[document.wfformadv.wf_field1.selectedIndex].value + "):(";
    sCookieText += document.wfformadv.wf_term1.value + "):(";
  }
  else
  {
    sCookieText += "wf_keyword):(";
    sCookieText += document.wfformadv.wf_term1.value + "):(";
  }
  if (document.wfformadv.wf_term2)
  {
    sCookieText += document.wfformadv.wf_op2.options[document.wfformadv.wf_op2.selectedIndex].value + "):(";
    sCookieText += document.wfformadv.wf_field2.options[document.wfformadv.wf_field2.selectedIndex].value + "):(";
    sCookieText += document.wfformadv.wf_term2.value + "):(";
  }
  else
  {
    sCookieText += '):():():(';
  }
  if (document.wfformadv.wf_term3)
  {
    sCookieText += document.wfformadv.wf_op3.options[document.wfformadv.wf_op3.selectedIndex].value + "):(";
    sCookieText += document.wfformadv.wf_field3.options[document.wfformadv.wf_field3.selectedIndex].value + "):(";
    sCookieText += document.wfformadv.wf_term3.value + "):(";
  }
  else
  {
    sCookieText += '):():():(';
  }
  
  if (document.wfformadv.wf_all_years)
  {
    if (document.wfformadv.wf_all_years.value != null)
    {
      sCookieText += document.wfformadv.wf_all_years.value + '):(0):(0):(';
    }
    else
    {
      if (document.wfformadv.wf_all_years[0].checked == true)
      {
        sCookieText += 'yes):(0):(0):(';
      }
      else
      {
        sCookieText += document.wfformadv.wf_all_years[1].value + '):(';
        sCookieText += document.wfformadv.wf_from_year.selectedIndex + '):(';
        sCookieText += document.wfformadv.wf_to_year.selectedIndex + '):(';
      }
    }
  }
  if (document.wfformadv.wf_ftonly)
  {
    sCookieText += document.wfformadv.wf_ftonly.checked + '):(';
  }
  if (document.wfformadv.wf_peeronly)
  {
    sCookieText += document.wfformadv.wf_peeronly.checked + '):(';
  }

  sCookieText = sCookieText.substr(0, sCookieText.length - 3);
  document.cookie = 'wf_search_structure=' + sCookieText + '; Path=/';

  if (document.wfformadv.Databases.value != null)
  {
    sDatabaseCookie += document.wfformadv.Databases.value;
    document.cookie = 'wf_selected_databases=' + sDatabaseCookie + '; Path=/';
    return true;
  }
  else
  {
    if (document.wfformadv.Databases.length == null)
    {
      // Only one checkbox present
      if (document.wfformadv.Databases.checked == true)
      noneSelected = false;
    }
    else
    {
      noneSelected = true;
      for (i=0; i< document.wfformadv.Databases.length; i++)
      {
        if (document.wfformadv.Databases[i].checked == true)
        {
          noneSelected = false;
          sDatabaseCookie += document.wfformadv.Databases[i].value + ',';
          //break;
        }
      }//end of for
    }//end of else
    if (noneSelected == true)
    {    
      alert('Please select at least one database');
      return false;
    }
    else
    {
      sDatabaseCookie = sDatabaseCookie.substr(0, sDatabaseCookie.length - 1);
      document.cookie = 'wf_selected_databases=' + sDatabaseCookie + '; Path=/';
      return true;
    }
  }
}





function runSpelling(spellStruc) {
  var corrected = 0;
  if ( spellStruc.spellcheck[0].words != aSearchStruct[1] ) {
    corrected = 1;
  }
  if ( spellStruc.spellcheck[1].words != aSearchStruct[4] ) {
    corrected = 1;
  }
  if ( spellStruc.spellcheck[2].words != aSearchStruct[7] ) {
    corrected = 1;
  }
  if (corrected) {
    document.write("<br/>\n");
    document.write('<font size="+1">Did you mean: ');
    document.write('<a href="javascript:spellCheckSearch(\'' + spellStruc.spellcheck[0].words 
      +'\',\'' + spellStruc.spellcheck[1].words 
      +'\',\'' + spellStruc.spellcheck[2].words 
      +'\')">');
    if (spellStruc.spellcheck[0].words != "") {
     document.write(spellStruc.spellcheck[0].words);
    }
    if (spellStruc.spellcheck[1].words != "") {
      document.write(" " + aSearchStruct[2] + " " + spellStruc.spellcheck[1].words);
    }
    if (spellStruc.spellcheck[2].words != "") {
      document.write(" " + aSearchStruct[5] + " " + spellStruc.spellcheck[2].words );
    }
    document.write("</a></font>");
    document.write("<br/>");
  }
}

//Providing category drop-down list on Results page
function showResultsCategoryBox(selectName, categoryOmit)
{
//var selectedCatName26 = getCookie('selectedCatName');
 //selectedCatName26 = selectedCatName26.replace(/\+/g, '');
var sSelectedDatabases = getCookie('wf_selected_databases');

//alert("categoryOmit: " + categoryOmit);

        document.write('<select name="' + selectName + '">');
//document.write('<option selected>Choose a Category</option>');

//alert(sSelectedDatabases);
var catDisplayMSG = "User Selected Resources";
document.write('<option selected value="' + sSelectedDatabases + '">' + catDisplayMSG + '</option>');
        for (i=0; i< category.length; i++)
        {
        
        
                if (categoryOmit.indexOf(category[i][0][0]) >= 0)
                        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(sOptionText + '</option>\n');
        }
        document.write('</select>');
}

//The rest of these functions are somewhat specific to the Results page
function makeScoreboardHeader()
{
  var temp = '<td class="SBhead" valign="top" align="right" width="10%"><a class="SBhead" href="#WF" onClick="wfToggleSortSBTotal()">' + langStrings[lang_hits_idx][lang] + '</a></td>';
 temp += '<td class="SBhead" valign="top" align="left" WIDTH="50"><a class="SBhead" href="#WF" onClick="wfToggleSortSBName()">' + langStrings[lang_database_idx][lang] + '</a></td>';
  temp += '<tr><td colspan="2" VALIGN="TOP"><HR WIDTH="100%" SIZE="1" COLOR="#dddddd"></td>';
  return temp;
}


      
//----------------------------------------------------------------------
// returns the scoreboard data header
//----------------------------------------------------------------------
function makeScoreboardRow(bLinked, i)
{
  var rowClass = "wfsbdata" + i % 2;

  var temp = '<tr>';
  temp += '<td class="' + rowClass + '" valign="top" align="right"><<count>>&nbsp;&nbsp;</td>';
  if (bLinked) {
    temp += '<td class="' + rowClass + '" valign="top"><a class="SBCol" href="#<<wf name>>"><<db name>></a></td>';
  } else {
    temp += '<td class="' + rowClass + '" valign="top"><span class="SBCol"><<db name>></span></td>';
  }

  temp += '</tr>';
  
  temp = temp.replace(/<<wf name>>/g, wfScore[i].WFname);
  temp = temp.replace(/<<db name>>/g, wfScore[i].DisplayName);
  temp = temp.replace(/<<count>>/g, wfScore[i].Total);
  
  return temp;
}

function wfWriteScoreboard(bLinked)
{
  if (!bUseScoreboard) {
    return;
  }

  // Update the mode setting
  if (bLinked) {
    wfbSBLinked = true;
  } else {
    wfbSBLinked = false;
  }

  var i;
  var temp = '';
  temp += '<table border="0" width="285" cellpadding=0 cellspacing=0>';
  temp += '<tr>' + makeScoreboardHeader() + '</tr>';

  for (i = 0; i < wfScore.length; ++i) {
    temp += makeScoreboardRow(bLinked, i);
  }

  temp += '</table>';

  if (document.getElementById("WFsb2")) {
    document.getElementById("WFsb2").innerHTML = temp;
  }
}

function spellCheckSearch(term1, term2, term3) {
    if (document.wfform.wf_term1) {
        document.wfform.wf_term1.value = term1;
    }
    if (document.wfform.wf_term2) {
        document.wfform.wf_term2.value = term2;
    }
    if (document.wfform.wf_term3) {
        document.wfform.wf_term3.value = term3;
    }
    if (validateTerms(document.wfform)) {
        document.wfform.submit();
    }
}


function refineSearch() {
  dojo.cookie("wfPopulateSearch", "true");
  document.location = "/clients/wfxbuffalo/wf3buffalo.asp?cid=" + Client_ID;
}

function loadRefinedSearch() {
  if (dojo.cookie("wfPopulateSearch") ) {
    var activeForm = document.wfform;
    if (dojo.cookie("wfTab") == "advanced") {
      activeForm = document.wfformadv;
    } 
  }
}

