Index: schedule/Module/control.php
===================================================================
--- schedule/Module/control.php	(revision 17510)
+++ schedule/Module/control.php	(revision 17511)
@@ -3,11 +3,11 @@
 	var ctr;
 	
-	function clearNode(node){
-		var child = node.childNodes[0];
-		while(child != null)
+    function clearNode(node){
+                var child = node.childNodes[0];
+    		while(child != null)
 		{
 			node.removeChild(child);
 			child = node.childNodes[0];
-		}	
+		}     
 	}
 	
@@ -138,5 +138,5 @@
 <?php
 $cnt=0;
-$day=0;
+        $day=0;
 if(isset($_GET['days']))
 { 
@@ -185,5 +185,6 @@
 	var newtd_c1 = document.createElement("td");
 		newtd_c1.setAttribute("width","200");
-		newtd_c1.setAttribute("align","center");
+                newtd_c1.setAttribute("align","center");
+                newtd_c1.setAttribute("valign", "top");
 		newtd_c1.appendChild(
 			input_data = document.createElement("input"),
@@ -289,5 +290,6 @@
 	var newtd_c7 = document.createElement("td");
 		newtd_c7.setAttribute("width","115");
-		newtd_c7.setAttribute("align","center");
+                newtd_c7.setAttribute("align","center");
+                newtd_c7.setAttribute("valign", "top");
 		newtd_c7.appendChild(
 			input_data = document.createElement("input"),
@@ -321,4 +323,5 @@
 $cnt5 = 0;
 $cnt = 0;
+$cntrow = 0;
 //$data  = array();
 //$counter=0;
@@ -337,5 +340,5 @@
 			var list     = $(".datalisting").length;
                         var newlist = list+1;
-                        <?php $cnt++ ?>;
+                        <?php $cnt++;?>
                         
 			var cctr=$('.dataTable tr').length;
@@ -346,8 +349,8 @@
                         var selection;
 				 
-			var newdiv   = document.createElement("div");
-                                newdiv.setAttribute("id", "list_<?php echo $cnt; ?>");
-				newdiv.setAttribute("class","datalisting");
-				newdiv.setAttribute("style","margin:5px 0;");
+			var newdiv<?php echo $cnt; ?>   = document.createElement("div");
+                                newdiv<?php echo $cnt; ?>.setAttribute("id", "list_<?php echo $cnt; ?>");
+				newdiv<?php echo $cnt; ?>.setAttribute("class","datalisting");
+				newdiv<?php echo $cnt; ?>.setAttribute("style","margin:5px 0;");
 			
 			var newtable = document.createElement("table");
@@ -369,5 +372,6 @@
 			var newtd_c1 = document.createElement("td");
 				newtd_c1.setAttribute("width","200");
-				newtd_c1.setAttribute("align","center");
+                                newtd_c1.setAttribute("align","center");
+                                newtd_c1.setAttribute("valign", "top");
 				newtd_c1.appendChild(
 					input_data = document.createElement("input"),
@@ -392,9 +396,10 @@
                                 while($rows = mysql_fetch_array($observations))
                                 {
-                                    ?>
-
-                                    var newtr<?php echo $cnt; ?> = document.createElement("tr");
-				newtr<?php echo $cnt; ?>.setAttribute('class','tr');
-			
+                                    $cntrow++;
+                                          ?>
+
+                                    var newtr<?php echo $cntrow; ?> = document.createElement("tr");
+                                    newtr<?php echo $cntrow; ?>.setAttribute('class','tr');
+                                    		       
 			var newtd_c2 = document.createElement("td");
 				newtd_c2.setAttribute("width","138");
@@ -428,6 +433,6 @@
 					input_data.setAttribute("value","+"),
 					input_data.onclick = function(){ 
-					return addRow(newtr<?php echo $cnt; ?>);
-						ctr++;
+                                            return addRow(newtr<?php echo $cntrow; ?>);
+                                            	 ctr++;
 					});
 			var newtd_c3 = document.createElement("td");
@@ -474,13 +479,14 @@
 					input_data.setAttribute("type","button"),
 					input_data.setAttribute("value","Delete"),
-					input_data.onclick = function(){ return clearNode(newtr<?php echo $cnt; ?>);
+                                        input_data.onclick = function(){ return clearNode(newtr<?php echo $cntrow; ?>);
+
 					}
 				);
-			newtr<?php echo $cnt; ?>.appendChild(newtd_c2);
-			newtr<?php echo $cnt; ?>.appendChild(newtd_c3);
-			newtr<?php echo $cnt; ?>.appendChild(newtd_c4);
-			newtr<?php echo $cnt; ?>.appendChild(newtd_c5);
-			newInnertable.appendChild(newtr<?php echo $cnt; ?>);
-			
+			newtr<?php echo $cntrow; ?>.appendChild(newtd_c2);
+			newtr<?php echo $cntrow; ?>.appendChild(newtd_c3);
+			newtr<?php echo $cntrow; ?>.appendChild(newtd_c4);
+			newtr<?php echo $cntrow; ?>.appendChild(newtd_c5);
+                        newInnertable.appendChild(newtr<?php echo $cntrow; ?>);
+                        
                 <?php
 
@@ -494,10 +500,11 @@
 			var newtd_c7 = document.createElement("td");
 				newtd_c7.setAttribute("width","115");
-				newtd_c7.setAttribute("align","center");
+                                newtd_c7.setAttribute("align","center");
+                                newtd_c7.setAttribute("valign", "top");
 				newtd_c7.appendChild(
 					input_data = document.createElement("input"),
 					input_data.setAttribute("type","button"),
 					input_data.setAttribute("value","Delete Main"),
-					input_data.onclick = function(){ return clearNode(newdiv); }
+					input_data.onclick = function(){ return clearNode(newdiv<?php echo $cnt; ?>); }
 				);
 
@@ -508,10 +515,10 @@
 			newtable.appendChild(newtd_c7);
 
-			newdiv.appendChild(newtable);
+			newdiv<?php echo $cnt; ?>.appendChild(newtable);
 			if(nextrow != null){	
 				var doc = document.getElementById(nextrow);
-				$(doc).after(newdiv);
+				$(doc).after(newdiv<?php echo $cnt;?>);
 			}else{
-				targetView.appendChild(newdiv);
+				targetView.appendChild(newdiv<?php echo $cnt;?>);
 				//$(targetView).after(newtr<?php echo $cnt; ?>);
 			}
