<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<!-- Template: Copyright, ZZEE, 2001-2005. All rights reserved. -->
<!-- Only registered users of ZZEE Art HTML Listing can use the template
and javascript code contained in their projects. Any other use is prohibited. -->

<head>
<title>Directory Listing</title>
<meta name="generator" content="ZZEE Art HTML Listing" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<style type="text/css">
<!--
	body
	{	
		font-family: "Times New Roman";
		font-size: 12pt;
	 	background-color: #ffffff;
		color: #000000;
		text-align: left;
	}
	td
	{	
		font-family: "Times New Roman";
		font-size: 12pt;
		color: #000000;
		text-align: left;
	}
	a, a:visited {color: #000000;}
	a:hover { color: #ffffff; background: #000000;}
	table {border: none; width:100%; padding:3px;}
    .header 
	{
		text-align:center;
		background-color: #ccccff; 
		font-weight:bold;
        cursor: pointer;
        border: outset 1px;
	}
    .headerH
	{
		text-align:center;
		background-color: #ffcc88; 
		font-weight:bold;
        cursor: pointer;
        border: outset 1px;
	}
	.odd {background-color: #ffffff;}
	.even {background-color: #e3e3e3;}
	.rite {text-align:right;}
-->
</style>

<script type="text/javascript">
<!--

function getCellVal(cell)
{
    var out = '';
    for (var i = 0; i < cell.childNodes.length; i++)
    {
        var obj = cell.childNodes[i];
        switch(obj.nodeType)
        {
            case 1:
                out += getCellVal(obj);
                break;
            case 3:
                out += obj.nodeValue;
                break;
        }
    }
    return out;
}

function lItem(folder, value)
{
    this.folder = folder;
    this.value = value;
}

function compItems(f, s)
{
    var i = s.folder - f.folder;
    if (i) return i;

    if (f.value > s.value) return 1;
    else if (f.value == s.value) return 0;
    return -1;
}

function getVal(row, i)
{
    var d = (row.id.charAt(0) == 'd');
    var obj = new lItem(d, 0);

    if (d)
    {
        switch(i)
        {
            case 1:
            case 3:
                //return obj;
            case 2: 
                //obj.value = "";
                return obj;
        }
    }

    var v = getCellVal(row.cells[i]);
    switch(i)
    {
        case 0:
            if (5 == <!--#echo var="filesordered"-->)
                v = v.toLowerCase();
            break;
        case 1:
            v = v.replace(/,/g, '');
            v = parseInt(v);
            if (isNaN(v)) v = 0;
            break;
        case 2:
            break;
        case 3:
        {
            var re = /([0-9]+)\/([0-9]+)\/([0-9]+) (([0-9]+):([0-9]+))?/;
            var a = v.match(re);
            if (a.length > 4)
            {
                v = new Date(a[3], a[1] - 1, a[2], a[5], a[6], 0);
            }
            else if (a.length == 4)
            {
                v = new Date(a[3], a[1] - 1, a[2]);
            }
            else v = 0;
            break;
        }
    }
    
    obj.value = v;
    return obj;
}

var inv = new Array(4);
for (var i = 0; i < 4; i++) inv[i] = 0;
var col = 0;

function sortIt(number)
{
    var t = document.getElementById("table");
    if (!t) return;
    var body = t.tBodies[0];

    var invert = (col == number) ? (!inv[col]) : 0;
    if (col >= 0) unMarkCol(t.tHead.rows[0].cells[col]);
    col = number;
    inv[col] = invert;

    var j, start, end;
    var v, w;
    var count = body.rows.length;
    for (var i = 1; i < count; i++)
    {
        v = getVal(body.rows[i], col);

        start = 0;
        end = i - 1;
        for (; end > start + 1; )
        {
            j = start + (end - start) / 2; // does it cast to int ?
            j = parseInt(j); // just in case
            w = getVal(body.rows[j], col);
            w = (invert ? (-1) : 1) * compItems(v, w);
            if (w < 0) end = j;
            else start = j;  
        }

        w = getVal(body.rows[start], col);
        w = (invert ? (-1) : 1) * compItems(v, w);
        if (w < 0)
        {
            body.insertBefore(body.rows[i], body.rows[start]);
            continue;
        }

        w = getVal(body.rows[end], col);
        w = (invert ? (-1) : 1) * compItems(v, w);
        if (w < 0) body.insertBefore(body.rows[i], body.rows[end]);
    }

    for (var i = 0; i < count; i++)
    {
        body.rows[i].className = (i % 2) ? "even" : "odd";
    }

    markCol(t.tHead.rows[0].cells[col], invert);
}

function hl(cell)
{
    cell.className = "headerH";
}

function uhl(cell)
{
    cell.className = "header";
}

var img = document.createElement('img');
img.src = '<!--#echo var='image_dir' -->trUp.gif';
img.width = 11;
img.height = 11;
img.alt = 'o';

var imgI = document.createElement('img');
imgI.src = '<!--#echo var='image_dir' -->trDown.gif';
imgI.width = 11;
imgI.height = 11;
imgI.alt = 'o';

function markCol(cell, inv)
{
    if (cell.firstChild)
    {
        if (cell.firstChild.tagName != 'IMG')
            cell.insertBefore((inv ? imgI : img), cell.firstChild);
    }
    else
    {
        cell.appendChild((inv ? imgI : img));
    }
}

function unMarkCol(cell)
{
    if (cell.firstChild && (cell.firstChild.tagName == 'IMG'))
        cell.removeChild(cell.firstChild);
}

function markFirstCol()
{
    var t = document.getElementById("table");
    if (!t) return;
    markCol(t.tHead.rows[0].cells[0], 0);
}

//-->
</script>
</head>

<body onload="markFirstCol();">
<table id="table" style="table-layout:fixed; width:100%;">
<thead>
<tr>
    <td onclick="sortIt(0);" onmouseover="hl(this);" onmouseout="uhl(this);" class="header" style="width:40%">&#160;Name</td>
    <td onclick="sortIt(1);" onmouseover="hl(this);" onmouseout="uhl(this);" class="header" style="width:15%">&#160;Size</td>
    <td onclick="sortIt(2);" onmouseover="hl(this);" onmouseout="uhl(this);" class="header" style="width:25%">&#160;Type</td>
    <td onclick="sortIt(3);" onmouseover="hl(this);" onmouseout="uhl(this);" class="header" style="width:20%">&#160;Modified Date</td>
</tr>
</thead>
<tbody>
<!--#for var="tree"--><!--#if var="real" -->
<tr id="<!--#if var="isdir" -->d<!--#else-->f<!--#endif--><!--#echo var='counter'-->" class="<!--#if var='mod2'-->odd<!--#else-->even<!--#endif-->">
<td><img src="<!--#echo var='image_dir' --><!--#echo var='icon' -->" width="24" height="24" alt="icon"/>
 <a href="<!--#echo var='relurl'-->"><!--#echoe var='fullname'--></a></td>
<td class="rite"><!--#if var="isdir" --><!--#else--><!--#echo var='size'--> <!--#echo var='sizeunit'--><!--#endif-->&#160;</td>
<td><!--#echoe var="media" --></td>
<td><!--#if var="isdir" --><!--#else--><!--#echo var='time'--><!--#endif--></td>
</tr>
<!--#endif var="real" --><!--#endfor var="tree"-->
</tbody>
</table>


<!-- /////// SUMMARY //////////////// -->
<!--#if var="show_summary" -->
<br />
<table>
<tr>
    <td>Total folders: <!--#echo var="total_folders" --></td>
</tr>
<tr>
    <td>Total files: <!--#echo var="total_files" --></td>
</tr>
<tr>
    <td>Total size of all files: <!--#echo var="total_size" --></td>
</tr>
<tr>
    <td>Date generated: <!--#echo var="now" --></td>
</tr>
</table>
<!--#endif var="show_summary" -->
<!-- /////// END OF SUMMARY //////////////// -->

</body>
</html>