--- loncom/homework/imageresponse.pm	2001/12/04 15:17:56	1.14
+++ loncom/homework/imageresponse.pm	2002/02/04 17:30:53	1.17
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # image click response style
 #
-# $Id: imageresponse.pm,v 1.14 2001/12/04 15:17:56 albertel Exp $
+# $Id: imageresponse.pm,v 1.17 2002/02/04 17:30:53 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -31,7 +31,7 @@
 package Apache::imageresponse;
 use strict;
 
-sub BEGIN {
+BEGIN {
   &Apache::lonxml::register('Apache::imageresponse',('imageresponse'));
 }
 
@@ -51,6 +51,7 @@ sub start_imageresponse {
 sub end_imageresponse {
   &Apache::response::end_response;
   pop @Apache::lonxml::namespace;
+  &Apache::lonxml::deregister('Apache::imageresponse',('foilgroup','foil','text','image','rectangle','conceptgroup'));
   return '';
 }
 
@@ -271,7 +272,9 @@ sub grade_rectangle {
   &Apache::lonxml::debug("Point $x1,$y1,$x2,$y2");
   if ($x1 > $x2) { my $temp=$x1;$x1=$x2;$x2=$temp; }
   if ($y1 > $y2) { my $temp=$y1;$y1=$y2;$y2=$temp; }
-  if ($x => $x1) { if ($x <= $x2) { if ($y => $y1) { if ($y <= $y2) { return 'APPROX_ANS'; } } } }
+  if (($x >= $x1) && ($x <= $x2) && ($y >= $y1) && ($y <= $y2)) {
+    return 'APPROX_ANS';
+  }
   return 'INCORRECT';
 }