--- exif2gmap.module	2009-04-21 09:24:32.000000000 -0700
+++ exif2gmap.module.cache_fixed	2009-05-04 10:39:21.422918000 -0700
@@ -391,9 +391,11 @@ function exif2gmap_process($text, $forma
 	$script_tail ='}}';
 
 	$script=$script_head.$script_body.$script_tail;
-  //inline coding..
-	drupal_set_html_head('<script type="text/javascript" src="http://maps.google.com/maps?file=api&amp;v=2&amp;key='.$mapkey.'"></script>');
-	drupal_add_js($script,'inline');
+
+	//add JavaScript for creating the map to the filtered text. 
+	$text .= '<script type="text/javascript" src="http://maps.google.com/maps?file=api&amp;v=2&amp;key='
+	           . $mapkey.'"></script>';
+	$text .= '<script type="text/javascript">' . $script . '</script>';
 
 	//add div portion.
 	$text .= '<br><div id="map'.$digest.'" style="width: '.$width.'; height: '.$height.'"></div>';
