<?php 

$page_name = "Maintenance-schedule";
include ("../navigation/access.php");

if ($permission_num==1) {
	
require_once ('../include/tc_calendar.php');
$start = strtotime($_SESSION['schedule_date']);
$d = date("d", $start );
$m = date("m", $start );
$y = date("Y", $start );
	
$table_name = $_SESSION['db_prefix']."_maintenance_contracts";
$cluster_query = "SELECT cluster FROM $table_name WHERE start_date IS NOT NULL GROUP BY cluster ORDER BY cluster ASC ";
$arrId1 = array ();
$arrName1 = array ();
$cluster_result = execsql($cluster_query);
if ($cluster_result!="") {
$cluster_num = mysql_num_rows($cluster_result);
$b = 0;
while ($b < $cluster_num) {
		$arrId1[$b] = mysql_result($cluster_result, $b, "cluster");
		$arrName1[$b] = mysql_result($cluster_result, $b, "cluster");
		$b++;
}
}		
	
?>

<!--style sheets-->
<link rel="stylesheet" type="text/css" href="../css/tooltip.css" />

<!--jscript-->
<script language="JavaScript" src="../jscript/tooltip.js"  type="text/javascript"></script> 
<script language="javascript" src="../jscript/calendar.js"></script>
</head>

<?php include('../include/wait.php') 
?>

<body onLoad="MM_showHideLayers('wait','','hide')" onFocus="MM_showHideLayers('wait','','hide');"  onBlur="MM_showHideLayers('wait','','hide');">
<div class="wizard_page_middle_frame">
<form id="form1" name="form1" method="GET" action="">
<div class="wizard_frame">
  <table width="510" id="table_details_display">
    <tr>
      <td width="106">Date:</td>
      <td width="392"><?php

		$myCalendar = new tc_calendar("schedule_date", true);
		$myCalendar->setIcon("../images/iconCalendar.gif");
		$myCalendar->setDate($d, $m, $y);
		$myCalendar->setPath("./");
		$myCalendar->setYearInterval(2010, 2030);
		//$myCalendar->dateAllow('2009-02-20', "", false);
		$myCalendar->writeScript();
?></td>
      </tr>
    <tr>
      <td>Team:</td>
      <td>
        <select name="team_select" class="select120" id="team_select" >
          <option value="team 1">team 1</option>
          <option value="team 2">team 2</option>
          <option value="team 3">team 3</option>
          <option value="team 4">team 4</option>
          <option value="team 5">team 5</option>
          <option value="<?php echo $_SESSION['team']?>" selected="selected"><?php echo $_SESSION['team'] ?></option>
        </select>
      </td>
      </tr>
    <tr>
      <td>Cluster:</td>
      <td><select name="cluster_select" class="select120"  >
        <option value="<?php echo $_SESSION['cluster']?>" selected="selected"><?php echo $_SESSION['cluster'] ?></option>
        <?php
        	for ($j = 0; $j < count($arrId1); $j++) {
    		echo "<option value=" . "\"" . $arrId1[$j] . "\"" . ">" . $arrName1[$j] . "</option>";
	}
?>
      </select></td>
      </tr>
  </table>
</div> 
   
<div class="wizard_frame"></div>     
<div class="wizard_frame">      
  <table width="675" height="50" align="center" id="table_button_bar">
          <tr>
            <td width="117">&nbsp;</td>
            <td width="115"><input name="p" type="hidden" id="p" value="1" />
              <input name="error" type="hidden" id="error" value="0" />
              <input name="s" type="hidden" id="s" value="1" /></td>
            <td width="99">&nbsp;</td>
            <td width="125"><input name="cancelbutton" type="button" class="imagebutton" id="cancelbutton" onClick="needToConfirm = false; cancel_confirmation(1, '../maintenance/maintenance_main.php'); " value="Cancel" /></td>
            <td width="110" align="right"><input type="submit" name="next_button" id="next_button" class="imagebutton" value="Next" tabindex="0" onClick="needToConfirm = false; MM_showHideLayers('wait','','show');" /></td>
          </tr>
      </table></td>
    </tr>
  </table>
</div>
</form>
</div>
</body>
<?php } else { 
$_SESSION['denied_return'] = "maintenance/maintenance_main.php";	?>
<body onLoad="needToConfirm = false; accessdenied(); return false"; >
</body>
<?php }
?>
