<html xmlns:sds=""><!-- #BeginTemplate "/Templates/search_page.dwt" -->
<head>
<!-- #BeginEditable "doctitle" --> 
<title>Preferences</title>
<style>
@media all
{
  sds\:spinbox {behavior:url(spinbox.htc)}
  sds\:checklist {behavior:url(checklist.htc)}
}
</style>
<!-- #EndEditable --> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<link rel="stylesheet" href="search.css"/>
<script language="JavaScript" src="search_errors.js"></script>
<script language="VBScript" src="vb_utils.js"></script>
<script language="JavaScript" src="external_io.js"></script>
<script language="JavaScript" src="ui_utils.js"></script>
<script language="JavaScript" src="math_utils.js"></script>
</head>

<body bgcolor="#FFFFFF" style="background-image:  url(Images/Branding.gif); background-repeat:no-repeat; background-position:center center">
<!-- #BeginEditable "Page%20Script%20Top" --> 
<script language="JavaScript" src="search_index.js"></script>
<script language="JavaScript" src="spinbox.js"></script>
<script language="JavaScript" src="preferences.js"></script>

<script language="JavaScript">
function OnAllIndexesButtonClick()
{
  SelectAllCheckListItems(document.all.index_list);
}

function OnAllFieldsButtonClick()
{
  SelectAllCheckListItems(document.all.field_list);
  
  // gray out fields not selectable for this view option
  // (currently only abstract field is not selectable
  // in summary option)
  SetFieldEnableStates(document.all.field_list,
    GetRadioButton(document.all.results_view_option));
}

function OnResultsViewRadioClick()
{
  var option = GetRadioButton(document.all.results_view_option);
  SetFieldEnableStates(document.all.field_list, option);
}

function OnFieldListClick()
{
  var doc_name = ToLocField("Document Name");
  var el = event.srcElement;
  
  if(el.id == doc_name)
  {
    alert("'Document Name' field can not be turned off.\n" +
	      "Will resume original setting.");
  
    var values = new Array();
    values[doc_name] = "true";
    SetCheckListSelections(document.all.field_list, values);
  }
}

function OnLoadPage()
{
  SetCheckListItems(document.all.index_list, GetIndexNames());
  SelectCheckListItems(document.all.index_list, GetSelectedIndexNames()); 
  SetCheckList(document.all.field_list, ToLocFields(GetAppValues("Preferences/Fields")));
  
  var values = GetAppValues("Preferences");
  SetRadioButton(document.all.stemming_option, values["StemmingOption"]);
  SetCheckBox(document.all.favorites_display, values["FavoritesDisplay"]);
  SetCheckBox(document.all.index_display, values["IndexDisplay"]);
  SetSpinBox(document.all.num_of_matches, values["NumOfMatches"]);
  SetRadioButton(document.all.results_view_option, values["ResultsViewOption"]);
  
  // if no index exists, gray out All Button
  // in Indexes to be Searched area
  if(GetNumOfIndexes() == 0)
    document.all.all_indexes_button.disabled = true;

  SetFieldEnableStates(document.all.field_list, values["ResultsViewOption"]);
  
  // set up spinning behavior of spinbox
  SetContinuousSpin(document.all.num_of_matches);
}

function OnSavePage()
{
  var values = new Array();
  values["StemmingOption"] = GetRadioButton(document.all.stemming_option);
  values["FavoritesDisplay"] = GetCheckBox(document.all.favorites_display);
  values["IndexDisplay"] = GetCheckBox(document.all.index_display);
  values["NumOfMatches"] = GetSpinBox(document.all.num_of_matches);
  values["ResultsViewOption"] = GetRadioButton(document.all.results_view_option);
  SetAppValues("Preferences", values);

  SetIndexSelections(GetCheckList(document.all.index_list));
  SetAppValues("Preferences/Fields", ToPrefFields(GetCheckList(document.all.field_list)));
}

function SetFieldEnableStates(check_list, view_option)
{
  var abs_field = ToLocField("Abstract");
  
  if(view_option == "summary")
  {
    var values = new Array();
	values[abs_field] = "false";	
    SetCheckListEnableStates(check_list, values);
	SetCheckListSelections(check_list, values);
  }
  else if(view_option == "detail")
  {
    var values = new Array();
	values[abs_field] = "true";	
    SetCheckListEnableStates(check_list, values);	
	//SetCheckListSelections(check_list, values);
  }
  else
    alert("SetFieldEnableStates : invalid view option specified.");
}
</script>

<script language="JavaScript" for="all_indexes_button" event="onclick()">
OnAllIndexesButtonClick();
</script>

<script language="JavaScript" for="all_fields_button" event="onclick()">
OnAllFieldsButtonClick();
</script>

<script language="JavaScript" for="results_view_option" event="onclick()">
OnResultsViewRadioClick();
</script>

<script language="JavaScript" for="field_list" event="onclick()">
OnFieldListClick();
</script>

<script language="JavaScript" for="window" event="onload()">
OnLoadPage();
</script>

<script language="JavaScript" for="save_button" event="onclick()">
OnSavePage();
window.location = "default.htm";
</script>

<script language="JavaScript" for="cancel_button" event="onclick()">
window.location = "default.htm";
</script>
<!-- #EndEditable --> 

<!-- #BeginEditable "Top%20Area" --><!-- #EndEditable -->

<table width="100%" border="0" cellspacing="1" cellpadding="1" bgcolor="#CCCCCC"
  vspace="0" hspace="0" height="24">
  <tr> 
    <td width="6%">
	  <a id="home_link" href="default.htm">
	    <img src="Images/search_home.bmp" border="0"
		  title="Back to Search Home" width="20" height="20"
		  style="position:relative; top:2;"/> 
      </a>
	</td>
    <td> 
      <div id="page_title_area" align="center">
	  <!-- #BeginEditable "Title" -->
	  <b> Preferences </b><!-- #EndEditable -->
	  </div>
    </td>
    <td width="180"> 
      <div id="page_link_area" align="right">
	  <!-- #BeginEditable "Links" --><!-- #EndEditable -->
	  </div>
    </td>
  </tr>
</table>
<!-- #BeginEditable "Work%20Area" --> 
<blockquote> 
  <blockquote>
    <b>Search Options</b><br/><br/>
    <fieldset><legend>Find matches based on</legend> 
      <table width="100%" border="0" cellspacing="5" cellpadding="5">
        <tr> 
          <td width="50%"> 
            <div align="left"> 
              <input type="radio" name="stemming_option" value="off"/>
              Exact word</div>
          </td>
          <td width="50%"> 
            <input type="radio" name="stemming_option" value="on"/>
            Variation of word endings</td>
        </tr>
      </table>
    </fieldset> <br/>
    <fieldset><legend>Indexes to be Searched</legend>       
    <table width="100%" border="0" cellspacing="5" cellpadding="5">
      <tr> 
        <td width="50%"><sds:checklist id="index_list" height="80" width="200" /></td>
        <td width="50%"> 
          <div align="center"> 
            <input type="button" name="all_indexes_button" value="   All   "/>
          </div>
        </td>
      </tr>
    </table>
    </fieldset>
    <br/>
    <input type="checkbox" name="favorites_display" value="checkbox"/>
	Display list of Favorite Search Terms in Search Area.
	<br/>
    <input type="checkbox" name="index_display" value="checkbox"/>
	Display Indexes to be Searched in Search Area.
	<br/><br/>
    Retrieve first  <sds:spinbox id="num_of_matches" minvalue="1" maxvalue="1000" size="6" />  matches. </blockquote>
</blockquote>
<br/>
<blockquote>
  <blockquote>
    <b>Results Display Options</b><br/><br/>
    <fieldset><legend>First display in</legend> 
      <table width="100%" border="0" cellspacing="5" cellpadding="5">
        <tr> 
          <td width="50%"> 
            <div align="left"> 
              <input type="radio" name="results_view_option" value="summary"/>
              Summary View</div>
          </td>
          <td width="50%"> 
            <input type="radio" name="results_view_option" value="detail"/>
            Detail View </td>
        </tr>
      </table>
      </fieldset> <br/>
      <fieldset><legend>Fields to be Displayed</legend> 
      <table width="100%" border="0" cellspacing="5" cellpadding="5">
        <tr> 
          <td width="50%">
		    <sds:checklist id="field_list" height="100" width="200" />
          </td>
          <td width="50%"> 
            <div align="center"> 
              <input type="button" name="all_fields_button" value="   All   "/>
            </div>
          </td>
        </tr>
      </table>
    </fieldset></blockquote>
</blockquote>
<hr/>
<table width="100%" border="0" cellspacing="5" cellpadding="5">
  <tr> 
    <td width="47%"> 
      <div align="right"> 
        <input type="button" name="save_button" value="  Save  "/>
      </div>
    </td>
	<td width="6%">
	</td>
    <td width="47%"> 
      <div align="left"> 
        <input type="button" name="cancel_button" value="Cancel"/>
      </div>
    </td>
  </tr>
</table>
<!-- #EndEditable -->

<!-- #BeginEditable "Page%20Script%20Bottom" --> 
<!-- #EndEditable --> 
</body>
<!-- #EndTemplate --></html>
