{=var-set:_mtd_info_dev={=script:Y_Tools get_mtd_info dev=}=}
{=var-set:_mtd_info_name={=script:Y_Tools get_mtd_info name=}=}

{=var-set:_root_used_percent={=script:Y_Tools get_flash_info root used_percent=}=}
{=var-set:_root_total={=script:Y_Tools get_flash_info root total=}=}
{=var-set:_root_used={=script:Y_Tools get_flash_info root used=}=}
{=var-set:_root_free={=script:Y_Tools get_flash_info root free=}=}

{=var-set:_var_used_percent={=script:Y_Tools get_flash_info var used_percent=}=}
{=var-set:_var_total={=script:Y_Tools get_flash_info var total=}=}
{=var-set:_var_used={=script:Y_Tools get_flash_info var used=}=}
{=var-set:_var_free={=script:Y_Tools get_flash_info var free=}=}

{=var-set:_mem_used_percent={=script:Y_Tools get_mem_info used_percent=}=}
{=var-set:_mem_total={=script:Y_Tools get_mem_info total=}=}
{=var-set:_mem_used={=script:Y_Tools get_mem_info used=}=}
{=var-set:_mem_free={=script:Y_Tools get_mem_info free=}=}

{=var-set:boxmodel={=func:get_boxmodel=}=}

{=include-block:Y_Blocks.txt;head=}
{=include-block:Y_Blocks.txt;js_jquery=}
<script src="/Y_Baselib.js"></script>
<script>
// taken from http://www.jjam.de/JavaScript/Datum_Uhrzeit/Wochentag.html
function getWeekDay(dd,mm,yyyy) {
	var month = "312831303130313130313031";
	var days = (yyyy-1)*365 + (dd-1);
	for(var i=0;i<mm-1;i++) days += month.substr(i*2,2)*1;
	if(yyyy>1582 || yyyy==1582 && (mm>10 || mm==10 && dd >4)) days -= 10;
	var leapyears = Math.floor(yyyy / 4);
	if(yyyy%4==0 && mm<3) leapyears--;
	if(yyyy>=1600) {
		leapyears -= Math.floor((yyyy-1600) / 100);
		leapyears += Math.floor((yyyy-1600) / 400);
		if(yyyy%100==0 && mm<3) {
			leapyears++;
			if(yyyy%400==0) leapyears--;
		}
	}
	days += leapyears;
	return "SatSonMonThuWedThuFri".substr(days%7*3,3);
}

function compareVersion(_vi, _vo)
{
	if (_vi == "" || _vo == "")
		return;

	if (_vi >= _vo)
		jQuery(document).ready(function(){jQuery('.upd_no').show().css('color', '#c0c0c0')});
	else
		jQuery(document).ready(function(){jQuery('.upd_yes').show().css('color', '#008000')});
}

function getVersion(_version)
{
	if (_version == "")
		return;
	var Vmajor = _version.substr(1, 1);
	var Vminor = _version.substr(2, 2);

	document.write(Vmajor + "." + Vminor);
}

function getBuild(_version)
{
	if (_version == "") return;

	var month=new Array(13);
		month[0]="";
		month[1]="Jan";
		month[2]="Feb";
		month[3]="Mar";
		month[4]="Apr";
		month[5]="May";
		month[6]="Jun";
		month[7]="Jul";
		month[8]="Aug";
		month[9]="Sep";
		month[10]="Oct";
		month[11]="Nov";
		month[12]="Dec";

	var Byear = _version.substr(4, 4);
	var Bmonth = _version.substr(8, 2).replace( /^(0+)/g, '' );
	var Bday = _version.substr(10, 2);
	var Bhour = _version.substr(12, 2);
	var Bmin = _version.substr(14, 2);

	document.write(getWeekDay(Bday,Bmonth,Byear) + " " + month[Bmonth] + " " + Bday + " " + Bhour + ":" + Bmin + " CEST " + Byear);
}

function get_update_txt()
{
	show_waitbox(true);
	loadSyncURL("/control/exec?Y_Tools&get_update_txt&{=func:get_revision=}&\"{=func:get_boxname=}\"&{=func:get_chip_type=}&nightly");
	window.document.location.href="/Y_About_Image.yhtm?ani=false";
}

jQuery(document).ready(function()
{
	if ("{=ani=}" == "false")
	{
		jQuery('#_root_used_graph').css({ width: "{=var-get:_root_used_percent=}%"});
		jQuery('#_var_used_graph').css({ width: "{=var-get:_var_used_percent=}%"});
		jQuery('#_mem_used_graph').css({ width: "{=var-get:_mem_used_percent=}%"});
	}
	else
	{
		jQuery('#_root_used_graph').delay(750).animate({ width: "{=var-get:_root_used_percent=}%"}, 750);
		jQuery('#_var_used_graph').delay(750).animate({ width: "{=var-get:_var_used_percent=}%"}, 750);
		jQuery('#_mem_used_graph').delay(750).animate({ width: "{=var-get:_mem_used_percent=}%"}, 750);
	}

	loadSyncURL("/control/exec?Y_Tools&rm_update_txt");
});
</script>
{=include-block:Y_Blocks.txt;head_close=}
<body>
{=var-set:wait_text={=L:info.check_for_updates=}=}{=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:info.about_image=}=}{=include-block:Y_Blocks.txt;work_menu=}
	</div></div>
	<div class="work_box_body">
		<table border="0" cellpadding="2" cellspacing="4" width="100%">
		<tr>
			<td valign="bottom" colspan="4">
				<a href="http://{=ini-get:/.version;homepage=}" target="_blank">
					<img border="0" src="/usr/share/tuxbox/neutrino/icons/hint_imagelogo.png" alt=""/>
				</a>
			</td>
		</tr>
		<tr>
			<td colspan="4">
				<hr/>
			</td>
		</tr>
		<tr>
			<td valign="top" width="22%">
				<a href="http://{=ini-get:/.version;homepage=}" class="exlink" target="_blank">
					{=ini-get:/.version;homepage=}
				</a>
			</td>
			<td valign="top" width="10%">
				<b>Image</b>:<br/>
				Version:<br/>
				Datum:<br/>
				Ersteller:<br/>
			</td>
			<td valign="top" width="28%">
				{=ini-get:/.version;imagename=}<br/>
				<abbr class="version" title="{=L:info.about.your_image=}">
				<script>getVersion("{=ini-get:/.version;version=}");</script><br/>
				<script>getBuild("{=ini-get:/.version;version=}");</script><br/>
				</abbr>
				{=ini-get:/.version;creator=}<br/>
			</td>
			<td valign="top" width="38%">
				{=if-file-exists:/tmp/update.txt~
				<script>compareVersion("{=ini-get:/.version;version=}", "{=ini-get:/tmp/update.txt;version=}");</script>
				<span class="upd_no">{=L:info.about.image_upd_no=}</span>
				<span class="upd_yes">{=L:info.about.image_upd_yes=}</span>
				<br/>
				<abbr class="version" title="{=L:info.about.actual_image=}">
				<script>getVersion("{=ini-get:/tmp/update.txt;version=}");</script><br/>
				<script>getBuild("{=ini-get:/tmp/update.txt;version=}");</script><br/>
				</abbr>
				<br/>
				~
				<input type="button" onclick='get_update_txt();' value="{=L:info.check_for_updates=}" />
				=}
			</td>
		</tr>
		<tr>
			<td colspan="4">
				<hr/>
			</td>
		</tr>
		<tr>
			<td valign="top" width="22%">
			</td>
			<td valign="top" width="10%">
				<b>Root</b>:<br/>
				Total:<br/>
				Used:<br/>
				Free:<br/>
			</td>
			<td valign="top" width="28%">
				<span id="_root_used_percent">{=var-get:_root_used_percent=}</span>%<br/>
				<span id="_root_total">{=var-get:_root_total=}</span> MB<br/>
				<span id="_root_used">{=var-get:_root_used=}</span> MB<br/>
				<span id="_root_free">{=var-get:_root_free=}</span> MB<br/>
			</td>
			<td valign="top" width="38%">
				<div class="_used_graph">
					<div id="_root_used_graph" class="_inner_graph"></div>
				</div>
			</td>
		</tr>
{=if-equal:{=var-get:boxmodel=}~Apollo~
		<tr>
			<td colspan="4">
				<hr/>
			</td>
		</tr>
		<tr>
			<td valign="top" width="22%">
			</td>
			<td valign="top" width="10%">
				<b>Var</b>:<br/>
				Total:<br/>
				Used:<br/>
				Free:<br/>
			</td>
			<td valign="top" width="28%">
				<span id="_var_used_percent">{=var-get:_var_used_percent=}</span>%<br/>
				<span id="_var_total">{=var-get:_var_total=}</span> MB<br/>
				<span id="_var_used">{=var-get:_var_used=}</span> MB<br/>
				<span id="_var_free">{=var-get:_var_free=}</span> MB<br/>
			</td>
			<td valign="top" width="38%">
				<div class="_used_graph">
					<div id="_var_used_graph" class="_inner_graph"></div>
				</div>
			</td>
		</tr>
~=}
		<tr>
			<td colspan="4">
				<hr/>
			</td>
		</tr>
		<tr>
			<td valign="top" width="22%">
			</td>
			<td valign="top" width="10%">
				<b>Memory</b>:<br/>
				Total:<br/>
				Used:<br/>
				Free:<br/>
			</td>
			<td valign="top" width="28%">
				<span id="_mem_used_percent">{=var-get:_mem_used_percent=}</span>%<br/>
				<span id="_mem_total">{=var-get:_mem_total=}</span> MB<br/>
				<span id="_mem_used">{=var-get:_mem_used=}</span> MB<br/>
				<span id="_mem_free">{=var-get:_mem_free=}</span> MB<br/>
			</td>
			<td valign="top" width="38%">
				<div class="_used_graph">
					<div id="_mem_used_graph" class="_inner_graph"></div>
				</div>
			</td>
		</tr>
		<tr>
			<td colspan="4">
				<hr/>
			</td>
		</tr>
		<tr>
			<td valign="top" width="22%">
			</td>
			<td valign="top" width="10%">
				{=var-get:_mtd_info_dev=}
			</td>
			<td valign="top" width="28%">
				{=var-get:_mtd_info_name=}
			</td>
			<td valign="top" width="38%">
			</td>
		</tr>
		</table>
	</div>
</div>
</body>
</html>
