// JavaScript Document
 function saveWiT(pre,id)
 {
	if(id!="")
	{	
		$.ajax({ url: 'instructs.php',
				type: 'post',
				data:{act:'saveWiT',
					  tbTest:$("#tbTest").val(),
					  id:id,
					  client:pre
					 },
					  dataType:'json',
					  success: function(data)
					  {
						$("#show_points").html(data);			
					   }
			  });  	
	}else{
	alert("Report Numbers Is Empty,Error!" );
	}
 }
 
 function saveWiM(pre,id)
 {
	if(id!="")
	{	
		$.ajax({ url: 'instructs.php',
				 type: 'post',
				 data:{act:'saveWiM',
					   id:id,
					   client:pre,
					   tbTestedID:$("#tbTestedID :selected").val()
					  },
				 dataType:'json',
				 success: function(data)
					  {
						$("#show_points").html(data);			
					   }
			  });  	
	}else{
	alert("Report Numbers Is Empty,Error!" );
	}
 }
 
 function editpoint(pre,id,rep)
 {
		//enable("#tbTestedID","#tbQty","#tbTestResult","#tbSpec","","","");
	$.ajax({ url: 'report_create.php',
					  type: 'post',
					  data:{act:'getpoint',
							   id:id,
							   client:pre,
							   rep:rep
							  },
					  dataType:'json',
					  success: function(data)
					  {
							$("#tbTN").val(data['tbTN']);
							$("#tbTestedID").append("<option value='" + data['tbTestedID'] + "' selected='selected'>" + data['tbCheckPoint'] + "</option>"); 
							$("#tbQty").val(data['tbQty']);
							$("#tbTestResult").append("<option value='" + data['tbResult'] + "' selected='selected'>" + data['tbResult'] + "</option>"); 
							$("#tbSpec").val(data['tbSpec']);
					   }
			 	  });  	
 }
 
 function delpoint(pre,id,rep)
 {
	$.ajax({ url: 'report_create.php',
					  type: 'post',
					  data:{act:'del_point',
					  		   id:id,
							   client:pre,
							   rep:rep
							  },
					  dataType:'json',
					  success: function(data)
					  {
							$("#show_points").html(data);
					   }
			 });  	
 }
 
 function pushVal()
 { 
 	var arr=[];
	$('input[name="ck"]:checked').each(function(){
          arr.push($(this).val());									
									});
	$("#tbTest").val(arr);
	arr=[];
 }