--- loncom/homework/chemresponse.pm	2003/07/01 21:04:48	1.10
+++ loncom/homework/chemresponse.pm	2003/07/01 21:10:43	1.11
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # chemical equation style response
 #
-# $Id: chemresponse.pm,v 1.10 2003/07/01 21:04:48 albertel Exp $
+# $Id: chemresponse.pm,v 1.11 2003/07/01 21:10:43 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -228,16 +228,16 @@ sub end_organicstructure {
 }
 
 sub edit_reaction_button {
-    my ($id,$field,$molecule)=@_;
+    my ($id,$field,$reaction)=@_;
     my $id_es=&Apache::lonnet::escape($id);
     my $field_es=&Apache::lonnet::escape($field);
-    my $molecule_es=&Apache::lonnet::escape($molecule);
+    my $reaction_es=&Apache::lonnet::escape($reaction);
     my $result=<<EDITREACTION;
 <script type="text/javascript">
     function create_reaction_window_${id}_${field} () {
 	editor=window.open('','','width=500,height=270,scrollbars=no,resizable=yes');
 	editor.document.open('text/html','replace');
-	editor.document.writeln('<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><html> <head><title>LON-CAPA Reaction Editor</title></head><frameset rows="30%,*" border="0">  <frame src="/res/adm/pages/reactionresponse/reaction_viewer.html" name="viewer" scrolling="no" />  <frame src="/res/adm/pages/reactionresponse/reaction_editor.html?molecule=$molecule_es&id=$id_es&field=$field_es" name="editor" scrolling="no" /> </frameset> </html>');
+	editor.document.writeln('<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><html> <head><title>LON-CAPA Reaction Editor</title></head><frameset rows="30%,*" border="0">  <frame src="/res/adm/pages/reactionresponse/reaction_viewer.html" name="viewer" scrolling="no" />  <frame src="/res/adm/pages/reactionresponse/reaction_editor.html?reaction=$reaction_es&id=$id_es&field=$field_es" name="editor" scrolling="no" /> </frameset> </html>');
     }
 </script>
 <input type='button' value='Edit Reaction' onClick="javascript:create_reaction_window_${id}_${field}();void(0);" />
@@ -251,7 +251,10 @@ sub start_reactionresponse {
     my $id = &Apache::response::start_response($parstack,$safeeval);
     if ($target eq 'meta') {
     } elsif ($target eq 'web') {
-	$result.=&edit_reaction_button($id,"HWVAL_$id");
+	my $partid = $Apache::inputtags::part;
+	my $id = $Apache::inputtags::response['-1'];
+	my $reaction=$Apache::lonhomework::history{"resource.$partid.$id.submission"};
+	$result.=&edit_reaction_button($id,"HWVAL_$id",$reaction);
     } elsif ($target eq "edit") {
 	$result .=&Apache::edit::tag_start($target,$token);
 	my $answer=&Apache::lonxml::get_param('answer',$parstack,