<html>

<body bgcolor="#212127">

	<head>
		<title><%=dirname%></title>
		<meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=0.6" />
		<style>
			body {
				font: normal 14px Verdana;
				color: #999999;
			}

			td {
				vertical-align: top;
                word-wrap: break-word;
                word-break: break-all;
                table-layout: fixed;
                padding: 0 12;
                vertical-align: middle;
			}

			textarea {
				font: normal 14px Verdana;
				color: #999999;
				background-color: #212127;
				width: 100%;
				height: 700;
			}

			a {
				color: #9999ff;
			}
			.subtable {
				border-collapse: collapse;
				table-layout:fixed;
				width:100%
			}
			.maintable {
				border-collapse: collapse;
				table-layout:fixed;
				width:100%
				padding:0; margin:0;
				border: none !important;
			}
			tr {
				width:32%;
			}
			.butt {
				background-color: #212127;
				color: #999999;
				cursor: pointer;
				width: 100%;
				border: none;
				text-align: left;
				outline: none;
				font-size: 13px;
			}

		</style>
	</head>
	<center>
		<h1>
			<%=dirname%>
		</h1>
	</center>
    <h3>
      <a href="<%= url + prevDir%>" > Up one level </a>
    </h3>
	</p>

	<table class="maintable">
		<% for (var i = 0; i < folders.length; i++) { %>
			<tr>
				<td>
					<button
                      class="butt"
                      onclick='itemClick("<%= "http://stuff.frylabs.net" + folders[i].path %>")'
                      style='<%= i % 2 === 0 ? "background-color: #2f2f37" : "" %>'
                      onmouseenter='mouseEnter(this, <%= i %>)'
                      onmouseleave='mouseLeave(this, <%= i %>)'
                      > 
						<table class="subtable">
                          <tr height="62">
							<td style='width:30%;'>
								<%=folders[i].name %>
							</td>
							<td style='width:20%;'>
								<%=folders[i].mtime %>
							</td>
							<td style='width:10%;'>
								<%= folders[i].size === 0 ? "Dir" : folders[i].size + 'MB' %>
							</td>
                          </tr>
						</table>
					</button>
				</td>
			</tr>
		<% } %>
	</table>
</body>
<script>
  console.log('hi')
  function itemClick (e) {
    location.href = e
  }
  function mouseEnter (e, i) {
    e.style.backgroundColor = "#555"
  }
  function mouseLeave (e, i) {
    if (i % 2 == 0) {
      e.style.backgroundColor = "#2f2f37"
    } else {
      e.style.backgroundColor = "#212127"
    }
  }
</script>
</html>