<html xmlns:sds=""><!-- #BeginTemplate "/Templates/search_page.dwt" -->
<head>
<!-- #BeginEditable "doctitle" -->
<title>Indexing Schedule</title>
<style>
@media all
{
  sds\:spinbox {behavior:url(spinbox.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="indexing_schedule.js"></script>
<script language="JavaScript" src="spinbox.js"></script>

<script language="JavaScript">
// define page scope variables
var schedule_on_off;  // scheduling turned on or off (on/off)
var schedule_option;  // daily scheduling (daily/weekly)

function SetFieldDisplay(on_off, option)
{
  if(on_off == "off")
  {
    document.all.daily_schedule.style.display = "none";
	document.all.weekly_schedule.style.display = "none";
  }
  else
  {
    if(option == "daily")
    {
      document.all.daily_schedule.style.display = "";
      document.all.weekly_schedule.style.display = "none";
    }
    else
    {
      document.all.daily_schedule.style.display = "none";
      document.all.weekly_schedule.style.display = "";
    }
  }
}

function OnLoadPage()
{
  // load all data displayed in this page
  var values = GetIndexingSchedule();
  var def_values = GetAppValues("Schedule");
  
  SetRadioButton(document.all.schedule_on_off, values["OnOff"]);
  SetListBox(document.all.schedule_option_list, values["Option"]);
  
  if(values["Option"] == "daily")
  {
    SetDateBox(document.all.daily_start_date, values["Daily/StartDate"]);
    SetTimeBox(document.all.daily_start_time, values["Daily/StartTime"]);
    SetSpinBox(document.all.daily_option, values["Daily/Option"]);
	
    SetDateBox(document.all.weekly_start_date, def_values["Weekly/StartDate"]);
    SetTimeBox(document.all.weekly_start_time, def_values["Weekly/StartTime"]);
    SetCheckBox(document.all.monday, def_values["Weekly/Monday"]);
    SetCheckBox(document.all.tuesday, def_values["Weekly/Tuesday"]);
    SetCheckBox(document.all.wednesday, def_values["Weekly/Wednesday"]);
    SetCheckBox(document.all.thursday, def_values["Weekly/Thursday"]);
    SetCheckBox(document.all.friday, def_values["Weekly/Friday"]);
    SetCheckBox(document.all.saturday, def_values["Weekly/Saturday"]);
    SetCheckBox(document.all.sunday, def_values["Weekly/Sunday"]);	
  }
  else if(values["Option"] == "weekly")
  {
    SetDateBox(document.all.daily_start_date, def_values["Daily/StartDate"]);
    SetTimeBox(document.all.daily_start_time, def_values["Daily/StartTime"]);
    SetSpinBox(document.all.daily_option, def_values["Daily/Option"]);
	
    SetDateBox(document.all.weekly_start_date, values["Weekly/StartDate"]);
    SetTimeBox(document.all.weekly_start_time, values["Weekly/StartTime"]);
    SetCheckBox(document.all.monday, values["Weekly/Monday"]);
    SetCheckBox(document.all.tuesday, values["Weekly/Tuesday"]);
    SetCheckBox(document.all.wednesday, values["Weekly/Wednesday"]);
    SetCheckBox(document.all.thursday, values["Weekly/Thursday"]);
    SetCheckBox(document.all.friday, values["Weekly/Friday"]);
    SetCheckBox(document.all.saturday, values["Weekly/Saturday"]);
    SetCheckBox(document.all.sunday, values["Weekly/Sunday"]);
  }

  // set visibility of fieldset areas
  schedule_on_off = values["OnOff"];
  schedule_option = values["Option"];
  SetFieldDisplay(schedule_on_off, schedule_option);
  
  // set up spinning behavior of spinbox
  SetContinuousSpin(document.all.daily_option);
}

function OnSavePage()
{
  var values = new Array();
  
  values["OnOff"] = GetRadioButton(document.all.schedule_on_off);
  values["Option"] = GetListBox(document.all.schedule_option_list);
  
  if(values["Option"] == "daily")
  {
    values["Daily/StartDate"] = GetDateBox(document.all.daily_start_date);
    values["Daily/StartTime"] = GetTimeBox(document.all.daily_start_time);
    values["Daily/Option"] = GetSpinBox(document.all.daily_option);
  }
  else if(values["Option"] == "weekly")
  {
    values["Weekly/StartDate"] = GetDateBox(document.all.weekly_start_date);
    values["Weekly/StartTime"] = GetTimeBox(document.all.weekly_start_time);
    values["Weekly/Monday"] = GetCheckBox(document.all.monday);
    values["Weekly/Tuesday"] = GetCheckBox(document.all.tuesday);
    values["Weekly/Wednesday"] = GetCheckBox(document.all.wednesday);
    values["Weekly/Thursday"] = GetCheckBox(document.all.thursday);
    values["Weekly/Friday"] = GetCheckBox(document.all.friday);
    values["Weekly/Saturday"] = GetCheckBox(document.all.saturday);
    values["Weekly/Sunday"] = GetCheckBox(document.all.sunday);
	
    if(!IsDayOfWeekSelected(values))
	{
      alert("At least one 'Day of the Week' must be selected.\n");
	  return;
	}
  }
  
  if(!SetIndexingSchedule(values))
    alert("Indexing Schedule will not be saved.\n");	
  window.location = "default.htm";
}

// is at least one of days of week selected
function IsDayOfWeekSelected(values)
{
  if(values["Weekly/Monday"] == "true")
    return true;
  if(values["Weekly/Tuesday"] == "true")
    return true;
  if(values["Weekly/Wednesday"] == "true")
    return true;
  if(values["Weekly/Thursday"] == "true")
    return true;
  if(values["Weekly/Friday"] == "true")
    return true;
  if(values["Weekly/Saturday"] == "true")
    return true;
  if(values["Weekly/Sunday"] == "true")
    return true;

  return false;
}

function OnClickScheduleOnOff()
{
  schedule_on_off = GetRadioButton(document.all.schedule_on_off);
  SetFieldDisplay(schedule_on_off, schedule_option);
}

function OnChangeScheduleOption()
{
  // toggle the flag
  if(schedule_option == "daily")
    schedule_option = "weekly";
  else
    schedule_option = "daily";

  // set up visibility depending on Daily or Weekly option is selected
  SetFieldDisplay(schedule_on_off, schedule_option);
}
</script>

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

<script language="JavaScript" for="schedule_on_off" event="onclick()">
OnClickScheduleOnOff();
</script>

<script language="JavaScript" for="schedule_option_list" event="onchange()">
OnChangeScheduleOption();
</script>

<script language="JavaScript" for="save_button" event="onclick()">
OnSavePage();
</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>Indexing Schedule</b><!-- #EndEditable -->
	  </div>
    </td>
    <td width="180"> 
      <div id="page_link_area" align="right">
	  <!-- #BeginEditable "Links" -->
	  <a href="index_databases.htm">Index Databases</a><!-- #EndEditable -->
	  </div>
    </td>
  </tr>
</table>
<!-- #BeginEditable "Work%20Area" -->
<blockquote> 
  <input type="radio" name="schedule_on_off" value="on"/>
  Perform indexing 
  <select name="schedule_option_list" size="1">
    <option value="daily">Daily</option>
    <option value="weekly">Weekly</option>
  </select><br/>
  <input type="radio" name="schedule_on_off" value="off"/>
  Schedule off
</blockquote>

<div id="daily_schedule">
<blockquote>
  <fieldset><legend>&#160;Daily Schedule</legend> 
  <blockquote> 
    <p>Start Date:<br/>
      <object id="daily_start_date" class="date_entry" classid="clsid:D58612F4-2E23-4810-852F-745FBAA95D7A">
        <param name="DTFLAG" value="1"/>
      </object>
    </p>
    <p>Start Time:<br/>
 	  <object id="daily_start_time" class="time_entry" classid="clsid:D58612F4-2E23-4810-852F-745FBAA95D7A">
        <param name="DTFLAG" value="2"/>
      </object>
    </p>
    <p>Perform indexing:
	<br/> Every <sds:spinbox id="daily_option" minvalue="1" maxvalue="7" size="2" /> Day(s)
    </p>
  </blockquote>
  </fieldset>
</blockquote>
</div>

<div id="weekly_schedule"> 
  <blockquote> <fieldset><legend>&#160;Weekly Schedule</legend> 
    <blockquote> 
      <p>Start Date:<br/>
        <object id="weekly_start_date" class="date_entry" classid="clsid:D58612F4-2E23-4810-852F-745FBAA95D7A">
          <param name="DTFLAG" value="1"/>
        </object>
      </p>
      <p>Start Time:<br/>
        <object id="weekly_start_time" class="time_entry" classid="clsid:D58612F4-2E23-4810-852F-745FBAA95D7A">
          <param name="DTFLAG" value="2"/>
        </object>
      </p>
      Day(s) of the Week:
      <table width="59%" border="0">
        <tr>
          <td width="49%"> 
            <input type="checkbox" name="monday" value="checkbox"/>
            Monday</td>
          <td width="51%"> 
            <input type="checkbox" name="saturday" value="checkbox"/>
            Saturday</td>
        </tr>
        <tr>
          <td width="49%" height="23"> 
            <input type="checkbox" name="tuesday" value="checkbox"/>
            Tuesday</td>
          <td width="51%" height="23"> 
            <input type="checkbox" name="sunday" value="checkbox"/>
            Sunday</td>
        </tr>
        <tr>
          <td width="49%"> 
            <input type="checkbox" name="wednesday" value="checkbox"/>
            Wednesday</td>
          <td width="51%"> </td>
        </tr>
        <tr>
          <td width="49%"> 
            <input type="checkbox" name="thursday" value="checkbox"/>
            Thursday</td>
          <td width="51%"> </td>
        </tr>
        <tr>
          <td width="49%" height="2"> 
            <input type="checkbox" name="friday" value="checkbox"/>
            Friday </td>
          <td width="51%" height="2"> </td>
        </tr>
      </table>
    </blockquote>
    </fieldset></blockquote>
</div>

<span id="save_cancel_area">
<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>
</span>
<!-- #EndEditable -->

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