+% my $batchnum = $cgi->param('download');
+% if ( $batchnum =~ /^\d+$/ ) {
+% my $download = $p."misc/download-bill_batch.html?$batchnum";
+<HTML>
+<HEAD><TITLE>Starting download...</TITLE>
+<SCRIPT TYPE="text/javascript">
+function start() {
+ window.location.replace('<% $download %>');
+}
+</SCRIPT>
+<!--[if lte IE 7]>
+<SCRIPT TYPE="text/javascript">function start() {}</SCRIPT>
+<![endif]-->
+</HEAD>
+<BODY onload="start()" STYLE="background-color:#ccccff">
+<TABLE STYLE="height:125px; width:100%; text-align:center"><TR><TD STYLE="vertical-align:middle;text-align:center">
+<A HREF="<% $download %>">Click here if your download does not start</A>
+</TD></TR></TABLE>
+<& /elements/footer.html &>
+% }
+% else {
+%# delete existing download cookie
+% my $cookie = CGI::Cookie->new(
+% -name => 'bill_batch_download',
+% -value => 0,
+% -expires => '-1d',
+% );
+% $r->headers_out->add( 'Set-Cookie' => $cookie->as_string );
+<& elements/search.html,