document.write("#!/usr/bin/perl");
document.write("#use strict;");
document.write("use Text::Template;");
document.write("use HTML::Template;");
document.write("use Time::Local;");
document.write("use Astro::Time;");
document.write("use Date::DayOfWeek;");
document.write("##########");
document.write("require '/home/radish/www/lib/stdin.pm';");
document.write("");
document.write("%data = &c::get_stdin;");
document.write("#print \'Content-Type: text/html\n\n\';");
document.write("#print \'date: \'.$data{'date'}.\'
\';");
document.write("$_ = $data{'date'};");
document.write("$Year = substr($_, 0, 4);");
document.write("$Month = substr($_, 4, 2);");
document.write("$Day = substr($_, 6, 2);");
document.write("");
document.write("if($Day>31){");
document.write(" $Day=1;");
document.write(" $Month++;");
document.write("}");
document.write("if($Month>12){");
document.write(" $Month=1;");
document.write(" $Year++;");
document.write("}");
document.write("");
document.write("my $Template_file = '/home/radish/www/htdocs/getalife/events/tpl/cal.tpl';");
document.write("");
document.write("if ($Year > 1900 and $Month >= 1 and $Month <= 12 and $Day >= 1 and $Day <= 31){");
document.write(" $Weekday = (localtime(timelocal(0, 0, 12, $Day, $Month-1, $Year-1900)))[6]+1;");
document.write("}");
document.write("else {");
document.write(" ($Day, $Month, $Year, $Weekday) = (localtime)[3..6];");
document.write(" $Month += 1;");
document.write(" $Year += 1900;");
document.write(" $Weekday += 1;");
document.write("}");
document.write("");
document.write("$tpl = Text::Template->new(");
document.write(" source => $Template_file,");
document.write(" delimiters => ['', '?>'],");
document.write(");");
document.write("require '/home/radish/www/htdocs/getalife/events/cgi/calgrid.lib';");
document.write("require '/home/radish/www/htdocs/getalife/events/cgi/dateconv.lib';");
document.write("");
document.write("#print \'Year: $Year
\';");
document.write("#print \'Month: $Month
\';");
document.write("#print \'Day: $Day
\';");
document.write("");
document.write("");
document.write("print \'Content-Type: text/html\n\n\';");
document.write("#$output =~ s/\n//g;");
document.write("print \'
\'.&Calendar_Grid($Year,$Month,$Day).\' |