Index: /schedule/function/SplitDelete.php
===================================================================
--- /schedule/function/SplitDelete.php	(revision 16952)
+++ /schedule/function/SplitDelete.php	(revision 16953)
@@ -1,5 +1,8 @@
 <?php include '../include/factdb.php'; ?>
 <script language="javascript">
-
+var timeval = 0;
+var name = "";
+var hid = "";
+var opt = "";
 window.cnt=0;
 	function clearNode(node){
@@ -26,5 +29,7 @@
 				input_data.setAttribute("max","24"),
 				input_data.setAttribute("min","1"),
-				input_data.setAttribute("required",true)
+				input_data.setAttribute("required",true),
+				input_data.setAttribute("hidden",true),
+				input_data.setAttribute("value",timeval)
 			);
 		var newtd_c2 = document.createElement("td");
@@ -33,17 +38,27 @@
 			newtd_c2.appendChild(
 				selection = document.createElement("select"),
-				
-				<?php
-				
-					$select = mysql_query("SELECT * FROM source");
-					
-				while($rowsource = mysql_fetch_array($select)){
-				
-				?>
-				selection.appendChild(option = document.createElement("option"),option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))),
-				<?php } ?>
+				<?php   
+				$selectm = mysql_query("SELECT * FROM measurement");
+				while($rowmeasure = mysql_fetch_array($selectm)){
+			
+			?>
+			selection.appendChild(option = document.createElement("option"),option.setAttribute("value","<?php echo $rowmeasure['fMeasurementKey']; ?>"),option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))),
+				<?php  } ?>
+				
+			
 				
 			selection.setAttribute('id','source')
 			);
+			newtd_c2.appendChild(
+			input_data = document.createElement("input"),
+			input_data.setAttribute("class","button"),
+			input_data.setAttribute("type","button"),
+			input_data.setAttribute("value","+"),
+			input_data.onclick = function(){ var val; $('div#Data .dataTable #Time').each(function(){
+					 val = $(this).val();
+						
+						}); 
+				timeval = val;	  return addRow(table); }
+		);
 		var newtd_c3 = document.createElement("td");
 			newtd_c3.setAttribute("width","88");
@@ -51,6 +66,13 @@
 			newtd_c3.appendChild(
 				selection = document.createElement("select"),
-				selection.appendChild(option = document.createElement("option"),option.setAttribute("select","Source 1"),option.appendChild(document.createTextNode("Source 1"))),
-			
+					<?php
+				
+					$select = mysql_query("SELECT * FROM source");
+					
+				while($rowsource = mysql_fetch_array($select)){
+				
+				?>
+				selection.appendChild(option = document.createElement("option"),option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))),
+				<?php } ?>
 			selection.setAttribute('id','measurement')
 			);
@@ -70,13 +92,9 @@
 			input_data = document.createElement("input"),
 			input_data.setAttribute("type","button"),
-			input_data.setAttribute("value","Delete Main"),
-			input_data.onclick = function(){ return clearNode(newdiv); }
-		);
-		newtd_c5.appendChild(
-			input_data = document.createElement("input"),
-			input_data.setAttribute("type","button"),
-			input_data.setAttribute("value","+"),
-			input_data.onclick = function(){ return addRow(newtable); }
-		);
+			input_data.setAttribute("class","button"),
+			input_data.setAttribute("value","Delete"),
+			input_data.onclick = function(){ return clearNode(newtr); }
+		);
+	
 		
 		newtr.appendChild(newtd_c1);
@@ -87,5 +105,5 @@
 	
 		
-		targetView.appendChild(newtr);
+		$(targetView).append(newtr);
 	}
 	function deleteRow(tableID){
@@ -115,4 +133,5 @@
 	var targetView = document.getElementById("Data");
 	// CREATE ELEMENT
+	
 	var newdiv   = document.createElement("div");
 		newdiv.setAttribute("style","margin:30px 0;");
@@ -137,4 +156,5 @@
 				input_data.setAttribute("min","1"),
 				input_data.setAttribute("required",true)
+				
 		);
 	var newtd_c2 = document.createElement("td");
@@ -143,17 +163,27 @@
 		newtd_c2.appendChild(
 				selection = document.createElement("select"),
-				
-				<?php
-				
-					$select = mysql_query("SELECT * FROM source");
-					
-				while($rowsource = mysql_fetch_array($select)){
-				
-				?>
-				selection.appendChild(option = document.createElement("option"),option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))),
-				<?php } ?>
+				<?php   
+				$selectm = mysql_query("SELECT * FROM measurement");
+				while($rowmeasure = mysql_fetch_array($selectm)){
+			
+			?>
+			selection.appendChild(option = document.createElement("option"),option.setAttribute("value","<?php echo $rowmeasure['fMeasurementKey']; ?>"),option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))),
+				<?php  } ?>
+				
 				
 			selection.setAttribute('id','source')
 			);
+			newtd_c2.appendChild(
+			input_data = document.createElement("input"),
+			input_data.setAttribute("class","button"),
+			input_data.setAttribute("type","button"),
+			input_data.setAttribute("value","+"),
+			input_data.onclick = function(){ var val; $('div#Data .dataTable #Time').each(function(){
+					 val = $(this).val();
+						
+						}); 
+timeval = val;				
+					return addRow(newtable);}
+		);
 	var newtd_c3 = document.createElement("td");
 		newtd_c3.setAttribute("width","88");
@@ -161,12 +191,14 @@
 		newtd_c3.appendChild(
 			selection = document.createElement("select"),
-			
-			<?php   
-				$selectm = mysql_query("SELECT * FROM measurement");
-				while($rowmeasure = mysql_fetch_array($selectm)){
-			
-			?>
-			selection.appendChild(option = document.createElement("option"),option.setAttribute("value","<?php echo $rowmeasure['fMeasurementKey']; ?>"),option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))),
-				<?php  } ?>
+			<?php
+				
+					$select = mysql_query("SELECT * FROM source");
+					
+				while($rowsource = mysql_fetch_array($select)){
+				
+				?>
+				selection.appendChild(option = document.createElement("option"),option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))),
+				<?php } ?>
+			
 			selection.setAttribute('id','measurement')
 		);
@@ -186,13 +218,9 @@
 			input_data = document.createElement("input"),
 			input_data.setAttribute("type","button"),
+			input_data.setAttribute("class","button"),
 			input_data.setAttribute("value","Delete Main"),
 			input_data.onclick = function(){ return clearNode(newdiv); }
 		);
-		newtd_c5.appendChild(
-			input_data = document.createElement("input"),
-			input_data.setAttribute("type","button"),
-			input_data.setAttribute("value","+"),
-			input_data.onclick = function(){ return addRow(newtable); }
-		);
+		
 	
 	newtr.appendChild(newtd_c1);
@@ -243,4 +271,5 @@
 	var newtable = document.createElement("table");
 		newtable.setAttribute("class","dataTable");
+		newtable.setAttribute("id","dataTable"+cnt);
 		newtable.setAttribute("width","100%");
 		newtable.setAttribute("border","1");
@@ -268,6 +297,35 @@
 		newtd_c2.appendChild(
 				selection = document.createElement("select"),
-				
-				<?php
+				<?php   
+				$selectm = mysql_query("SELECT * FROM measurement");
+				while($rowmeasure = mysql_fetch_array($selectm)){
+			
+			?>
+			selection.appendChild(option = document.createElement("option"),option.setAttribute("value","<?php echo $rowmeasure['fMeasurementKey']; ?>"),option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))),
+				<?php  if($rows['fMeasurementTypeKey']==$rowmeasure['fMeasurementKey']){ echo "option.setAttribute('selected',true),";}  } ?>
+				
+		
+			selection.setAttribute('id','source')
+			);
+			newtd_c2.appendChild(
+			input_data = document.createElement("input"),
+			input_data.setAttribute("class","button"),
+			input_data.setAttribute("type","button"),
+			input_data.setAttribute("value","+"),
+			input_data.setAttribute("name","dataTable"+cnt),
+			input_data.onclick = function(){ var val; $('div#Data .dataTable #Time').each(function(){
+					 val = $(this).val();
+						
+						}); 
+timeval = val;				//alert();
+					return addRow("#"+$(this).attr('name')); } 
+		);
+	var newtd_c3 = document.createElement("td");
+		newtd_c3.setAttribute("width","88");
+		newtd_c3.setAttribute("align","center");
+		newtd_c3.appendChild(
+			selection = document.createElement("select"),
+			
+			<?php
 				
 					$select = mysql_query("SELECT * FROM source");
@@ -280,20 +338,4 @@
 												
 				<?php } ?>
-		
-			selection.setAttribute('id','source')
-			);
-	var newtd_c3 = document.createElement("td");
-		newtd_c3.setAttribute("width","88");
-		newtd_c3.setAttribute("align","center");
-		newtd_c3.appendChild(
-			selection = document.createElement("select"),
-			
-			<?php   
-				$selectm = mysql_query("SELECT * FROM measurement");
-				while($rowmeasure = mysql_fetch_array($selectm)){
-			
-			?>
-			selection.appendChild(option = document.createElement("option"),option.setAttribute("value","<?php echo $rowmeasure['fMeasurementKey']; ?>"),option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))),
-				<?php  if($rows['fMeasurementTypeKey']==$rowmeasure['fMeasurementKey']){ echo "option.setAttribute('selected',true),";}  } ?>
 			selection.setAttribute('id','measurement')
 		);
@@ -314,13 +356,9 @@
 			input_data = document.createElement("input"),
 			input_data.setAttribute("type","button"),
+			input_data.setAttribute("class","button"),
 			input_data.setAttribute("value","Delete Main"),
 			input_data.onclick = function(){ return clearNode(newdiv); }
 		);
-		newtd_c5.appendChild(
-			input_data = document.createElement("input"),
-			input_data.setAttribute("type","button"),
-			input_data.setAttribute("value","+"),
-			input_data.onclick = function(){ return addRow(newtable); }
-		);
+		
 	
 	newtr.appendChild(newtd_c1);
@@ -383,17 +421,26 @@
 		newtd_c2.appendChild(
 				selection = document.createElement("select"),
-				
-				<?php
-				
-					$select = mysql_query("SELECT * FROM source");
-					
-				while($rowsource = mysql_fetch_array($select)){
-				
-				?>
-				selection.appendChild(option = document.createElement("option"),option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))),
-				<?php } ?>
+					<?php   
+				$selectm = mysql_query("SELECT * FROM measurement");
+				while($rowmeasure = mysql_fetch_array($selectm)){
+			
+			?>
+			selection.appendChild(option = document.createElement("option"),option.setAttribute("value","<?php echo $rowmeasure['fMeasurementKey']; ?>"),option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))),
+				<?php  } ?>
+				
 		
 			selection.setAttribute('id','source')
 			);
+			newtd_c2.appendChild(
+			input_data = document.createElement("input"),
+			input_data.setAttribute("class","button"),
+			input_data.setAttribute("type","button"),
+			input_data.setAttribute("value","+"),
+			input_data.onclick = function(){ var val; $('div#Data .dataTable #Time').each(function(){
+					 val = $(this).val();
+						
+						}); 
+timeval = val;					return addRow(newtable);} 
+		);
 	var newtd_c3 = document.createElement("td");
 		newtd_c3.setAttribute("width","88");
@@ -401,12 +448,14 @@
 		newtd_c3.appendChild(
 			selection = document.createElement("select"),
-			
-			<?php   
-				$selectm = mysql_query("SELECT * FROM measurement");
-				while($rowmeasure = mysql_fetch_array($selectm)){
-			
-			?>
-			selection.appendChild(option = document.createElement("option"),option.setAttribute("value","<?php echo $rowmeasure['fMeasurementKey']; ?>"),option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))),
-				<?php  } ?>
+			<?php
+				
+					$select = mysql_query("SELECT * FROM source");
+					
+				while($rowsource = mysql_fetch_array($select)){
+				
+				?>
+				selection.appendChild(option = document.createElement("option"),option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))),
+				<?php } ?>
+		
 			selection.setAttribute('id','measurement')
 		);
@@ -426,13 +475,9 @@
 			input_data = document.createElement("input"),
 			input_data.setAttribute("type","button"),
+			input_data.setAttribute("class","button"),
 			input_data.setAttribute("value","Delete Main"),
 			input_data.onclick = function(){ return clearNode(newdiv); }
 		);
-		newtd_c5.appendChild(
-			input_data = document.createElement("input"),
-			input_data.setAttribute("type","button"),
-			input_data.setAttribute("value","+"),
-			input_data.onclick = function(){ return addRow(newtable); }
-		);
+		
 	
 	newtr.appendChild(newtd_c1);
