function processSearch(theForm) {
  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://search3.webfeat.org/cgi-bin/WebFeat.Dll?Command=Search&Client_ID=isu&BypassSessData=yes&noserial=1';
  nexturl += '&format=JS&rtmpl=js&wf_field1=wf_keyword&wf_term1=' + wf_term1;
  nexturl += '&Databases=' + theForm.Databases.value;
  nexturl = nexturl.replace(/\&/g, '%26');
  
  document.location = "http://search3.webfeat.org/clients/isu/isu_auth.asp?nexturl=" + nexturl;
  //document.location = nexturl;
  return false;
}

function useWF(catname) {

  document.write('<form onSubmit="return processSearch(this);">');
  document.write('<TABLE><TR><TD VALIGN="MIDDLE" ALIGN="RIGHT"><input type="text" name="q" id="q" size="20" maxlength="255" value=""></TD>');
  document.write('<TD ALIGN="LEFT" VALIGN="MIDDLE"><input type="submit" value="Search"></TD></TR></TABLE>');
  document.write('<input type="hidden" name="Databases" value="' + formCategoryList(catname) + '">');
  document.write('</form>');
}


function showHide(divID, visFlag)
{
  if (visFlag == 1)
  {
    document.getElementById(divID).style.visibility = 'visible';
    document.getElementById(divID).style.display = 'inline';
    document.getElementById(divID + '_desc').style.visiblity = 'hidden';
    document.getElementById(divID + '_desc').style.display = 'none';
  }
  else
  {
    document.getElementById(divID).style.visibility = 'hidden';
    document.getElementById(divID).style.display = 'none';
    document.getElementById(divID + '_desc').style.visibility = 'visible';
    document.getElementById(divID + '_desc').style.display = 'inline';
  }
}

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/>");
}
}

function showHideLayer(divName)
{
  var divID
  var obj;
  var divs = document.getElementsByTagName("div");
  for (var i = 0; i < divs.length; i++)
  {
    divID = divs[i].id;

    if (!divID)
    {
      continue;
    }

    if (divID.substr(0, 4) == 'WFDB')
    {
      if (divID == divName)
      {
        if (divs[i].style.display == 'block')
        {
          divs[i].style.display = 'none';
        }
        else
        {
          divs[i].style.display = 'block';
        }
      }
    }
  }
}

  function stripLO(dbname1, dbname2)
  {
    dbname1 = dbname1.replace(/\<\!-- link only --\>/, '');
    dbname2 = dbname2.replace(/\<\!-- link only --\>/, '');
    return (dbname1 > dbname2) - (dbname1 < dbname2);
  }

function showDBsForCatNameClient(categoryName, descriptionText, nCols, omitDatabase, format, top)
{
  // Make sure everything is defined or the default

  var goodDbs = new Array();
  var goodDBNames = new Array();

  if(typeof(g_CheckboxTemplate) == 'undefined')
  {
    g_CheckboxTemplate = CHECKBOX_TEMPLATE_D;
  }

  if(typeof(g_CheckboxName) == 'undefined')
  {
    g_CheckboxName = 'Databases';
  }

  if (typeof(categoryName) == 'undefined')
  {
    categoryName = category[0][0][0];
  }

  if(typeof(descriptionText) == 'undefined')
  {
    descriptionText = '';
  }

  if(typeof(nCols) == 'undefined')
  {
    nCols = 1;
  }

  if(typeof(omitDatabase) == 'undefined')
  {
    omitDatabase = '';
  }

  if(typeof(format) == 'undefined')
  {
    format = '';
  }

  if(typeof(top) == 'undefined')
  {
    top = '';
  }

  if(typeof(anchors) == 'undefined')
  {
    var anchors = new Array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z");
  }
  



  for (i=0; i< category.length; i++)
  {
    if (category[i][0][0] == categoryName)
    {
      var offset = 0;
      var dbCount = category[i][1].length;
      var goodCount = 0;

      for(j=0; j<category[i][1].length; j++)
      {
        wfname = category[i][1][j];
        //alert('Working on: ' + wfname);
        for (k = 0; k < databaseList.length; k++)
        {
          if (databaseList[k][0] == wfname)
          {
            //alert('Found: ' + databaseList[k][1]);
            dbArray = databaseList[k];
            goodDbs[goodCount] = wfname;
            goodDBNames[goodCount] = databaseList[k][1];
            goodCount++;
          }
        }
      }
      goodDBNames = goodDBNames.sort(stripLO);
     // for (x = 0; x < goodDBNames.length; x++)
      //{
       // document.write(goodDBNames[x] + "<BR>");
      //}
      goodDbs = goodDbs.sort();
      //document.write(goodDbs);
      if (typeof(nCols) != 'undefined')
      {
        if (nCols == 1)
        {
          offset = 0;
        }
        else
        {
          offset = Math.ceil((dbCount) / nCols);
        }
      }

      var useIdx = 0;
      var rowNum = 0;
      var colNum = 0;
      var count = 0;
      var shouldColor = 0;
      var text='';
      var textanchor='';
      var letterChange = 0;

      for (j = 0; j < goodDBNames.length; j++)
      {
        if (offset != 0)
        {
          useIdx = (colNum * offset) + rowNum;
        }
        else
        {
          useIdx = j;
        }

        wfname = goodDbs[useIdx];
        for (k=0; k<databaseList.length; k++)
        {
         // if (databaseList[k][0] == wfname)
		   if (goodDBNames[j] == databaseList[k][1])
          {
            dbArray = databaseList[k];
          }
        }

        if (count == 0)
        {
          if (offset % 2 == 0)
          {
            sTemplate = '<tr class="datarowson">' + g_CheckboxTemplate;
            currentColor = 'on';
          }
          else
          {
            sTemplate = '<tr class="datarowsoff">' + g_CheckboxTemplate;
            currentColor = 'off';
          }
        }
        else
        {
          sTemplate = g_CheckboxTemplate;
        }

        sCheckbox = '';
        sDBname = '';
        sDescLink = '';
        sNativeLink = '';

        wfName = dbArray[0];
        dbName = dbArray[1];
        sDBDesc = dbArray[5];
        sDBname = dbName;
        sIconDesc = dbArray[9];
		
        for (l = 0 ; l < anchors.length ; l++)
        {
          if (sDBname.charAt(0) == anchors[l])
          {
            if ( anchors[l] != "*" )
            {
              text = anchors[l];
              anchors[l]= "*" ;
              letterChange = 1;
            }
          break;
          }
        }

        if (dbArray[6] != '')
        {
          sNativeLink = '<a ';
          if (letterChange == 1)
          {
            sNativeLink += 'name="' + text + '" ';
            letterChange = 0;
          }
          sNativeLink += 'class=dblink href="' + dbArray[6] + '">';
        }

		sDescLink = '<a href="javascript:showHelp(\'ISUpopuphelp.asp?wffield=' + wfName;
		//sDescLink += '\');">' + descriptionText + '</a>';
		sDescLink += '\');">';
        if (descriptionText == '<<database name>>')
        {
			sDescLink += sDBname;
        }
        else
        {
			sDescLink += descriptionText;
        }
        sDescLink += '</a>';


        if (sDBname.indexOf('link only') >= 0)
        {
          sCheckbox = '<input type="checkbox" disabled>';
        }
        else
        {
			sCheckbox = '<input type="checkbox" name="' + g_CheckboxName + '" value="';
			if (dbArray[3] == 1) {
				sCheckbox += wfName + '" checked>';
			} else {
				sCheckbox += wfName + '">';
			}
		}

		var wfNameDesc = wfName + "_desc";
		sTemplate = sTemplate.replace(/<<dbNameDesc>>/g, wfNameDesc);
		sTemplate = sTemplate.replace(/<<dbName>>/g, wfName);
        sTemplate = sTemplate.replace(/<<checkbox>>/g, sCheckbox);
        sTemplate = sTemplate.replace(/<<database name>>/g, sDBname);
        sTemplate = sTemplate.replace(/<<description link>>/g, sDescLink);
        sTemplate = sTemplate.replace(/<<database description>>/g, sDBDesc);
        sTemplate = sTemplate.replace(/<<native link>>/g, sNativeLink);
        
        if (dbArray[11] != 2) {
        	sTemplate = sTemplate.replace(/<<auth desc>>/g, "<br><bean:message key='searchForm.authIncomplete'/>");
        } else {
	        sTemplate = sTemplate.replace(/<<auth desc>>/g, "");
	    }                        

        for (p = 0;p < format.length ; p++)
        {
          if (sDBname.charAt(0) == format[p] && format[p]!="*")
          {
            format[p]="*";
            document.write(top);
            break;
          }
        }

        document.write(sTemplate);

        count++;

        if (offset != 0)
        {
          if (colNum == (nCols - 1))
          {
            colNum = 0;
            rowNum++;
            document.write('</tr>');

            if(currentColor == 'off')
            {
              document.write('<tr class="datarowson">');
              currentColor = 'on';
            }
            else
            {
              document.write('<tr class="datarowsoff">');
              currentColor = 'off';
            }
          }
          else
          {
            colNum++;
          }
        }
        else
        {
          document.write('</tr>');
          if(currentColor == 'off')
          {
            document.write('<tr class="datarowson">');
            currentColor = 'on';
          }
          else
          {
            document.write('<tr class="datarowsoff">');
            currentColor = 'off';
          }
        }
      }
      break;
    }
  }
}






function swapISU(imgName)
{
  if (document.images[imgName].src.indexOf('images/plus_on.gif') > 0)
  {
    document.images[imgName].src='images/plus_off.gif';
  }
  else
  {
    document.images[imgName].src='images/plus_on.gif';
  }
}


function showDateRangeISU(startYear)
{
  var today = new Date();
  currentYear = today.getYear();
  if (currentYear < 1900)
  {
    currentYear += 1900;
  }
  //wf_from_year
  document.write('From:');
  document.write('<select class="datebox" name="wf_from_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>');
  }

   //wf_to_year
  document.write('</select>&nbsp;To:');
  document.write('<select class="datebox" 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>');
}

function setSearch(nSearch)
{
  searchType = nSearch;
}







//--------------------------------------------------------------------------------
// catFunction - Selects all the dbs in a category
//---------------------------------------------------------------------------------
function catFunctionISU(index,state,subname)
{
  var wfnames = new Array;
  var dbGroup = new Array;
  var subdbGroup;
  var catCount = 0;

  //if (typeof(subname) != 'undefined')
  //	eval(subdbGroup + " = subname");

  for (m=0; m<document.wfform.Databases.length; m++)
  {
    document.wfform.Databases[m].checked = false;
  }

  // document.wfform.CheckAll.length
  if (document.wfform.CheckAll.length != null)
  {
    catCount = document.wfform.CheckAll.length;
  }
  else
  {
    catCount = 1;
  }

  for (i=0; i<catCount; i++)
  {
  	if (catCount != 1)
  	{
      state = document.wfform.CheckAll[i].checked;
    }
    else
    {
      state = document.wfform.CheckAll.checked;
    }
    if (state == true)
    {
      if (catCount != 1)
      {
        wfnames = document.wfform.CheckAll[i].value.split(",");
      }
      else
      {
        wfnames = document.wfform.CheckAll.value.split(",");
      }
      for (l=0; l<document.wfform.Databases.length; l++)
      {
        dbGroup[l]=document.wfform.Databases[l].value;
      }
      for (k=0; k<document.wfform.Databases.length; k++)
      {
        for (l=0; l<wfnames.length; l++)
        {
          if (dbGroup[k] == wfnames[l])
          {
            document.wfform.Databases[k].checked = true;
          }
        }// end of first for
      }//end of for
    }
  }

  // Subcat code
  if (typeof(document.wfform.CheckSubAll) != 'undefined')
  {
    if (document.wfform.CheckSubAll.length != null)
    {
      catCount = document.wfform.CheckSubAll.length;
    }
    else
    {
      catCount = 1;
    }

    var wfnames = new Array;
    var dbGroup = new Array;

    // document.wfform.CheckSubAll.length
    for (i=0; i < catCount; i++)
    {
      if (catCount != 1)
      {
        state = document.wfform.CheckSubAll[i].checked;
      }
      else
      {
        state = document.wfform.CheckSubAll.checked;
      }
      if (state == true)
      {
        if (catCount != 1)
        {
          subdbArray = document.wfform.CheckSubAll[i].value.split(":::");
        }
        else
        {
          subdbArray = document.wfform.CheckSubAll.value.split(":::");
        }
        eval("subdbGroup = " + subdbArray[1] + "[" + subdbArray[0] + "]");

        for (j=0; j<subdbGroup[1].length; j++)
        {
          wfnames[j] =  subdbGroup[1][j];
        }

        for (l=0; l<document.wfform.Databases.length; l++)
        {
          dbGroup[l]=document.wfform.Databases[l].value;
        }

        for (k=0; k<document.wfform.Databases.length; k++)
        {
          for (l=0; l<wfnames.length; l++)
          {
            if (dbGroup[k] == wfnames[l])
            {
              document.wfform.Databases[k].checked = true;
            }
          }// end of first for
        }//end of for
      }
    }
  }
}



function showSubjectListTest(subjectOmit, descriptionText, subjectOnly, categoryClick, nCols)
{
  var subSelIdx = 0;
  //Find number of categories to show
  var numCategories = category.length;
  var categoryStr ='';
  var offset = 0;
  var useIdx = 0;
  var rowNum = 0;
  var colNum = 0;
  var currIdx = 0;

  // Use the default template if g_SubjectTemplate is not set
  if(typeof(g_SubjectTemplate) == 'undefined') {
    g_SubjectTemplate = MAIN_SUBJECT_T;
  }

  // Use the default template if g_SubjectDatabaseTemplate is not set
  if(typeof(g_SubjectDatabaseTemplate) == 'undefined') {
    g_SubjectDatabaseTemplate = SUBJECT_DATABASE_T;
  }

  // Use the default template if g_SubjectDatabaseTemplate is not set
  if(typeof(subjectOnly) == 'undefined') {
    subjectOnly = true;
  }

  if (typeof(subjectOmit) == 'undefined') {
    subjectOmit = '';
  }

  if (typeof(descriptionText) == 'undefined') {
    descriptionText = '';
  }

  if (typeof(nCols) == 'undefined') {
    nCols = 1;
  }

  if (subjectOmit.indexOf('^') > 0) {
    var omitArray = subjectOmit.split('^');
  }

  for (i=0; i<category.length; i++)
  {
    // Added to allow parsing of ^-delimited omit lists
    if (omitArray != null)
    {
      for (x = 0; x < omitArray.length; x++)
      {
        if (category[i][0][0] == omitArray[x])
        {
          numCategories--;
        }
      }
    }
    else
    {
      if (subjectOmit.indexOf(category[i][0][0]) >= 0)
      {
        numCategories--;
      }
    }
    categoryStr += i + ':' + category[i][0][0] + ' ';
  }

  if (typeof(nCols) != 'undefined')
  {
    offset = Math.ceil(numCategories / nCols);
  }
  if (nCols == 1)
  {
    offset = 0;
  }

  document.write('<td width="30%" class="arrowcell">');

  // Loop through the category array to build the page

  var catCount = 0;
  var skipCat = 0;

  for (i=0; i<category.length; i++)
  {
    var subSelBegin = subSelIdx;
    var subSelEnd = subSelIdx;
    
    if (typeof(category[i][1]) == 'undefined') {
    	continue;
    }
        
    if (omitArray != null)
    {
      for (x = 0; x < omitArray.length; x++)
      {
        if (category[i][0][0] == omitArray[x])
        {
          skipCat = 1;
        }
      }
    }
    else
    {
      if (subjectOmit.indexOf(category[i][0][0]) >= 0)
      { 
        skipCat = 1;
      }
    }
    	    
    if (skipCat == 1)
    {
      skipCat = 0;  
      continue;
    }
    catCount++;;
    catName = category[i][0][0];
    catId = category[i][0][5];
    		
    wfSubNames = '';

    if (rowNum == 0)
    {
      if (catCount > 1)
      {
        document.write('</td>');
        document.write('<td width="30%" class="arrowcell">');
      }
    }
        

    // Build the complete subject wf_name list first
    for (j=0; j<category[i][1].length; j++)
    {
      wfSubNames += ',' + category[i][1][j];
      subSelEnd++;
    }

    wfSubNames = wfSubNames.substr(1);

    sTemplate = g_SubjectTemplate;
    sCheckbox = '';

    if (subjectOnly)
    {
      if (categoryClick)
      {
        // Get the subcategory and checkbox
        var subcat_array = "";
        var subcat  = "cat" + i;
				
        eval("if (typeof(" + subcat + ") != 'undefined')" + "	subcat_array = " + subcat);

        sCheckbox = '<input type="checkbox" title="Check box to include in search" name="CheckAll" value="';
        sCheckbox += wfSubNames + '"';
        sCheckbox += ' onClick="javascript:catFunction('+ currIdx +',this.checked,\'' + subcat + '\',1);">';
      }
      else
      {
        var subcat_array = "";
        sCheckbox = '<input type="checkbox" title="Check box to include in search" name="Databases" value="';
        sCheckbox += wfSubNames + '">';
      }
    }
    else
    {
      sCheckbox = '<input type="checkbox" title="Check box to include in search" name="CategoryBoxes" value=""';
      sCheckbox += ' onClick="subSel(' + subSelBegin + ',' + subSelEnd;
      sCheckbox += ', this.checked)">';
    }
    currIdx++;

    // Set the Index for the next group
    subSelIdx = subSelEnd;

    eval("WFSign" + i + "='+'");
    var noSubcats = 0;
    eval("if (typeof(" + subcat + ") == 'undefined')" + "  noSubcats = 1");
    if (noSubcats == 0)
    {
		if(subcat_array.length > 0)
		{
  sTemplate = sTemplate.replace(/<<category image>>/g,
        "<a href=\"JavaScript:showHideLayer('WFDB" + i + "');JavaScript:swapISU('WFSign" + i + "')\">" +
        "<IMG src=\"images/plus_on.gif\" BORDER='0' name=\"WFSign" + i + "\"></a>");
		}
		else
		{
			sTemplate = sTemplate.replace(/<<category image>>/g, "&nbsp;&nbsp;&nbsp;");
			//sTemplate = sTemplate.replace(/<<category image>>/g, "<td width=\"10%\">&nbsp;</td>");
		}
		

    }
    else
    {
      sTemplate = sTemplate.replace(/<<category image>>/g,"");
    }
    sTemplate = sTemplate.replace(/<<checkbox>>/g, sCheckbox);
	
    sTemplate = sTemplate.replace(/<<category name>>/g, "<font class=\"subcategory\">" + catName + "</font>");


    document.write(sTemplate);

    for (p=0; p<subcat_array.length; p++)
    {
      sSubTemplate = MAIN_SUBSUBJECT_T;
      sSubTemplate = sSubTemplate;
      sSubCheckbox = '<input type="checkbox" title="Check box to include in search" name="CheckSubAll" value="';
      sSubCheckbox += p + ':::' + subcat + ':::' + i + '"';
      sSubCheckbox += ' onClick="javascript:catFunction('+ p +', this.checked, \''+ subcat +'\', 0);">';
	  
	  var newSubcat = subcat_array[p][0][0].replace(/&/g, "%26");

      sSubTemplate = sSubTemplate.replace(/<<subcheckbox>>/g, sSubCheckbox);
      sSubTemplate = sSubTemplate.replace(/<<subcategory name>>/g, subcat_array[p][0][0]);
	  
	  document.write("<div class=\"subcategory\" id=\"WFDB" + i + "\">" + sSubTemplate + "</div>");			
    }

    if (rowNum == (offset - 1))
    {
      rowNum = 0;
    }
    else
    {
      rowNum++;
    }
  }
  document.write('</td>');
}





//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="255" 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 showCategoryBox(selectName, categoryOmit)
{
var sSelectedDatabases = getCookie('wf_selected_databases');
var catNameCookie = getCookie('catNameCookie');
//alert("Inside the function: " + sSelectedDatabases);
	document.write('<select name="' + selectName + '">');
	
	//if catNameCookie is null, that means the user came from the Advanced SAearch page and we need to populate the initial field with something generic
	if (catNameCookie == null)
	{
	var noCookie = 'Last Selected Category';
	document.write('<option selected value=' + sSelectedDatabases + '>' + noCookie + '</option>');
	}
	else
	{
document.write('<option selected value=' + sSelectedDatabases + '>' + catNameCookie + '</option>');
}
//document.write('<option selected>Last Selected Category</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('</select>');
}
