--- diymap.js.ori	2009-07-06 15:45:43.000000000 +0200
+++ diymap.js	2010-04-20 15:28:40.000000000 +0200
@@ -72,6 +72,7 @@
 	
 	$("#" + type + "-fieldset div fieldset:gt(0)").each(function() {
 		renumItems(this, counter);
+		counter++;
 	});
 
 }


--- diymap.module.ori	2009-07-06 15:45:43.000000000 +0200
+++ diymap.module	2010-04-20 16:06:21.000000000 +0200
@@ -231,6 +231,35 @@
 
   $counter = 0;
   
+  //get old points
+  $points_tab = array();
+  if($node->nid != "") {
+    //If update node, get old point values
+    $query = "SELECT data FROM {diymap} WHERE nid = ".$node->nid;
+    $data = unserialize(db_result(db_query($query)));
+    $points_tab = array_keys($data["point"]);
+  }
+  
+  //update $node->point if del
+  foreach($node->point as $point) {
+    if( $counter > 0 ) {
+      //if all empty data and this point ever exit, it should be a deletion
+      if(($point['name'] == '' && $point['data'] == '' && $point['url'] == '' && $point['hover'] == '') && in_array('point__' . $counter, $points_tab)) {
+        $nextcpt = $counter+1;
+        //If last one point, it is a delete point
+        if(!isset($node->point["point__".$next])) array_pop($node->point);
+        else {
+          //If not last one point, but next is also without data it is a delete point
+          $next = $node->point["point__".$next];
+          if($next['name'] == '' && $next['data'] == '' && $next['url'] == '' && $next['hover'] == '') array_pop($node->point);
+        }
+      }
+    }
+    $counter++;
+  }
+  
+  $counter = 0;
+
   foreach($node->point as $point) {
   	  if( $counter > 0 ) {
         if( $point['name'] == '' ) {
