<?xml version="1.0" encoding="utf-8"?>
<window screenLeft="3" screenTop="27" width="384" height="155" titleBar="false" resizeMargins="0,0,0,0" onload="loadTimingSetting();" maximizable="false">
	<script src="common.js" />
	<script>
	<![CDATA[
		function loadTimingSetting()
		{
			var shutdownService = Components.GetObject("@pplive.com/autoshutdown;1");
			if (shutdownService.timeoutId != 0)
			{
				$("checkBox").checked = true;
				var shutdownTime = new Date(shutdownService.getShutdownTime());
				$('dateBox').dateValue = shutdownTime.getVarDate();
				$('timeBox').dateValue = shutdownTime.getVarDate();
				$('dateBox').disabled = false;
				$('timeBox').disabled = false;
			}
		}
		function checkboxOnClick()
		{
			if ($("checkBox").checked)
			{
				$('dateBox').disabled=false;
				$('timeBox').disabled=false;
			}
			else
			{
				$('dateBox').disabled=true;
				$('timeBox').disabled=true;
			}
		}
		function OnOK()
		{
			try
			{
				var shutdownService = Components.GetObject("@pplive.com/autoshutdown;1");
				if ($("checkBox").checked)
				{
					var dateBoxDateValue = new Date($('dateBox').dateValue);
					var timeBoxDateValue = new Date($('timeBox').dateValue);
					var shutdownTime = new Date(dateBoxDateValue.getFullYear(), dateBoxDateValue.getMonth(), dateBoxDateValue.getDate(),
					 timeBoxDateValue.getHours(), timeBoxDateValue.getMinutes(), timeBoxDateValue.getSeconds());
					shutdownService.EnableTiming(true, shutdownTime);
				}
				else
				{
					shutdownService.EnableTiming(false);
				}
			}
			catch (e)
			{

			}
			
			window.close();
		}
		function OnCancel()
		{
			window.close();
		}
	]]>
	</script>
	<subwindow left="0" top="0" width="384" height="155">
		<!-- top left -->
		<subwindow left="0" top="0" width="80" height="27" backgroundImage="bg_left_top.bmp" clippingColor="#FF00FF" />
		<!-- top -->
		<subwindow left="80" top="0" width="296" height="27" backgroundImage="bg_top.bmp" clippingColor="#FF00FF" horizontalAlignment="stretch" backgroundImageStretchMode="stretch" backgroundColor="#000000"/>
		<!-- top right -->
		<subwindow left="376" top="0" width="8" height="27" backgroundImage="bg_right_top.bmp" clippingColor="#FF00FF" horizontalAlignment="right"/>
		<!-- right -->
		<subwindow left="382" top="27" width="2" height="126" backgroundImage="bg_right.bmp" clippingColor="#FF00FF" horizontalAlignment="right" verticalAlignment="stretch" backgroundImageStretchMode="stretch" backgroundColor="#000000" />
		<!-- bottom right -->
		<subwindow left="382" top="153" width="2" height="2" backgroundImage="set_bg_right_bot.bmp" clippingColor="#FF00FF" horizontalAlignment="right" verticalAlignment="bottom" />
		<!-- bottom -->
		<subwindow left="2" top="153" width="380" height="2" backgroundImage="set_bg_bot.bmp" clippingColor="#FF00FF" horizontalAlignment="stretch" verticalAlignment="bottom"  backgroundImageStretchMode="stretch" backgroundColor="#000000"/>
		<!-- bottom left -->
		<subwindow left="0" top="153" width="2" height="2" backgroundImage="set_bg_left_bot.bmp" clippingColor="#FF00FF" horizontalAlignment="left" verticalAlignment="bottom" />
		<!-- left -->
		<subwindow left="0" top="27" width="2" height="126" backgroundImage="bg_left.bmp" clippingColor="#FF00FF" horizontalAlignment="left" verticalAlignment="stretch" backgroundImageStretchMode="stretch" backgroundColor="#000000"/>
		<!-- center -->
		<subwindow left="2" top="27" width="380" height="126" horizontalAlignment="stretch" verticalAlignment="stretch" backgroundColor="#efefef">
		</subwindow>
		<!-- close button -->
		<button left="348" top="0" width="26" height="23" image="close.bmp" hoverImage="close_hover.bmp" downImage="close_down.bmp" onclick="window.close();" tooltip="关闭"/>

	    <label left="16" top="39" width="330" height="18" value="勾选“开启定时关机”选项后选择关机时间，确定即可。" backgroundColor="#efefef" textAlignment="left vcenter"/>
		<label left="16" top="89" width="61" height="18" value="设定时间: " backgroundColor="#efefef" textAlignment="left vcenter"/>
	
		<datepicker id="dateBox" left="85" top="88" width="90" height="20" disabled="true"/>
		<timepicker id="timeBox" left="180" top="88" width="90" height="20" disabled="true"/>

		<checkbox id="checkBox" left="20" top="63" width="96" height="20" label="开启定时关机" backgroundColor="#efefef" onchange="checkboxOnClick();"/>

		<button left="218" top="115" width="70" height="27" image="button.bmp" hoverImage="button_hover.bmp" downImage="button_down.bmp" onclick="OnOK();">
			<label left="0" top="0" width="70" height="27" value="确定" passThrough="true" textAlignment="center vcenter"/>
		</button>
		<button left="297" top="115" width="70" height="27" image="button.bmp" hoverImage="button_hover.bmp" downImage="button_down.bmp" onclick="OnCancel();">
			<label left="0" top="0" width="70" height="27" value="取消" passThrough="true" textAlignment="center vcenter"/>
		</button>
		<label id="windowTitle" left="74" top="4" width="400" height="18" value="定时关机" fontFace="Arial"  fontSize="13"  foregroundColor="#efefef" passThrough="true" textAlignment="left vcenter" fontStyle="bold"/>
	</subwindow>
</window>