function opt(what,href,text) {
var optionName = new Option(text, href, false, false)
var length = what.length;
what.options[length] = optionName;
}
function popstate_changed(what) {
state = what.options[what.selectedIndex].text;
for (var i = what.form.popnum.length;i > 0;i--)
what.form.popnum.options[i] = null;
what.form.popnum.options[0] = new Option("", "", false, true);
END
foreach my $popstate ( sort { $a cmp $b } keys %pop ) {
$text .= "\nif ( state == \"$popstate\" ) {\n";
foreach my $pop ( @{$pop{$popstate}}) {
my $o_popnum = $pop->{popnum};
my $poptext = $pop->{city}. ', '. $pop->{state}.
' ('. $pop->{ac}. ')/'. $pop->{exch};
$text .= "opt(what.form.popnum, \"$o_popnum\", \"$poptext\");\n"
}
$text .= "}\n";
}
$text .= "}\n\n";
$text .=
qq!'; #callback? return 3 html pieces? #'';
$text .= qq!';
$text;
}
sub expselect {
my $prefix = shift;
my $date = shift || '';
my( $m, $y ) = ( 0, 0 );
if ( $date =~ /^(\d{4})-(\d{2})-\d{2}$/ ) { #PostgreSQL date format
( $m, $y ) = ( $2, $1 );
} elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) {
( $m, $y ) = ( $1, $3 );
}
my $return = qq! |