+my $js_name = $name;
+$js_name =~ s/[<>"']/ /g;
+$m->interp->apply_escapes($js_name, 'js_string');
+$js_name =~ s/^'//;
+$js_name =~ s/'$//;
+
+my $conf = new FS::Conf;
+my $apikey = $conf->config('google_maps_api_key');
+
+#for directions link
+my @origin = $opt{company_address}
+ ? @{ $opt{company_address} }
+ : ( $conf->config('company_physical_address', $agentnum)
+ ? $conf->config('company_physical_address', $agentnum)
+ : $conf->config('company_address', $agentnum) );
+my $origin = uri_escape(join(',', @origin));
+