<% // "new" check for folders
  String checkedExt = ".jpg.gif.mov.avi.divx.xvid.mpg.mpe.mpeg.mov.mp3.mp4.wmv.wma.asf.ram.rm.3gp.qt.swf.flv";
  String fileExt;
  int newest = 0;
  File subDir = files[imageNum-1];
  File[] list = subDir.listFiles();
  LinkedList ll = new LinkedList();
  for(i = 0; i < list.length; i++) ll.add(list[i]);
  for(i = 0; i < ll.size(); i++) {
    if (ll.get(i).isDirectory()) {
      File[] list2 = ll.get(i).listFiles();
      for(j = 0; j < list2.length; j++) ll.add(list2[j]);			
    }
    else {
      if((j = ll.get(i).getName().lastIndexOf(".")) != -1) {
        fileExt = ll.get(i).getName().substring(j).toLowerCase();
        if(checkedExt.indexOf(fileExt) != -1 && ((n = (ll.get(i).lastModified() / 86400000L).intValue())) > newest) newest = n;
	}
    }
  }
  if(newest > 0) out.print("<script type=\"text/javascript\">generatenew(" + newest + ");</script>&nbsp;");
%>