Index: schedule/function/SplitDelete.php
===================================================================
--- schedule/function/SplitDelete.php	(revision 16953)
+++ schedule/function/SplitDelete.php	(revision 16982)
@@ -1,4 +1,6 @@
-<?php include '../include/factdb.php'; ?>
+
+<script src="js/jquery-1.7.1.js"></script>
 <script language="javascript">
+
 var timeval = 0;
 var name = "";
@@ -14,5 +16,8 @@
 		}	
 	}
+	
+	
 	function addRow(table){
+	    $(this).prepend("tableID");
 		var targetView = table;
 		// CREATE ELEMENT	
@@ -25,11 +30,7 @@
 				input_data = document.createElement("input"),
 				input_data.setAttribute("type","time"),
+				input_data.setAttribute("size","10"),
 				input_data.setAttribute("autofocus","true"),
-				input_data.setAttribute("id","Time"),
-				input_data.setAttribute("max","24"),
-				input_data.setAttribute("min","1"),
-				input_data.setAttribute("required",true),
-				input_data.setAttribute("hidden",true),
-				input_data.setAttribute("value",timeval)
+				input_data.setAttribute("hidden",true)
 			);
 		var newtd_c2 = document.createElement("td");
@@ -45,20 +46,17 @@
 			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')
-			);
+				selection.setAttribute('id','source')
+			);
+			
+			//var newtd_c2 = document.createElement("td");
+			newtd_c2.setAttribute("width","115");
+			newtd_c2.setAttribute("align","center");
 			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); }
-		);
+				input_data = document.createElement("input"),
+				input_data.setAttribute("type","button"),
+				input_data.setAttribute("value","[ + ]"),
+				input_data.onclick = function(){ return addRow(table); }
+			);
+		
 		var newtd_c3 = document.createElement("td");
 			newtd_c3.setAttribute("width","88");
@@ -78,23 +76,21 @@
 			);
 		var newtd_c4 = document.createElement("td");
-		newtd_c4.setAttribute("width","180");
-		newtd_c4.setAttribute("align","center");
-		newtd_c4.appendChild(
-			input_data = document.createElement("input"),
-			input_data.setAttribute("type","text"),
-			input_data.setAttribute("size","20"),
-			input_data.setAttribute("placeholder","Value")
-		);
-	var newtd_c5 = document.createElement("td");
-		newtd_c5.setAttribute("width","95");
-		newtd_c5.setAttribute("align","center");
-		newtd_c5.appendChild(
-			input_data = document.createElement("input"),
-			input_data.setAttribute("type","button"),
-			input_data.setAttribute("class","button"),
-			input_data.setAttribute("value","Delete"),
-			input_data.onclick = function(){ return clearNode(newtr); }
-		);
-	
+			newtd_c4.setAttribute("width","180");
+			newtd_c4.setAttribute("align","center");
+			newtd_c4.appendChild(
+				input_data = document.createElement("input"),
+				input_data.setAttribute("type","text"),
+				input_data.setAttribute("size","12"),
+				input_data.setAttribute("placeholder","Value")
+			);
+		var newtd_c5 = document.createElement("td");
+			newtd_c5.setAttribute("width","95");
+			newtd_c5.setAttribute("align","center");
+			newtd_c5.appendChild(
+				input_data = document.createElement("input"),
+				input_data.setAttribute("type","button"),
+				input_data.setAttribute("value","[ Delete ]"),
+				input_data.onclick = function(){ return clearNode(newtr); }
+			);
 		
 		newtr.appendChild(newtd_c1);
@@ -103,8 +99,10 @@
 		newtr.appendChild(newtd_c4);
 		newtr.appendChild(newtd_c5);
-	
-		
-		$(targetView).append(newtr);
-	}
+	//newtr.appendChild(newtd_c6);
+		
+		targetView.appendChild(newtr);
+	
+	}
+	
 	function deleteRow(tableID){
 		try{
@@ -130,14 +128,19 @@
 
 
-function addRowClone(){
+function addRowClone(nextrow){
 	var targetView = document.getElementById("Data");
 	// CREATE ELEMENT
+	// COUNT LIST
+	var list     = $(".datalisting").length;
+	var newlist = list+1;
 	
 	var newdiv   = document.createElement("div");
-		newdiv.setAttribute("style","margin:30px 0;");
+		newdiv.setAttribute("id","list_"+newlist);
+		newdiv.setAttribute("class","datalisting");
+		newdiv.setAttribute("style","margin:5px 0;");
 	var newtable = document.createElement("table");
 		newtable.setAttribute("class","dataTable");
 		newtable.setAttribute("width","100%");
-		newtable.setAttribute("border","1");
+		newtable.setAttribute("border","3");
 		newtable.setAttribute("cellspacing","0");
 		newtable.setAttribute("cellpadding","0");
@@ -149,12 +152,16 @@
 		newtd_c1.setAttribute("align","center");
 		newtd_c1.appendChild(
-				input_data = document.createElement("input"),
-				input_data.setAttribute("type","time"),
-				input_data.setAttribute("autofocus","true"),
-				input_data.setAttribute("id","Time"),
-				input_data.setAttribute("max","24"),
-				input_data.setAttribute("min","1"),
-				input_data.setAttribute("required",true)
-				
+			input_data = document.createElement("input"),
+			input_data.setAttribute("type","time"),
+			input_data.setAttribute("size","10"),
+			input_data.setAttribute("autofocus","true")
+		);
+		newtd_c1.appendChild(
+			input_data = document.createElement("input"),
+			input_data.setAttribute("type","button"),
+			input_data.setAttribute("value","[ + ]"),
+			input_data.onclick = function(){
+				addRowClone("list_"+newlist);
+			}
 		);
 	var newtd_c2 = document.createElement("td");
@@ -162,6 +169,6 @@
 		newtd_c2.setAttribute("align","center");
 		newtd_c2.appendChild(
-				selection = document.createElement("select"),
-				<?php   
+			selection = document.createElement("select"),
+			<?php   
 				$selectm = mysql_query("SELECT * FROM measurement");
 				while($rowmeasure = mysql_fetch_array($selectm)){
@@ -174,22 +181,20 @@
 			selection.setAttribute('id','source')
 			);
-			newtd_c2.appendChild(
+			
+//		var newtd_c6 = document.createElement("td");
+		newtd_c2.setAttribute("width","115");
+		newtd_c2.setAttribute("align","center");
+		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");
-		newtd_c3.setAttribute("align","center");
-		newtd_c3.appendChild(
-			selection = document.createElement("select"),
-			<?php
+			input_data.setAttribute("value","[ + ]"),
+			input_data.onclick = function(){ return addRow(newtable); }
+		);
+		var newtd_c3 = document.createElement("td");
+			newtd_c3.setAttribute("width","98");
+			newtd_c3.setAttribute("align","center");
+			newtd_c3.appendChild(
+				selection = document.createElement("select"),
+		<?php
 				
 					$select = mysql_query("SELECT * FROM source");
@@ -203,25 +208,23 @@
 			selection.setAttribute('id','measurement')
 		);
-	var newtd_c4 = document.createElement("td");
-		newtd_c4.setAttribute("width","180");
-		newtd_c4.setAttribute("align","center");
-		newtd_c4.appendChild(
-			input_data = document.createElement("input"),
-			input_data.setAttribute("type","text"),
-			input_data.setAttribute("size","20"),
-			input_data.setAttribute("placeholder","Value")
-		);
-	var newtd_c5 = document.createElement("td");
-		newtd_c5.setAttribute("width","95");
-		newtd_c5.setAttribute("align","center");
-		newtd_c5.appendChild(
-			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); }
-		);
-		
-	
+		var newtd_c4 = document.createElement("td");
+			newtd_c4.setAttribute("width","180");
+			newtd_c4.setAttribute("align","center");
+			newtd_c4.appendChild(
+				input_data = document.createElement("input"),
+				input_data.setAttribute("type","text"),
+				input_data.setAttribute("size","25"),
+				input_data.setAttribute("placeholder","Value")
+			);
+		var newtd_c5 = document.createElement("td");
+			newtd_c5.setAttribute("width","95");
+			newtd_c5.setAttribute("align","center");
+			newtd_c5.appendChild(
+				input_data = document.createElement("input"),
+				input_data.setAttribute("type","button"),
+				input_data.setAttribute("value","[ Delete Main ]"),
+				input_data.onclick = function(){ return clearNode(newdiv); }
+			);
+
 	newtr.appendChild(newtd_c1);
 	newtr.appendChild(newtd_c2);
@@ -229,270 +232,28 @@
 	newtr.appendChild(newtd_c4);
 	newtr.appendChild(newtd_c5);
-	
+	//newtr.appendChild(newtd_c6);
 	
 	newtable.appendChild(newtr);
 	newdiv.appendChild(newtable);
 	
-	targetView.appendChild(newdiv);
+	if(nextrow != null){	
+		var doc = document.getElementById(nextrow);
+		$(doc).after(newdiv);
+	}else{
+		targetView.appendChild(newdiv);
+	}
 }
-
-
-
-
-<?php    
-
-			if(isset($_GET['days']))
-			{ 
-				 $day = $_GET['days'];
-			 }
-			 else
-			 {
-				 $day =date("Y-m-d");		 
-			 }						 
-				$days = Date('Y-m-d',strtotime($day));	
-				$fetch = mysql_query("SELECT * FROM schedule ORDER BY fScheduleID ASC") or die(mysql_error());
-				while($rows = mysql_fetch_array($fetch))
-				{
-					$timestamp=strtotime($rows['fStart']);
-					$timestamp2 = date('Y-m-d',$timestamp);
-					$date_time = date('H:i',$timestamp);
-					
-					if($days == $timestamp2)
-					{
-					?>
-					cnt++;
-				
-					$('#save').attr('value','UPDATE');
-					
-	var targetView = document.getElementById("Data");
-	// CREATE ELEMENT
-	var newdiv   = document.createElement("div");
-		newdiv.setAttribute("style","margin:5px 0;");
-	var newtable = document.createElement("table");
-		newtable.setAttribute("class","dataTable");
-		newtable.setAttribute("id","dataTable"+cnt);
-		newtable.setAttribute("width","100%");
-		newtable.setAttribute("border","1");
-		newtable.setAttribute("cellspacing","0");
-		newtable.setAttribute("cellpadding","0");
-		
-	var newtr = document.createElement("tr");
-	
-	var newtd_c1 = document.createElement("td");
-		newtd_c1.setAttribute("width","115");
-		newtd_c1.setAttribute("align","center");
-		newtd_c1.appendChild(
-				input_data = document.createElement("input"),
-				input_data.setAttribute("type","time"),
-				input_data.setAttribute("autofocus","true"),
-				input_data.setAttribute("id","Time"),
-				input_data.setAttribute("max","24"),
-				input_data.setAttribute("min","1"),
-				input_data.setAttribute("required",true),
-				input_data.setAttribute("value",'<?php echo $date_time; ?>')
-		);
-	var newtd_c2 = document.createElement("td");
-		newtd_c2.setAttribute("width","40");
-		newtd_c2.setAttribute("align","center");
-		newtd_c2.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','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");
-					
-				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 if($rows['fSourceKey'] == $rowsource['fSourceKEY']){ echo"option.setAttribute('selected',true),"; } ?>
-												
-				<?php } ?>
-			selection.setAttribute('id','measurement')
-		);
-	var newtd_c4 = document.createElement("td");
-		newtd_c4.setAttribute("width","180");
-		newtd_c4.setAttribute("align","center");
-		newtd_c4.appendChild(
-			input_data = document.createElement("input"),
-			input_data.setAttribute("type","text"),
-			input_data.setAttribute("size","20"),
-			input_data.setAttribute("placeholder","Value"),
-			input_data.setAttribute('value','<?php  echo $rows['fData']; ?>')
-		);
-	var newtd_c5 = document.createElement("td");
-		newtd_c5.setAttribute("width","95");
-		newtd_c5.setAttribute("align","center");
-		newtd_c5.appendChild(
-			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); }
-		);
-		
-	
-	newtr.appendChild(newtd_c1);
-	newtr.appendChild(newtd_c2);
-	newtr.appendChild(newtd_c3);
-	newtr.appendChild(newtd_c4);
-	newtr.appendChild(newtd_c5);
-
-	
-	newtable.appendChild(newtr);
-	newdiv.appendChild(newtable);
-	
-	targetView.appendChild(newdiv);
-					
-				
-					
-					<?php  } } ?>
-
-
-
-
-
-
-
 window.onload = function(){
-
-	
-
-
-if(cnt==0){
-
-	var targetView = document.getElementById("Data");
-	// CREATE ELEMENT
-	var newdiv   = document.createElement("div");
-		newdiv.setAttribute("style","margin:5px 0;");
-	var newtable = document.createElement("table");
-		newtable.setAttribute("class","dataTable");
-		newtable.setAttribute("width","100%");
-		newtable.setAttribute("border","1");
-		newtable.setAttribute("cellspacing","0");
-		newtable.setAttribute("cellpadding","0");
-		
-	var newtr = document.createElement("tr");
-	
-	var newtd_c1 = document.createElement("td");
-		newtd_c1.setAttribute("width","115");
-		newtd_c1.setAttribute("align","center");
-		newtd_c1.appendChild(
-				input_data = document.createElement("input"),
-				input_data.setAttribute("type","time"),
-				input_data.setAttribute("autofocus","true"),
-				input_data.setAttribute("id","Time"),
-				input_data.setAttribute("max","24"),
-				input_data.setAttribute("min","1"),
-				input_data.setAttribute("required",true)
-		);
-	var newtd_c2 = document.createElement("td");
-		newtd_c2.setAttribute("width","40");
-		newtd_c2.setAttribute("align","center");
-		newtd_c2.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  } ?>
-				
-		
-			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");
-		newtd_c3.setAttribute("align","center");
-		newtd_c3.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 } ?>
-		
-			selection.setAttribute('id','measurement')
-		);
-	var newtd_c4 = document.createElement("td");
-		newtd_c4.setAttribute("width","180");
-		newtd_c4.setAttribute("align","center");
-		newtd_c4.appendChild(
-			input_data = document.createElement("input"),
-			input_data.setAttribute("type","text"),
-			input_data.setAttribute("size","20"),
-			input_data.setAttribute("placeholder","Value")
-		);
-	var newtd_c5 = document.createElement("td");
-		newtd_c5.setAttribute("width","95");
-		newtd_c5.setAttribute("align","center");
-		newtd_c5.appendChild(
-			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); }
-		);
-		
-	
-	newtr.appendChild(newtd_c1);
-	newtr.appendChild(newtd_c2);
-	newtr.appendChild(newtd_c3);
-	newtr.appendChild(newtd_c4);
-	newtr.appendChild(newtd_c5);
-
-	newtable.appendChild(newtr);
-	newdiv.appendChild(newtable);
-	
-	targetView.appendChild(newdiv);
+	addRowClone();
 }
-	}
-
-
 
 </script>
+
+
+</head>
+<body>
+	
+	<div id="Data">
+	</div>
+</body>
+</html>
