Index: schedule/function/SplitDelete.php
===================================================================
--- schedule/function/SplitDelete.php	(revision 16919)
+++ 	(revision )
@@ -1,1006 +1,0 @@
-<script type="text/javascript">
- $(document).ready(function(){
- var name;
-var value;
- var timeValue;
-var meas;
-var meas2;
-var x=0;
-var measurement=0;
-var getTableId;
-var is=0;
- window.cnt=0;
-	var x = 0;
-	<?php    
-	include '../include/factdb.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 div= document.createElement("div");
-						div.setAttribute('id','TableHolder');
-					var table = document.createElement("table");
-						table.setAttribute('id',"table"+cnt);
-						table.setAttribute('width','100%');
-					var tr = document.createElement('tr');
-					var td3=document.createElement('td');
-						td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
-						td3.appendChild(
-							input = document.createElement("input"),
-									input.setAttribute("type","time"),
-									input.setAttribute("id","Time"),
-									input.setAttribute("max","24"),
-									input.setAttribute("min","1"),
-									input.setAttribute("required",true),
-									input.setAttribute("value",'<?php echo $date_time; ?>')
-								
-						);
-							td3.appendChild(
-							button=document.createElement('input'),
-							button.setAttribute('type','button'),
-							button.setAttribute('value','[+]'),
-							button.setAttribute('id','btnAddTime'),
-							button.setAttribute('name','#table'+cnt),
-							button.onclick=function(){
-							
-							
-							
-							if($('#Time').val() != ""){  var splitting = $('#Time').val().split(':'); var add = 01;   
-
-							timeValue = pad((Number(splitting[0]) + Number(add)),2)+':'+splitting[1]; 
-						
-										function pad(number, length) {
-								   
-											var str = '' + number;
-											while (str.length < length) {
-												str = '0' + str;
-											}
-								   
-										return str;
-
-										}
-										var s = 0; var	get;
-										var nn;
-										nn = $(this).attr('name');
-								$("table").each(function() {
-								if($(this).attr("name")==nn){
-									
-									get = "#"+$(this).attr("id"); 
-									//get = $(this).attr("name");
-										s =1;
-								}else{
-								if(s==0){
-								get = '#table'+cnt;
-								}
-								}
-								});
-
-					
-									
-								getTableId =get;
-
-
-							name="name"; value=""; meas = "name"; meas2 = "time";   //getTableId = $(this).attr('name'); 
-							split1();    }else{   alert("please enter value for time to add measurement");   }
-
-								
-							}
-						);
-					var td=document.createElement('td');
-						td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
-						td.appendChild(
-							sourcecbo= document.createElement('select'),
-								sourcecbo.setAttribute('id','source'),
-				<?php
-							$source=mysql_query("SELECT*FROM source");
-							while($rowsource=mysql_fetch_array($source))
-							{
-				?>
-								sourcecbo.appendChild(
-									option=document.createElement('option'),
-											
-												option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
-												<?php if($rows['fSourceKey'] == $rowsource['fSourceKEY']){ echo"option.setAttribute('selected',true),"; } ?>
-												
-											
-												option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
-											
-								
-								),
-				<?php
-							}
-				?>
-							sourcecbo.setAttribute('id','source')
-									
-						);
-					var td1=document.createElement('td');
-						td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
-						td1.appendChild(
-							measurementcbo= document.createElement('select'),
-								measurementcbo.setAttribute('id','measurement'),
-				<?php
-							$measure=mysql_query("SELECT*FROM measurement");
-							while($rowmeasure=mysql_fetch_array($measure))
-							{
-				?>
-								measurementcbo.appendChild(
-									option=document.createElement('option'),
-											option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
-											
-											<?php  if($rows['fMeasurementTypeKey']==$rowmeasure['fMeasurementKey']){ echo "option.setAttribute('selected',true),";}   ?>
-											
-											option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
-								),
-				<?php
-							}
-				?>
-							measurementcbo.setAttribute('id','measurement')
-						);
-								td1.appendChild(
-							button=document.createElement('input'),
-							button.setAttribute('type','button'),
-							button.setAttribute('value','[+]'),
-							button.setAttribute('id','btnAddTime'),
-							button.setAttribute('name','#table'+cnt),
-							button.onclick=function(){
-							if($('#Time').val() != ""){ timeValue = $('#Time').val(); name="name"; value=$(this).attr('name'); meas = "hidden"; meas2 = true; is=1; getTableId = $(this).attr('name'); split1();    }else{   alert("please enter value for time to add measurement");   }
-
-								
-							}
-						);
-					var td2=document.createElement('td');
-						td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
-						td2.appendChild(
-							input = document.createElement('input'),
-							input.setAttribute('type','text'),
-							input.setAttribute('id','txtData'),
-							input.setAttribute('value','<?php  echo $rows['fData']; ?>')
-							
-							
-						);
-					var td4=document.createElement('td');
-						td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
-						td4.appendChild(
-							button=document.createElement('input'),
-							button.setAttribute('type','button'),
-							button.setAttribute('value','Delete'),
-							button.setAttribute('id','btnDelete'),
-							button.onclick=function(){
-								$('#table'+cnt).remove();
-							}
-						);
-						
-						tr.appendChild(td3);
-						tr.appendChild(td1);
-						tr.appendChild(td);
-						
-						tr.appendChild(td2);
-						tr.appendChild(td4);
-						table.appendChild(tr);
-						div.appendChild(table);
-						$('#TableH1').append(div);
-					
-	<?php
-	}
-			}
-					?>
-					
-		if(cnt==0)
-		{
-		$('#save').attr('value','SAVE');
-	var div= document.createElement("div");
-		div.setAttribute('id','TableHolder');
-		var table = document.createElement("table");
-		table.setAttribute('id',"table2");
-		table.setAttribute('width','100%');
-		table.setAttribute('name','#table2');
-	var tr = document.createElement('tr');
-		tr.setAttribute('id','');
-		tr.setAttribute('class','');
-	var td3=document.createElement('td');
-		td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
-		td3.appendChild(
-			input = document.createElement("input"),
-					input.setAttribute("type","time"),
-					input.setAttribute("id","Time"),
-					input.setAttribute("max","24"),
-					input.setAttribute("min","1"),
-					input.setAttribute("required",true),
-					input.onkeyup = function(){ 
-					
-					
-					
-			
-								if($('div#TableHolder #table2 #Time').val() <= 0  || $('div#TableHolder #table1 #Time').val() <=0){
-								
-								
-								}else{
-									if($('div#TableHolder #table1 #Time').val() <= $('div#TableHolder #table2 #Time').val()){
-									alert('2nd row must be greater than 1st');
-									}
-								}
-							
-						  
-					
-					
-						
-					
-									}
-					
-					
-		);
-			td3.appendChild(
-			button=document.createElement('input'),
-			button.setAttribute('type','button'),
-			button.setAttribute('value','[+]'),
-			button.setAttribute('id','btnAddTime'),
-			button.setAttribute('name','#table2'),
-			button.onclick=function(){
-					var aa;
-			$('div#TableHolder #table2 #Time').each(function(){
-					aa = $(this).val();
-					});
-					
-			if(aa != ""){ var splitting =aa.split(':'); var add = 01;   
-
-			timeValue = pad((Number(splitting[0]) + Number(add)),2)+':'+splitting[1]; 
-
-						function pad(number, length) {
-				   
-							var str = '' + number;
-							while (str.length < length) {
-								str = '0' + str;
-							}
-				   
-						return str;
-
-						}; 
-						
-						var s = 0; var	get;
-						
-				$("table").each(function() { if($(this).attr("name")=='#table2'){ get = "#"+$(this).attr("id"); s =1; }else{ if(s==0){ get = '#table'+cnt; }
-				}
-				});
-getTableId =get;
-name="name"; value = '#table2';
-measurement = 0;
-						  meas = "class"; meas2 = "time";  //getTableId = $(this).attr('name'); 
-						split2();    }else{   alert("please enter value for time to add measurement");   }
-
-				
-			}
-		);
-	var td=document.createElement('td');
-		td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
-		td.appendChild(
-			sourcecbo= document.createElement('select'),
-				sourcecbo.setAttribute('id','source'),
-<?php
-				$source=mysql_query("SELECT*FROM source");
-				while($rowsource=mysql_fetch_array($source))
-				{
-?>				
-				sourcecbo.appendChild(
-					option=document.createElement('option'),
-							option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
-							option.setAttribute('selected',true),
-							option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
-				
-				),
-<?php
-				}
- ?>
-			sourcecbo.setAttribute('id','source')
-					
-		);
-	var td1=document.createElement('td');
-		td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
-		td1.appendChild(
-			measurementcbo= document.createElement('select'),
-				measurementcbo.setAttribute('id','measurement'),
-<?php
-			$measure=mysql_query("SELECT*FROM measurement");
-			while($rowmeasure=mysql_fetch_array($measure))
-			{
-?>
-				measurementcbo.appendChild(
-					option=document.createElement('option'),
-							option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
-							option.setAttribute('selected',true),
-							option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
-				),
-<?php
-			}
-?>
-			measurementcbo.setAttribute('id','measurement')
-		);
-				td1.appendChild(
-			button=document.createElement('input'),
-			button.setAttribute('type','button'),
-			button.setAttribute('value','[+]'),
-			button.setAttribute('id','btnAddTime'),
-			button.setAttribute('name','#table2'),
-			button.onclick=function(){
-			var aa;
-			$('div#TableHolder #table2 #Time').each(function(){
-					aa = $(this).val();
-					});
-			if(aa != ""){ timeValue =aa; name="name"; value=$(this).attr('name'); measurement = 1; meas = "hidden"; meas2 = true;  getTableId = $(this).attr('name');  split2();    }else{   alert("please enter value for time to add measurement");   }
-
-				
-			}
-		);
-	var td2=document.createElement('td');
-		td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
-		td2.appendChild(
-			input = document.createElement('input'),
-			input.setAttribute('type','text'),
-			input.setAttribute('id','txtData')
-			
-		);
-	var td4=document.createElement('td');
-		td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
-		
-		td4.appendChild(
-			button=document.createElement('input'),
-			button.setAttribute('type','button'),
-			button.setAttribute('value','Delete'),
-			button.setAttribute('id','btnDelete'),
-			button.onclick=function(){
-				$('#table2').remove();
-
-			}
-		);
-	
-		tr.appendChild(td3);
-		tr.appendChild(td1);
-		tr.appendChild(td);
-		
-		tr.appendChild(td2);
-		tr.appendChild(td4);
-		table.appendChild(tr);
-		div.appendChild(table);
-		$('#TableH1').append(div);
-
-	var div= document.createElement("div");
-		div.setAttribute('id','TableHolder');	
-	var table = document.createElement("table");
-		table.setAttribute('id',"table1");
-		table.setAttribute('width','100%');
-	var tr = document.createElement('tr');
-		tr.setAttribute('id','');
-		tr.setAttribute('class','');
-	var td3=document.createElement('td');
-		td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
-		td3.appendChild(
-			input = document.createElement("input"),
-					input.setAttribute("type","time"),
-					input.setAttribute("id","Time"),
-					input.setAttribute("max","24"),
-					input.setAttribute("min","1"),
-					input.setAttribute("required",true),
-					input.onkeyup = function(){ 
-					
-					
-					
-							
-			
-								if($('div#TableHolder #table2 #Time').val() <= 0  || $('div#TableHolder #table1 #Time').val() <=0){
-								
-								
-								}else{
-									if($('div#TableHolder #table1 #Time').val() <= $('div#TableHolder #table2 #Time').val()){
-									alert(' row must be greater than previous');
-									return false;
-									}
-								}
-							
-						  
-					
-					
-						
-					
-									}
-		);
-			td3.appendChild(
-			button=document.createElement('input'),
-			button.setAttribute('type','button'),
-			button.setAttribute('value','[+]'),
-			button.setAttribute('id','btnAddTime'),
-			button.setAttribute('name','#table1'),
-			button.onclick=function(){
-			var aa;
-			$('div#TableHolder #table1 #Time').each(function(){
-					aa = $(this).val();
-					});
-			if(aa !='') { var splitting =aa.split(':'); var add = 01;   
-
-			timeValue = pad((Number(splitting[0]) + Number(add)),2)+':'+splitting[1]; 
-
-						function pad(number, length) {
-				   
-							var str = '' + number;
-							while (str.length < length) {
-								str = '0' + str;
-							}
-				   
-						return str;
-
-						}; 
-						
-						
-						var s = 0; var	get;
-						
-$("table").each(function() {
-				if($(this).attr("name")=='#table1'){
-				get = "#"+$(this).attr("id"); 
-				
-						s =1;
-				}else{
-				if(s==0){
-				get = '#table1';
-				}
-				}
-    });
-getTableId =get;
-name="name"; value = '#table1';
-						measurement = 0;
-  meas = "class"; meas2 = "time";  //getTableId = $(this).attr('name'); 
-split2();    }else{   alert("please enter value for time to add measurement");   }
-
-				
-			}
-		);
-	var td=document.createElement('td');
-		td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
-		td.appendChild(
-			sourcecbo= document.createElement('select'),
-				sourcecbo.setAttribute('id','source'),
-<?php
-				$source=mysql_query("SELECT*FROM source");
-				while($rowsource=mysql_fetch_array($source))
-				{
-?>				
-				sourcecbo.appendChild(
-					option=document.createElement('option'),
-							option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
-							option.setAttribute('selected',true),
-							option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
-				
-				),
-<?php
-				}
- ?>
-			sourcecbo.setAttribute('id','source')
-					
-		);
-	var td1=document.createElement('td');
-		td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
-		td1.appendChild(
-			measurementcbo= document.createElement('select'),
-				measurementcbo.setAttribute('id','measurement'),
-<?php
-			$measure=mysql_query("SELECT*FROM measurement");
-			while($rowmeasure=mysql_fetch_array($measure))
-			{
-?>
-				measurementcbo.appendChild(
-					option=document.createElement('option'),
-							option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
-							option.setAttribute('selected',true),
-							option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
-				),
-<?php
-			}
-?>
-			measurementcbo.setAttribute('id','measurement')
-		);
-				td1.appendChild(
-			button=document.createElement('input'),
-			button.setAttribute('type','button'),
-			button.setAttribute('value','[+]'),
-			button.setAttribute('id','btnAddTime'),
-			button.setAttribute('name','#table1'),
-			button.onclick=function(){
-			var aa;
-			$('div#TableHolder #table1 #Time').each(function(){
-					aa = $(this).val();
-					});
-			
-			if(aa != ""){ timeValue = aa; name="name"; value="#table1"; measurement=1; meas = "hidden"; meas2 = true;  getTableId = $(this).attr('name'); split2();    }else{   alert("please enter value for time to add measurement");   }
-
-				
-			}
-		);
-	var td2=document.createElement('td');
-		td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
-		td2.appendChild(
-			input = document.createElement('input'),
-			input.setAttribute('type','text'),
-			input.setAttribute('id','txtData')
-			
-		);
-	var td4=document.createElement('td');
-		td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
-		
-		td4.appendChild(
-			button=document.createElement('input'),
-			button.setAttribute('type','button'),
-			button.setAttribute('value','Delete'),
-			button.setAttribute('id','btnDelete'),
-			button.onclick=function(){
-				$('#table1').remove();
-
-			}
-		);
-	
-		tr.appendChild(td3);
-		tr.appendChild(td1);
-		tr.appendChild(td);
-		
-		tr.appendChild(td2);
-		tr.appendChild(td4);
-		table.appendChild(tr);
-		div.appendChild(table);
-		$('#TableH1').append(div);
-		
-		
-	}
-	var meas;
-	var timeValue;
-	var pad;
-	if(cnt==0){ cnt=2; }	
-	function split2()
-	{
-
-		cnt++;
-		var div= document.createElement("div");
-		div.setAttribute('id','TableHolder');
-		var table = document.createElement("table");
-			table.setAttribute('id',"table"+cnt);
-			table.setAttribute('width','100%');
-			if(measurement==1){ table.setAttribute(name,value); }
-		var tr = document.createElement('tr');
-			tr.setAttribute('id','');
-			tr.setAttribute('class','');
-		
-		var td3=document.createElement('td');
-			td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
-			td3.setAttribute('class','first');
-
-			td3.appendChild(
-				input = document.createElement("input"),
-						input.setAttribute("type","time"),
-						input.setAttribute("id","Time"),
-						input.setAttribute("max","24"),
-						input.setAttribute("min",'1'),
-						input.setAttribute("required",true),
-						input.setAttribute(meas,meas2),
-						input.setAttribute("value",timeValue)
-					
-						
-			);
-				td3.appendChild(
-			button=document.createElement('input'),
-			button.setAttribute('type','button'),
-			button.setAttribute('value','[+]'),
-			button.setAttribute('id','btnAddTime'),
-			button.setAttribute(meas,meas2),
-			button.setAttribute('name','table'+cnt),
-			
-			button.onclick=function(){
-			var aa;
-			$('div#TableHolder #table'+cnt+' #Time').each(function(){
-					aa = $(this).val();
-					});
-					
-					if(value == 'undefined'){  bb =  $(this).closest('table').attr('name'); }else{
-					 bb = value; }
-			if(aa != ""){var splitting = aa.split(':'); var add = 01;   
-
-			
-			timeValue = pad((Number(splitting[0]) + Number(add)),2)+':'+splitting[1]; 
-
-						function pad(number, length) {
-				   
-							var str = '' + number;
-							while (str.length < length) {
-								str = '0' + str;
-							}
-				   
-						return str;
-
-						}  
-
-					var s = 0; var	get;
-						var nn;
-						nn = '#'+$(this).attr("name");
-				$("table").each(function() {
-				if($(this).attr("name")==nn){
-					
-					get = "#"+$(this).attr("id"); 
-					//get = $(this).attr("name");
-						s =1;
-				}else{
-				if(s==0){
-				get = '#table'+cnt;
-				}
-				}
-				});
-
-name="name"; value = bb;
-meas = "class"; meas2 = "time";  getTableId = get; measurement =0;   split1();    }else{   alert("please enter value for time to add measurement");   }
-
-				
-			}
-		);
-			
-		var td=document.createElement('td');
-			td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
-			td.appendChild(
-				sourcecbo= document.createElement('select'),
-					sourcecbo.setAttribute('id','source'),
-<?php
-				$source=mysql_query("SELECT*FROM source");
-				while($rowsource=mysql_fetch_array($source))
-				{
-?>				
-				sourcecbo.appendChild(
-					option=document.createElement('option'),
-							option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
-							option.setAttribute('selected',true),
-							option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
-				
-				),
-<?php
-				}
- ?>
-				sourcecbo.setAttribute('id','source')
-						
-			);
-var td1=document.createElement('td');
-td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
-td1.appendChild(
-measurementcbo= document.createElement('select'),
-measurementcbo.setAttribute('id','measurement'),
-<?php
-			$measure=mysql_query("SELECT*FROM measurement");
-			while($rowmeasure=mysql_fetch_array($measure))
-			{
-?>
-measurementcbo.appendChild(
-option=document.createElement('option'),
-option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
-option.setAttribute('selected',true),
-option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
-				),
-<?php
-			}
-?>
-			measurementcbo.setAttribute('id','measurement')
-			);
-					td1.appendChild(
-			button=document.createElement('input'),
-			button.setAttribute('type','button'),
-			button.setAttribute('value','[+]'),
-			button.setAttribute('id','btnAddTime'),
-			button.setAttribute('name','#table'+cnt),
-			button.onclick=function(){
-		var aa,cc=0;
-		var bb,dd;
-			$('div#TableHolder #table'+cnt+' #Time').each(function(){
-					aa = $(this).val();
-					
-					
-					
-					});
-					 dd= $(this).attr('name');
-					//alert(dd);
-					if($('div#TableHolder '+dd+' #Time').is(':visible')){
-					cc=0;
-					//alert(cc);
-					}else{
-					cc=1;
-					}
-					//alert(value);
-					 x = 1;
-					if(meas2 == 'time' && measurement == 0 && cc != 1){  bb =  '#'+$(this).closest('table').attr('id'); }else{
-					 bb = value; } 
-			if(aa != "")
-			{ 
-				name = "name";
-				value = bb;
-			//	alert('2'+bb);
-				timeValue = aa;
-				meas = "hidden"; 
-				meas2 = true;
-				getTableId = $(this).attr('name'); 
-				//alert(getTableId);
-				measurement = 1;
-				split1();    
-			}
-			else
-			{ 
-				alert("please enter value for time to add measurement");   
-			}
-
-				
-			}
-		);
-				
-		var td2=document.createElement('td');
-			td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
-			td2.appendChild(
-				input = document.createElement('input'),
-				input.setAttribute('type','text'),
-				input.setAttribute('id','txtData')
-				
-			);
-		var td4=document.createElement('td');
-			td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
-		
-			td4.appendChild(
-				button=document.createElement('input'),
-				button.setAttribute('type','button'),
-				button.setAttribute('value','Delete'),
-				button.setAttribute('id','btnDelete'),
-				button.onclick=function(){
-					$('#table'+cnt).remove();
-					cnt--;
-				}
-			);
-			
-			tr.appendChild(td3);
-			tr.appendChild(td1);
-			tr.appendChild(td);
-			
-			tr.appendChild(td2);
-			tr.appendChild(td4);
-			table.appendChild(tr);
-			div.appendChild(table);
-			$(div).insertAfter($(getTableId));
-	
-	
-	
-	}
-	function split1()
-	{
-
-		cnt++;
-		var div= document.createElement("div");
-		div.setAttribute('id','TableHolder');
-		var table = document.createElement("table");
-			table.setAttribute('id',"table"+cnt);
-			table.setAttribute('width','100%');
-				if(measurement==1){ table.setAttribute(name,value); }
-		var tr = document.createElement('tr');
-			tr.setAttribute('id','');
-			tr.setAttribute('class','');
-				
-		var td3=document.createElement('td');
-			td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
-			td3.setAttribute('class','first');
-			td3.appendChild(
-				input = document.createElement("input"),
-						input.setAttribute("type","time"),
-						input.setAttribute("id","Time"),
-						input.setAttribute("max","24"),
-						input.setAttribute("min",'1'),
-						input.setAttribute("required",true),
-						input.setAttribute(meas,meas2),
-						input.setAttribute("value",timeValue)
-						
-			);
-				td3.appendChild(
-			button=document.createElement('input'),
-			button.setAttribute('type','button'),
-			button.setAttribute('value','[+]'),
-			button.setAttribute('id','btnAddTime'),
-			button.setAttribute(meas,meas2),
-			button.setAttribute('name','table'+cnt),
-			
-			button.onclick=function(){
-			var aa;
-			$('div#TableHolder #table'+cnt+' #Time').each(function(){
-					aa = $(this).val();
-					});
-						if(value == 'undefined'){  bb =  $(this).closest('table').attr('name'); }else{
-					 bb = value; }
-			if(aa != ""){ var splitting = aa.split(':'); var add = 01;   
-
-			timeValue = pad((Number(splitting[0]) + Number(add)),2)+':'+splitting[1]; 
-
-						function pad(number, length) {
-				   
-							var str = '' + number;
-							while (str.length < length) {
-								str = '0' + str;
-							}
-				   
-						return str;
-
-						}
-						var s = 0; var	get;
-						var nn;
-						nn = bb;
-				$("table").each(function() {
-				if($(this).attr("name")==nn){
-					
-					get = "#"+$(this).attr("id"); 
-					//get = $(this).attr("name");
-						s =1;
-				}else{
-				if(s==0){
-				get = '#table'+cnt;
-				}
-				}
-				});
-
-				name="name"; value=bb;	measurement=0;	meas = "class"; meas2 = "time";   getTableId = get; split1();    }else{   alert("please enter value for time to add measurement");   }
-
-				
-			}
-		);
-			
-		var td=document.createElement('td');
-			td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
-			td.appendChild(
-				sourcecbo= document.createElement('select'),
-					sourcecbo.setAttribute('id','source'),
-<?php
-				$source=mysql_query("SELECT*FROM source");
-				while($rowsource=mysql_fetch_array($source))
-				{
-?>				
-				sourcecbo.appendChild(
-					option=document.createElement('option'),
-							option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
-							option.setAttribute('selected',true),
-							option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
-				
-				),
-<?php
-				}
- ?>
-				sourcecbo.setAttribute('id','source')
-						
-			);
-		var td1=document.createElement('td');
-			td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
-			
-			td1.appendChild(
-				measurementcbo= document.createElement('select'),
-					measurementcbo.setAttribute('id','measurement'),
-<?php
-			$measure=mysql_query("SELECT*FROM measurement");
-			while($rowmeasure=mysql_fetch_array($measure))
-			{
-?>
-				measurementcbo.appendChild(
-					option=document.createElement('option'),
-							option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
-							option.setAttribute('selected',true),
-							option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
-				),
-<?php
-			}
-?>
-			measurementcbo.setAttribute('id','measurement')
-			);
-				td1.appendChild(
-			button=document.createElement('input'),
-			button.setAttribute('type','button'),
-			button.setAttribute('value','[+]'),
-			button.setAttribute('id','btnAddTimes'),
-			button.setAttribute('name','#table'+cnt),
-			button.onclick=function(){
-		
-			var aa,cc=0;
-		var bb,dd;
-			$('div#TableHolder #table'+cnt+' #Time').each(function(){
-					aa = $(this).val();
-					
-					});
-					dd= $(this).attr('name');
-					if($('div#TableHolder '+dd+' #Time').is(':visible')){
-					cc=0;
-					//alert(cc);
-					}else{
-					cc=1;
-					}
-			 x=1;
-						if(meas2 == 'time' && measurement == 0 && cc!=1){  bb =  '#'+$(this).closest('table').attr('id'); }else{
-					 bb = value; }
-					
-			if(aa != "")
-			{ 
-				name = "name";
-				value = bb;
-				//alert(value);
-				timeValue = aa;
-				meas = "hidden"; 
-				meas2 = true;
-				getTableId = $(this).attr('name'); 
-				measurement =1;
-				split1();    
-			}
-			else
-			{ 
-				alert("please enter value for time to add measurement");   
-			}
-			}
-		);
-		
-		var td2=document.createElement('td');
-			td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
-			td2.appendChild(
-				input = document.createElement('input'),
-				input.setAttribute('type','text'),
-				input.setAttribute('id','txtData')
-				
-			);
-		var td4=document.createElement('td');
-			td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
-			
-			td4.appendChild(
-				button=document.createElement('input'),
-				button.setAttribute('type','button'),
-				button.setAttribute('value','Delete'),
-				button.setAttribute('id','btnDelete'),
-				button.onclick=function(){
-					$('#table'+cnt).remove();
-					cnt--;
-			});
-		
-			tr.appendChild(td3);
-			tr.appendChild(td1);
-			tr.appendChild(td);
-			
-			tr.appendChild(td2);
-			tr.appendChild(td4);
-			table.appendChild(tr);
-			div.appendChild(table);
-			$(div).insertAfter($(getTableId));
-	}
-	
-	//$('div#TableHolder #table'+cnt+' #Time')
-	
-	
-		// $('div#TableHolder table #Time').keyup(function(){
-			
-		// if($('div#TableHolder #table2 #Time').val() <= 0  || $('div#TableHolder #table1 #Time').val() <=0){
-		
-		
-		// }else{
-			// if($('div#TableHolder #table1 #Time').val() <= $('div#TableHolder #table2 #Time').val()){
-			// alert(cnt);
-			// }
-		// }
-		// });
-  
-	
-	
-	
-	
- });
- </script>
