Index: schedule/Module/control.php
===================================================================
--- schedule/Module/control.php	(revision 17505)
+++ schedule/Module/control.php	(revision 17506)
@@ -1,4 +1,4 @@
 <script language="javascript">
-
+'use strict';
 	var ctr;
 	
@@ -296,5 +296,4 @@
 
 	newdiv.appendChild(newtable);
-
 	if(nextrow != null){	
 		var doc = document.getElementById(nextrow);
@@ -307,5 +306,5 @@
 function addRowClone(nextrow){
 <?php
-$fetch = mysql_query("SELECT * FROM schedule WHERE date(fStart) = '$days' ORDER BY fScheduleID ASC, fMeasurementID ASC") or die(mysql_error());
+$fetch = mysql_query("SELECT * FROM schedule WHERE date(fStart) = '$days' ORDER BY fScheduleID AND fMeasurementID ASC") or die(mysql_error());
 $cnt3=0;
 $cnt2=0;
@@ -314,9 +313,6 @@
 //$data  = array();
 //$counter=0;
-$prevtimestamp = 0;
-
 	while($rows = mysql_fetch_array($fetch))
 	{
-		$scheduleId = $rows['fScheduleID'];
 		$timestamp=strtotime($rows['fStart']);
 		$timestamp2 = date('Y-m-d',$timestamp);
@@ -371,5 +367,5 @@
 					input_data.setAttribute("value","+"),
 					input_data.onclick = function(){
-						addRowClone1("list_<?php echo $cnt+1; ?>");
+						addRowClone1("list_<?php echo $cnt; ?>");
 					}
 				);
@@ -458,5 +454,4 @@
 					}
 				);
-			
 			newtr<?php echo $cnt; ?>.appendChild(newtd_c2);
 			newtr<?php echo $cnt; ?>.appendChild(newtd_c3);
@@ -464,4 +459,5 @@
 			newtr<?php echo $cnt; ?>.appendChild(newtd_c5);
 			newInnertable.appendChild(newtr<?php echo $cnt; ?>);
+			
 			
 			var newtd_c6 = document.createElement("td");
@@ -485,9 +481,8 @@
 
 			newdiv.appendChild(newtable);
-
 			if(nextrow != null){	
 				var doc = document.getElementById(nextrow);
 				$(doc).after(newdiv);
-			} else {
+			}else{
 				targetView.appendChild(newdiv);
 				//$(targetView).after(newtr<?php echo $cnt; ?>);
@@ -497,8 +492,5 @@
 			
 		$cnt++;
-		$prevtimestamp = $timestamp;
 	}
-
-
 if(mysql_num_rows($fetch)<1)
 {
