+ $script_html .= <<END;
+ }
+ function ${prefix}county_changed(what) {
+END
+
+ if ( $cityflag) {
+ $script_html .= <<END;
+ saved_city = "$param->{selected_city}";
+ county = what.options[what.selectedIndex].text;
+ state = what.form.${prefix}state.options[what.form.${prefix}state.selectedIndex].text;
+ country = what.form.${prefix}country.options[what.form.${prefix}country.selectedIndex].text;
+ for ( var i = what.form.${prefix}city_select.length; i >= 0; i-- )
+ what.form.${prefix}city_select.options[i] = null;
+END
+
+ foreach my $country ( sort keys %cust_main_county ) {
+ $script_html .= "\nif ( country == \"$country\" ) {\n";
+ foreach my $state ( sort keys %{$cust_main_county{$country}} ) {
+ $script_html .= "\nif ( state == \"$state\" ) {\n";
+ #foreach my $county ( sort @{$cust_main_county{$country}{$state}} ) {
+ foreach my $county ( sort keys %{$cust_main_county{$country}{$state}} ) {
+ $script_html .= "\nif ( county == \"$county\" ) {\n";
+ foreach my $city ( sort keys %{$cust_main_county{$country}{$state}{$county}} ) {
+ my $text = $city || '(n/a)';
+ if (!$city) {
+ $script_html .= qq!what.form.${prefix}city.style.display='';\n
+ what.form.${prefix}city_select.style.display='none';\n!
+ }
+ else {
+ $script_html .= qq!var citySelected = false; if (saved_city == "$text") { citySelected = true; }\n
+ opt(what.form.${prefix}city_select, "$city", "$text", citySelected);\n
+ what.form.${prefix}city.style.display='none';\n
+ what.form.${prefix}city_select.style.display='';\n!
+ }
+ }
+ $script_html .= "}\n";
+ }
+ $script_html .= "}\n";
+ }
+ $script_html .= "}\n";
+ }
+ }
+
+ $script_html .= <<END;
+ }
+ function ${prefix}city_select_changed(what) {
+END
+
+ if ( $cityflag ) {
+ $script_html .= <<END;
+ what.form.${prefix}city.value = what.options[what.selectedIndex].value;
+END
+ }
+