+push @search, "availbatch = '$1'"
+ if ( $cgi->param('availbatch') =~ /^([\w\d \/\:\-\.]+)$/ );
+
+push @search, "countrycode = '$1'"
+ if ( $cgi->param('countrycode') =~ /^(\d{1,3})$/ );
+
+push @search, "phone_avail.state = '$1'"
+ if ( $cgi->param('state') =~ /^(\w{2})$/ );
+
+# i know that the regexps match more than NPA/NXX, but this is good enough now
+push @search, "npa = '$1'"
+ if ( $cgi->param('npa') =~ /^(\d{3})$/ );
+push @search, "nxx = '$1'"
+ if ( $cgi->param('npa') =~ /^\d{3}$/ && $cgi->param('nxx') =~ /^(\d{3})$/ );
+
+push @search, "name = '$1'"
+ if ( $cgi->param('ratecenter') =~ /^([\w \-\.]+)$/ );
+
+push @search, "svcnum is null"
+ if ( $cgi->param('avail_status') eq 'AVAIL' );
+push @search, "svcnum is not null"
+ if ( $cgi->param('avail_status') eq 'UNAVAIL' );