--- loncom/homework/imageresponse.pm	2007/10/15 09:47:29	1.90
+++ loncom/homework/imageresponse.pm	2008/03/12 02:46:53	1.93
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # image click response style
 #
-# $Id: imageresponse.pm,v 1.90 2007/10/15 09:47:29 foxr Exp $
+# $Id: imageresponse.pm,v 1.93 2008/03/12 02:46:53 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -59,6 +59,7 @@ sub start_imageresponse {
 	$result=&Apache::response::meta_package_write('imageresponse');
     } elsif ($target eq 'analyze') {
 	my $part_id="$Apache::inputtags::part.$id";
+        $Apache::lonhomework::analyze{"$part_id.type"} = 'imageresponse';
 	push (@{ $Apache::lonhomework::analyze{"parts"} },$part_id);
 	push (@{ $Apache::lonhomework::analyze{"$part_id.bubble_lines"} },
 	      1);
@@ -222,7 +223,7 @@ sub draw_image {
 	    }
 	}
     }
-    &Apache::lonnet::appenv(%x);
+    &Apache::lonnet::appenv(\%x);
     return $id;
 }
 
@@ -237,7 +238,8 @@ sub displayfoils {
 	if ($target eq 'tex') {$result.="\\vskip 0 mm \n";} else {$result.="<br />\n";}
 	my $image=$Apache::response::foilgroup{"$name.image"};
 	&Apache::lonxml::debug("image is $image");
-	if ( $target eq 'web' && $image !~ /^http:/ ) {
+	if ( ($target eq 'web' || $target eq 'answer') 
+	     && $image !~ /^http:/ ) {
 	    $image=&clean_up_image($image);
 	}
 	push(@images,$image);
@@ -302,7 +304,8 @@ sub display_answers {
     foreach my $name (@$whichopt) {
 	my $image=$Apache::response::foilgroup{"$name.image"};
 	&Apache::lonxml::debug("image is $image");
-	if ( $target eq 'web' && $image !~ /^http:/ ) {
+	if ( ($target eq 'web' || $target eq 'answer')
+	     && $image !~ /^http:/ ) {
 	    $image = &clean_up_image($image);
 	} 
 	my $token=&prep_image($image,'answeronly',$name);