{=func:set_timer_form {=typ=} {=tid=}=}
{=include-block:Y_Blocks.txt;head_no_charset=}
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/>
{=include-block:Y_Blocks.txt;js_jquery=}
<script src="/Y_Baselib.js"></script>
<script>
function my_display(id, state)
{
	jQuery('#'+id).toggle(state);
}

function focusNMark()
{
	document.f.ad.select();
	document.f.ad.focus();
}

function onEventChange()
{
	tType=document.f.type.value;
	my_display("StopDateRow",(tType == "5"));
	my_display("StandbyRow",(tType == "4"));
	my_display("ProgramRow",(tType == "5" || tType=="2" || tType=="3"));
	my_display("ApidRow",(tType == "5"));
	my_display("MessageRow",(tType == "6"));
	my_display("PluginNameRow",(tType == "8"));
	my_display("RecDirRow",(tType == "5"));
	my_display("ValuesRow",(tType != "1" && tType!="7"));
	focusNMark();
}

function onEventChange2()
{
	tType=document.f.rep.value;
	my_display("WeekdaysRow",(tType == "256"));
	my_display("repcountRow",!(tType == "0"));
}

function onApidDefChange()
{
	if (document.f.apcf.checked == true)
	{
		document.f.apst.checked=false;
		document.f.apal.checked=false;
		document.f.apac.checked=false;
	}
}

function onApidChange()
{
	if (document.f.apst.checked == true || document.f.apal.checked == true || document.f.apac.checked == true)
		document.f.apcf.checked=false;
}

function do_submit()
{
	show_waitbox(true);
	document.f.submit();
}

function obj_set_select_value(_obj_name, _value)
{
	var _obj = id(_obj_name);
	if (_obj)
	{
		for (i = 0; i < _obj.length; i++)
			if (_obj.options[i].value == _value)
				_obj.selectedIndex=i;
	}
}

function init()
{
	onEventChange();
	onEventChange2();
	var rd = "{=timer_recordingDir=}";
	obj_set_select_value("rec_dir", rd);
}
</script>
{=include-block:Y_Blocks.txt;head_close=}
<body onload="init()">
{=var-set:wait_text={=L:save_values=}=}{=include-block:Y_Blocks.txt;snip_wait=}
<div class="work_box">
	<div class="work_box_head"><div class="work_box_head_h2">
	{=var-set:menu={=L:live.timer_edit.timer=}=}{=include-block:Y_Blocks.txt;work_menu=}</div></div>
	<div class="work_box_body">

	<form method="get" class="y_form" name="f" action="/fb/timer.stb">
	<input type="hidden" name="action" value="{=typ=}"/>
	<input name="id" type="hidden" value="{=timerId=}"/>
		<table border="0" width="100%">
			<tr><td colspan="2" class="y_form_header">{=L:live.timer_edit.timer=}</td></tr>
			<tr>
				<td>{=L:live.timer_edit.type=}</td>
				<td>	<select name="type" onchange="onEventChange();">
					{=timertype=}
					</select>
				</td>
			</tr>
			<tr><td colspan="2" class="y_form_header">{=L:live.timer_edit.times=}</td></tr>
			<tr>
				<td>{=L:live.timer_edit.alarm_date=}</td>
				<td><input type="text" name="ad" value="{=alarm_mday=}" size="2" maxlength="2"/>
				.&nbsp;<input type="text" name="amo" value="{=alarm_mon=}" size="2" maxlength="2"/>
				.&nbsp;<input type="text" name="ay" value="{=alarm_year=}" size="4" maxlength="4"/>
				&nbsp;{=L:live.timer_edit.time=}&nbsp;<input type="text" name="ah" value="{=alarm_hour=}" size="2" maxlength="2"/>
				&nbsp;:&nbsp;<input type="text" name="ami" value="{=alarm_min=}" size="2" maxlength="2"/>
				</td>
			</tr>
			<tr id="StopDateRow">
				<td>{=L:live.timer_edit.stop_date=}</td>
				<td><input type="text" name="sd" value="{=stop_mday=}" size="2" maxlength="2"/>
				.&nbsp;<input type="text" name="smo" value="{=stop_mon=}" size="2" maxlength="2"/>
				.&nbsp;<input type="text" name="sy" value="{=stop_year=}" size="4" maxlength="4"/>
				&nbsp;{=L:live.timer_edit.time=}&nbsp;<input type="text" name="sh" value="{=stop_hour=}" size="2" maxlength="2"/>
				&nbsp;:&nbsp;<input type="text" name="smi" value="{=stop_min=}" size="2" maxlength="2"/>
				</td>
			</tr>
			<tr>
				<td>{=L:live.timer_edit.repeat=}</td>
				<td><select name="rep" onchange="onEventChange2();">
				{=repeat=}
				</select>
				</td>
			</tr>
			<tr id="repcountRow" style="display:none;">
				<td>{=L:live.timer_edit.repeatings=}</td>
				<td><input type="text" name="repcount" id="repcount" value="{=timer_repeatCount=}" size="4" maxlength="3"/>
				</td>
			</tr>
			<tr id="WeekdaysRow" style="display:none;">
				<td>{=L:live.timer_edit.weekdays=}</td>
				<td><input type="text" name="wd" value="{=weekdays=}" size="7" maxlength="7"/> {=L:live.timer_edit.weekdays.format=}
				</td>
			</tr>

			<tr id="ValuesRow" style="display:none"><td colspan="2" class="y_form_header">{=L:live.timer_edit.values=}</td></tr>
			<tr id="ProgramRow" style="display:none">
				<td>{=L:live.timer_edit.channel=}</td>
				<td><select name="channel_id">
				{=program_row=}
				</select>
				</td>
			</tr>
			<tr id="ApidRow" style="display:none">
				<td>{=L:live.timer_edit.apids=}:</td>
				<td><input type="checkbox" name="apcf" onchange="onApidDefChange();" {=if-equal:{=TIMERD_APIDS_CONF=}~y~checked="checked"=}/>{=L:live.timer_edit.apids.default=}
				<input type="checkbox" name="apst" onchange="onApidChange();" {=if-equal:{=TIMERD_APIDS_STD=}~y~checked="checked"=}/>{=L:live.timer_edit.apids.standard=}
				<input type="checkbox" name="apal" onchange="onApidChange();" {=if-equal:{=TIMERD_APIDS_ALT=}~y~checked="checked"=}/>{=L:live.timer_edit.apids.alt=}
				<input type="checkbox" name="apac" onchange="onApidChange();" {=if-equal:{=TIMERD_APIDS_AC3=}~y~checked="checked"=}/>{=L:live.timer_edit.apids.ac3=}
				</td>
			</tr>
			<tr id="StandbyRow" style="display:none">
				<td>{=L:live.timer_edit.standby=}</td>
				<td><input type="radio" name="sbon" value="1" {=if-equal:{=standby=}~1~~checked="checked"=}/>{=L:on=}
				<input type="radio" name="sbon" value="0" {=if-equal:{=standby=}~0~~checked="checked"=}/>{=L:off=}
				</td>
			</tr>
			<tr id="MessageRow" style="display:none">
				<td>{=L:live.timer_edit.message=}</td>
				<td><input type="text" name="msg" value="{=message=}" size="20" maxlength="30"/> ('/'=NL)
				</td>
			</tr>
			<tr id="PluginNameRow" style="display:none">
				<td>{=L:live.timer_edit.plugin=}</td>
				<td><input type="text" name="PluginName" value="{=pluginname=}" size="20" maxlength="30"/>
				</td>
			</tr>
			<tr id="RecDirRow" style="display:none">
				<td>{=L:live.timer_edit.rec_dir=}:</td>
				<td>
				{=include-block:Y_Blocks_Neutrino.txt;neutrino_list_record_dirs=}
				</td>
			</tr>
		</table>
		<br/>

		<button type="button" ytype="save" title="submit and save values" onclick="do_submit()">{=L:save=}</button>
		<button type="button" ytype="cancel" title="cancel" onclick='window.document.location.href="/Y_Timer_List.yhtm"'>{=L:cancel=}</button>
	</form>
	</div>
</div>
</body>
</html>
