# Call to get uptime info for template.
_UPTIME = %x[uptime]
# Call to get current date for template.
_DATE =%x[date +%Y-%m-%d]

# Main page.
%{
	<HTML> <HEAD> <!-- This HTML file has been created by a ruby servlet -->
	<TITLE>Camera Archive View Interface</TITLE>
	<link rel="stylesheet" type="text/css" href="/style.css">
	<SCRIPT type="text/javascript">
	<!--
	function updateImg() {
		var myClass = document.getElementsByClassName("camImage");
		/*
		console.log(myClass);
		console.log(myClass[0].id);
		console.log(myClass.length);
		*/
		for (var i = 0; i < myClass.length; i++) {
			// console.log(myClass[i].id);
			if (document.getElementById(myClass[i].id)) {
				var tempImage = document.getElementById(myClass[i].id).src.split("&");
				document.getElementById(myClass[i].id).src = tempImage[0]+"&rand="+ Math.random();
			}
		}
	}
	//-->
	</SCRIPT>
	</HEAD>
	<BODY>
	<script>
		//call after page loaded
		window.onload=setInterval(updateImg, #{ALIMGUPDATETIME});
	</script>
	<TABLE border="1" cellpadding="5" >
		<TBODY>
			<TR>
				<TD align="center">
					<A HREF="/"><img src="ifetch.png" align="left" width=50 heigth=50></A>
					#{_DATE}
					#{_UPTIME}
					<BR>
					<FONT size=+2> (Archive) </FONT><a href="/live" >Live</a> <a href="/monitor" >Monitor</a>
				</TD>
			</TR>
		</TBODY>
	</TABLE>
	#{myTempRespond}
	<br>version: #{VER}
	</BODY>
	</HTML>
}
