--- loncom/homework/chemresponse.pm	2011/07/04 09:24:54	1.89
+++ loncom/homework/chemresponse.pm	2013/01/15 18:09:43	1.91
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # chemical equation style response
 #
-# $Id: chemresponse.pm,v 1.89 2011/07/04 09:24:54 foxr Exp $
+# $Id: chemresponse.pm,v 1.91 2013/01/15 18:09:43 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -165,7 +165,7 @@ CHEMPAGE
     if (defined($shown_text)) { $display=&mt($shown_text); }
     my $iconpath=$Apache::lonnet::perlvar{'lonIconsURL'};
     my $function = 
-	'LONCAPA_draw_molecule_'.&Apache::lonhtmlcommon::get_uniq_name();
+	'LONCAPA_draw_molecule_'.&get_uniq_name();
     my $result=<<CHEMINPUT;
 <script type="text/javascript">
     function $function() {
@@ -337,8 +337,8 @@ sub end_organicresponse {
 
     if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || 
 	$target eq 'tex' || $target eq 'analyze') {
-	&Apache::lonxml::increment_counter(&Apache::response::repetition(), 
-					   "$partid.$id"); # part.response
+        my $repetition = &Apache::response::repetition();
+	&Apache::lonxml::increment_counter($repetition,"$partid.$id"); # part.response
 	if ($target eq 'analyze') {
             $Apache::lonhomework::analyze{"$partid.$id.type"} = 'organicresponse';
             push (@{ $Apache::lonhomework::analyze{"parts"} },"$partid.$id");
@@ -599,7 +599,8 @@ sub end_reactionresponse {
 
     if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || 
 	$target eq 'tex' || $target eq 'analyze') {
-	&Apache::lonxml::increment_counter(&Apache::response::repetition(), "$partid.$id");
+	my $repetition = &Apache::response::repetition();
+        &Apache::lonxml::increment_counter($repetition,"$partid.$id");
         if ($target eq 'analyze') {
             $Apache::lonhomework::analyze{"$partid.$id.type"} = 'reactionresponse';
             push (@{ $Apache::lonhomework::analyze{"parts"} },"$partid.$id");
@@ -643,5 +644,11 @@ sub end_chem {
     return $result;
 }
 
+my $uniq=0;
+sub get_uniq_name {
+    $uniq++;
+    return 'uniquename'.$uniq;
+}
+
 1;
 __END__