{=include-block:Y_Blocks.txt;head=}
{=include-block:Y_Blocks.txt;js_jquery=}
{=include-block:Y_Blocks.txt;js_prototype=}
<script src="/Y_Baselib.js"></script>
<script src="/Y_yWeb.js"></script>
<script>
function epg_plus_popup() {
	window.open("Y_EPG_Plus.yhtm","_blank","resizable=yes,scrollbars=yes");
}

var g_sig = 100;
function set_sigbar(_sig) {
	var l = jQuery("#sigbar_left");
	var r = jQuery("#sigbar_right");
	if (_sig > 0)
		l.width(_sig.toString() + "%");
	else
		l.width(0);
	if (_sig >= 100)
		r.width(0);
	else
		r.width((100 - _sig).toString() + "%");
}

function get_sig() {
	var __sig_str = loadSyncURL("/control/signal?sig");
	var __sig = parseInt(__sig_str, 10);
	if (isNaN(__sig))
		__sig = 100;
	set_sigbar(__sig);
	g_sig = __sig;
	jQuery("#sig_value").html(g_sig);
	return __sig;
}

var g_snr = 100;
function set_snrbar(_snr) {
	var l = jQuery("#snrbar_left");
	var r = jQuery("#snrbar_right");
	if (_snr > 0)
		l.width(_snr.toString() + "%");
	else
		l.width(0);
	if (_snr >= 100)
		r.width(0);
	else
		r.width((100 - _snr).toString() + "%");
}

function get_snr() {
	var __snr_str = loadSyncURL("/control/signal?snr");
	var __snr = parseInt(__snr_str, 10);
	if (isNaN(__snr))
		__snr=100;
	set_snrbar(__snr);
	g_snr = __snr;
	jQuery("#snr_value").html(g_snr);
	return __snr;
}

var g_ber = 0;
function ber_get() {
	var __ber_str = loadSyncURL("/control/signal?ber");
	var __ber = parseInt(__ber_str, 10);
	if (isNaN(__ber))
		__ber = 100;
	g_ber = __ber;
	jQuery("#ber_value").html(g_ber);
	//return __ber;
}

var g_volume = 100;
function set_volumebar(_volume) {
	var l = jQuery("#volumebar_left");
	var r = jQuery("#volumebar_right");
	if (_volume > 0)
		l.width(_volume.toString() + "%");
	else
		l.width(0);
	if (_volume >= 100)
		r.width(0);
	else
		r.width((100 - _volume).toString() + "%");
}

function get_volume() {
	var __volume_str = loadSyncURL("/control/volume");
	var __volume = parseInt(__volume_str, 10);
	if (isNaN(__volume))
		__volume = 100;
	set_volumebar(__volume);
	g_volume = __volume;
	return __volume;
}

function set_volume(_volume) {
	_volume = Math.min(100, _volume);
	_volume = Math.max(0, _volume);
	loadSyncURL("/control/volume?" + _volume);
	set_volumebar(_volume);
	g_volume = _volume;
}

function set_mute_button() {
	var status = loadSyncURL("/control/volume?status");
	jQuery("#mute_button").html((status == 1) ? "<img src=\"/images/volumemute.png\">" : "<img src=\"/images/volumeunmute.png\">");
	return status;
}

function toggle_mute() {
	var status = loadSyncURL("/control/volume?status");
	if (status == 0) //off
		loadSyncURL("/control/volume?mute");
	else
		loadSyncURL("/control/volume?unmute");
	set_mute_button();
}

function set_mode(_mode) {
	var actual_mode = loadSyncURL("/control/getmode");
	if (actual_mode != _mode)
		loadSyncURL("/control/setmode?" + _mode);
	parent.work.location.reload();
}

function get_data() {
	set_volumebar(get_volume());
	set_sigbar(get_sig());
	set_snrbar(get_snr());
	ber_get();
}

function init() {
	get_data();
	set_mute_button();
	add_yExtensions('boxcontrol', 'secmenu_boxcontrol');
}
</script>
{=include-block:Y_Blocks.txt;head_close=}
<body>
{=var-set:management={=if-equal:{=func:get_request_data client_addr=}~{=ini-get:/var/tuxbox/config/yWeb.conf;management_ip;{=func:get_request_data client_addr=}=}~1~=}{=if-equal:{=func:get_request_data client_addr=}~{=ini-get:/var/tuxbox/config/yWeb.conf;management_ip2=}~1~=}=}
<div class="y_menu_sec_box">
	<div class="y_menu_sec_box_head"><h2>{=L:main.boxcontrol=}</h2></div>
	<div class="y_menu_sec_box_body">
		<div class="y_menu_sec">
			<ul id="secmenu_boxcontrol">
				<li>
					<a target="work" title="{=L:bc.menue.bouquets_desc=}" href="Y_Boxcontrol_Bouquets.yhtm">{=L:bc.menue.bouquets=}</a>
				</li>
				<li>
					<a target="work" href="Y_EPG_Plus.yhtm">{=L:live.epg_plus=}</a>
					<a title="{=L:live.epg_plus_popup_desc=}" href="javascript:epg_plus_popup()" class="y_menu_popup_link" ><img src="/images/popup.png"/></a>
				</li>
				<li>
					<a target="work" title="{=L:bc.menue.control_desc=}" href="Y_Tools_Boxcontrol.yhtm">{=L:bc.menue.control=}</a>
				</li>
				<li>
					<a target="work" title="{=L:bc.menue.messages_desc=}" href="Y_Boxcontrol_Messages.yhtm">{=L:bc.menue.messages=}</a>
				</li>
				<li>
					<a target="work" title="{=L:bc.menue.remote_desc=}" href="Y_Tools_Rcsim.yhtm">{=L:bc.menue.remote=}</a>
				</li>
				<li>
					{=L:bc.menue.screenshot=}
				</li>
				<ul>
					<li>
						<a target="work" title="OSD-{=L:bc.menue.screenshot=}" href="Y_Tools_Screenshot.yhtm?osd=1&rc={=ini-get:/var/tuxbox/config/yWeb.conf;screenshot_rc;false=}">OSD</a>
					</li>
					<li>
						<a target="work" title="TV-{=L:bc.menue.screenshot=}" href="Y_Tools_Screenshot.yhtm?video=1&rc={=ini-get:/var/tuxbox/config/yWeb.conf;screenshot_rc;false=}">TV</a>
					</li>
					{=if-equal:{=ini-get:/var/tuxbox/config/neutrino.conf;lcd4l_support;0=}~0~~
					{=if-equal:{=ini-get:/var/tuxbox/config/neutrino.conf;lcd4l_screenshots;0=}~0~~
					<li>
						<a target="work" title="LCD4Linux-{=L:bc.menue.screenshot=}" href="Y_Tools_Screenshot_LCD4Linux.yhtm">LCD4Linux</a>
						<a target="blank" title="LCD4Linux-{=L:bc.menue.screenshot=} (Popup)" href="lcd4linux/ylcd4linux.yhtm" class="y_menu_popup_link" ><img src="/images/popup.png"/></a>
					</li>
					=}
					=}
					{=if-equal:{=ini-get:/var/tuxbox/config/neutrino.conf;glcd_enable;0=}~0~~
					<li>
						<a target="work" title="GraphLCD-{=L:bc.menue.screenshot=}" href="Y_Tools_Screenshot_GraphLCD.yhtm">GraphLCD</a>
					</li>
					=}
				</ul>
				<li>
					{=var-set:m_link_href=Y_Timer_List.yhtm=}
					{=var-set:m_link_text={=L:live.timer=}=}
					{=include-block:Y_Blocks.txt;management_link=}
				</li>
				<li>
					<a target="work" href="Y_Boxcontrol_PZapit.yhtm">{=L:bc.pzapit=}</a>
				</li>
			</ul>
		</div>
	</div>
</div>
<div class="y_menu_sec_box">
	<div class="y_menu_sec_box_head"><h2>{=L:bc.menue.control=}</h2></div>
	<div class="y_menu_sec_box_body">
		<center>
			<table class="y_text_boxcontrol_table" cellspacing="0" cellpadding="0" title="{=L:bc.menue.volumen_display=}">
			<tr>
			<td id="volumebar_left" width="100%"><img src="/images/blank.png" height="1" width="0" alt="."/></td>
			<td id="volumebar_right" width="0%"><img src="/images/blank.png" height="1" width="0" alt="."/></td>
			</tr>
			</table>
			<br/>
			<span class="control_icon" title="{=L:bc.menue.decrease_volume=}">
				<a href="javascript:set_volume(g_volume-10);">
					<img src="/images/volumedown.png">
				</a>
			</span>
			<span class="control_icon" title="{=L:bc.menue.increase_volume=}">
				<a href="javascript:set_volume(g_volume+10);">
					<img src="/images/volumeup.png">
				</a>
			</span>
			<span class="control_icon" title="{=L:bc.menue.mute_volume=}">
				<a id="mute_button" href="javascript:toggle_mute();">
					<img src="/images/volumemute.png">
				</a>
			</span>
			<span class="control_icon" title="{=L:bc.menue.switch_to_tv=}">
				<a href="javascript:set_mode('tv');">
					<img src="/images/live.png">
				</a>
			</span>
			<span class="control_icon" title="{=L:bc.menue.switch_to_radio=}">
				<a href="javascript:set_mode('radio');">
					<img src="/images/radio.png">
				</a>
			</span>
		</center>
	</div>
</div>
<div class="y_menu_sec_box">
	<div class="y_menu_sec_box_head"><h2>{=L:bc.menue.signal=}</h2></div>
	<div class="y_menu_sec_box_body">
		<center>
			<div class="y_text_boxcontrol_div_progress">SIG <span id="sig_value"></span>%</div>
			<table class="y_text_boxcontrol_table_progress" cellspacing="0" cellpadding="0" title="{=L:bc.menue.sig_display=}">
			<tr>
			<td id="sigbar_left" width="100%"><img src="/images/blank.png" height="1" width="0" alt="." /></td>
			<td id="sigbar_right" width="0%"><img src="/images/blank.png" height="1" width="0" alt="." /></td>
			</tr>
			</table>
		</center>
		<center>
			<div class="y_text_boxcontrol_div_progress">SNR <span id="snr_value"></span>%</div>
			<table class="y_text_boxcontrol_table_progress" cellspacing="0" cellpadding="0" title="{=L:bc.menue.snr_display=}">
			<tr>
			<td id="snrbar_left" width="100%"><img src="/images/blank.png" height="1" width="0" alt="." /></td>
			<td id="snrbar_right" width="0%"><img src="/images/blank.png" height="1" width="0" alt="." /></td>
			</tr>
			</table>
		</center>
		<center>
			<div class="y_text_boxcontrol_div_progress">BER <span id="ber_value"></span></div>
		</center>
	</div>
</div>
<script>
	init();
	window.setInterval("get_data();",5000);
</script>
</body>
</html>
