<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<!--style sheets-->
<link href="../css/main.css" rel="stylesheet" type="text/css" />

<!--jscript-->
<script language="JavaScript" src="../jscript/numbers_only.js"  type="text/javascript"></script>  
<script language="JavaScript" src="../jscript/numbers_only_decimal.js"  type="text/javascript"></script>  
<script language="javascript" src="../jscript/no_spaces.js"></script>
<script language="javascript" src="../jscript/calendar.js"></script>
<script language="JavaScript" src="../jscript/alert_message.js"  type="text/javascript"></script> 
<script language="JavaScript" src="../jscript/confirm_exit.js"  type="text/javascript"></script>  
<script language="JavaScript" src="../jscript/cancel_confirmation.js"  type="text/javascript"></script> 

<?php
$_SESSION['current_page'] = "quality";
include ("../navigation/header.php");
$page_name = "Quality-dry inspection";

include ("../navigation/access.php");
if ($permission_num==1) {
include ("../navigation/quality_sidebar.php");

date_default_timezone_set('Africa/Gaborone');
$entry_date = date("Y-m-d H:i:s", time()); 

$report_no = $_GET['report_no'];
$approve = $_GET['approve'];


if ($report_no=='') {
	$table_name = $_SESSION['db_prefix']."_dry_tile_spec";
	$no_query = "SELECT dry_report_no FROM $table_name ORDER BY dry_report_no DESC  LIMIT 1";
	$no_result = mySQL_query($no_query);
	$report_no = mysql_result($no_result, 0, "dry_report_no") + 1;
		

$production_text = $_GET['production_text'];
$production_no_text = '';
$mix_design_name_text = '';
$pieces = explode("|", $production_text);
$result = count($pieces);
$i = 0;
while ($i<$result-1) {
$production_no_text = $production_no_text.$pieces[$i].'; '; 

$table_name = $_SESSION['db_prefix']."_production_plan";
$product_query = "SELECT mix_design_name, production_date, item_type, batch_code FROM $table_name WHERE production_no = '".$pieces[$i]."' ";
$product_result = mySQL_query($product_query);
$mix_design_name = mysql_result($product_result, 0, "mix_design_name");
$production_date = mysql_result($product_result, 0, "production_date");
$item_type = mysql_result($product_result, 0, "item_type");
$batch_code = mysql_result($product_result, 0, "batch_code");

$mix_design_name_text = $mix_design_name_text.$mix_design_name.'; ';

if (strpos($mix_design_name, 'Double Roman') !== false) { $type = 'DR'; }
if (strpos($mix_design_name, 'Venetian') !== false) { $type = 'VE'; }
if (strpos($mix_design_name, 'Slate') !== false) { $type = 'SL'; }

$table_name = $_SESSION['db_prefix']."_production_plan";
$report_query = "UPDATE $table_name SET dry_report_no = '".$report_no."' WHERE production_no = '".$pieces[$i]."' ";
execsql($report_query);

$i++;
}
//$item_type = $_GET['item_type'];

$table_name = $_SESSION['db_prefix']."_dry_tile_spec";
$insert_query = "INSERT INTO $table_name (dry_report_no, batch_code, production_date, item_name, item_type ) VALUES ( '".$report_no."', '".$batch_code."', '".$production_date."', '".$mix_design_name_text."', '".$item_type."' ) ";
execsql($insert_query);

$table_name = $_SESSION['db_prefix']."_production_plan";
$report_query = "UPDATE $table_name SET dry_report_no = '".$report_no."' WHERE batch_code = '".$batch_code."' AND item_type = '".$item_type."' ";
execsql($report_query);

?>
<script language="javascript" type="text/javascript">
			needToConfirm = false;
          	window.location="dry_tile_inspection_sheet.php?report_no=<?php echo $report_no ?>&approve=0";
</script>

<?php
}



if ($approve==1) {
$user_name = $_GET['user_select'];	
$password = $_GET['password'];

$table_name = $_SESSION['db_prefix']."_users";
$verify_query = "SELECT  username, password, access_id FROM $table_name WHERE username = '".$user_name."' AND password = '".$password."' ";
$verify_result = mySQL_query($verify_query);
$verify_num = mysql_num_rows($verify_result);

if ($verify_num!=0) {
$access_id = mysql_result($verify_result, 0, "access_id");
$table_name = $_SESSION['db_prefix']."_permissions";
$permission_query = "SELECT access_id  FROM  $table_name  WHERE access_id ='".$access_id."' AND page_name = 'Quality-approve' ";
$permission_result = mySQL_query($permission_query);
$permission_num = mysql_num_rows($permission_result);
if ($permission_num>0) { 
		$approve_date = $_GET['approve_date'];
		$approved_by = $_GET['user_select'];
		$table_name = $_SESSION['db_prefix']."_dry_tile_spec";
		$approve_query = "UPDATE $table_name SET approved = '1', approve_date = '".$approve_date."', approved_by = '".$approved_by."' WHERE dry_report_no = '".$report_no."' ";
		execsql($approve_query);
		
		$table_name = $_SESSION['db_prefix']."_production_plan";
		$plan_query = "UPDATE $table_name SET dry_approved = '1' WHERE dry_report_no = '".$report_no."' ";
		execsql($plan_query);
		
		
		
		$table_name = $_SESSION['db_prefix']."_tracking_quality";
		$trackingQuery = "INSERT INTO $table_name (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '93', '', '".$report_no."' ,'".$approved_by."','".$approve_date."' )";
		$trackingResult = mySQL_query($trackingQuery);
		?>
        <script language="javascript" type="text/javascript">
			needToConfirm = false;
        	window.location="dry_tile_report.php?report_no=<?php echo $report_no ?>";
		</script>
        <?php
}
else {
	$approve_message='This user is not allowed to approve inspection reports.'; 
}

}
else {
	$approve_message='User name and/or password were not correct, inspection report is not approved.';
}

}

if ($approve=='5') {
	    $approve_message_2='Request for approval of this report is send.';
}


$table_name = $_SESSION['db_prefix']."_list_quality_names";
    $position_query = "SELECT item_name FROM $table_name ORDER BY item_name ASC";
	$arrId1 = array ();
	$arrName1 = array ();
	$position_result = execsql($position_query);
	if ($position_result!="") {
	$position_num = mysql_num_rows($position_result);
	$b = 0;
	while ($b < $position_num) {
		$arrId1[$b] = mysql_result($position_result, $b, "item_name");
		$arrName1[$b] = mysql_result($position_result, $b, "item_name");
		$b++;
	}
	}	
	
$table_name = $_SESSION['db_prefix']."_list_approve_names";
    $position_query = "SELECT item_name FROM $table_name ORDER BY item_name ASC";
	$arrId2 = array ();
	$arrName2 = array ();
	$position_result = execsql($position_query);
	if ($position_result!="") {
	$position_num = mysql_num_rows($position_result);
	$b = 0;
	while ($b < $position_num) {
		$arrId2[$b] = mysql_result($position_result, $b, "item_name");
		$arrName2[$b] = mysql_result($position_result, $b, "item_name");
		$b++;
	}
	}
	
$table_name = $_SESSION['db_prefix']."_list_colors";
    $position_query = "SELECT item_name FROM $table_name ORDER BY item_name ASC";
	$arrId3 = array ();
	$arrName3 = array ();
	$position_result = execsql($position_query);
	if ($position_result!="") {
	$position_num = mysql_num_rows($position_result);
	$b = 0;
	while ($b < $position_num) {
		$arrId3[$b] = mysql_result($position_result, $b, "item_name");
		$arrName3[$b] = mysql_result($position_result, $b, "item_name");
		$b++;
	}
	}	


$table_name = $_SESSION['db_prefix']."_dry_tile_spec";
$report_query = "SELECT * FROM $table_name WHERE dry_report_no = '".$report_no."'  ";
$report_result = mySQL_query($report_query);
$batch_code = mysql_result($report_result, 0, "batch_code");
$production_date = mysql_result($report_result, 0, "production_date");
$product = mysql_result($report_result, 0, "item_name");
$item_type = mysql_result($report_result, 0, "item_type");
$tested_by = mysql_result($report_result, 0, "tested_by");
$test_date = mysql_result($report_result, 0, "test_date");
$approved = mysql_result($report_result, 0, "approved");
$approved_by = mysql_result($report_result, 0, "approved_by");
$approve_date = mysql_result($report_result, 0, "approve_date");
$flat_type = mysql_result($report_result, 0, "flat_type");
$profiled_type = mysql_result($report_result, 0, "profiled_type");
$colour_1 = mysql_result($report_result, 0, "colour_1");
$colour_2 = mysql_result($report_result, 0, "colour_2");
$true_colour = mysql_result($report_result, 0, "true_colour");
$antique = mysql_result($report_result, 0, "antique");
$length_L2_1 = mysql_result($report_result, 0, "length_L2_1");
$length_L2_2 = mysql_result($report_result, 0, "length_L2_2");
$length_L2_3 = mysql_result($report_result, 0, "length_L2_3");
$length_L2_4 = mysql_result($report_result, 0, "length_L2_4");
$length_L2_5 = mysql_result($report_result, 0, "length_L2_5");
$length_L2_6 = mysql_result($report_result, 0, "length_L2_6");
$length_L3_1 = mysql_result($report_result, 0, "length_L3_1");
$length_L3_2 = mysql_result($report_result, 0, "length_L3_2");
$length_L3_3 = mysql_result($report_result, 0, "length_L3_3");
$length_L3_4 = mysql_result($report_result, 0, "length_L3_4");
$length_L3_5 = mysql_result($report_result, 0, "length_L3_5");
$length_L3_6 = mysql_result($report_result, 0, "length_L3_6");
$length_L1_1 = mysql_result($report_result, 0, "length_L1_1");
$length_L1_2 = mysql_result($report_result, 0, "length_L1_2");
$length_L1_3 = mysql_result($report_result, 0, "length_L1_3");
$length_L1_4 = mysql_result($report_result, 0, "length_L1_4");
$length_L1_5 = mysql_result($report_result, 0, "length_L1_5");
$length_L1_6 = mysql_result($report_result, 0, "length_L1_6");
$flatness_1 = mysql_result($report_result, 0, "flatness_1");
$flatness_2 = mysql_result($report_result, 0, "flatness_2");
$flatness_3 = mysql_result($report_result, 0, "flatness_3");
$flatness_4 = mysql_result($report_result, 0, "flatness_4");
$flatness_5 = mysql_result($report_result, 0, "flatness_5");
$flatness_6 = mysql_result($report_result, 0, "flatness_6");
$width_1 = mysql_result($report_result, 0, "width_1");
$width_2 = mysql_result($report_result, 0, "width_2");
$width_3 = mysql_result($report_result, 0, "width_3");
$width_4 = mysql_result($report_result, 0, "width_4");
$width_5 = mysql_result($report_result, 0, "width_5");
$width_6 = mysql_result($report_result, 0, "width_6");
$nail_1 = mysql_result($report_result, 0, "nail_1");
$nail_2 = mysql_result($report_result, 0, "nail_2");
$nail_3 = mysql_result($report_result, 0, "nail_3");
$nail_4 = mysql_result($report_result, 0, "nail_4");
$nail_5 = mysql_result($report_result, 0, "nail_5");
$nail_6 = mysql_result($report_result, 0, "nail_6");
$rain_1 = mysql_result($report_result, 0, "rain_1");
$rain_2 = mysql_result($report_result, 0, "rain_2");
$rain_3 = mysql_result($report_result, 0, "rain_3");
$rain_4 = mysql_result($report_result, 0, "rain_4");
$rain_5 = mysql_result($report_result, 0, "rain_5");
$rain_6 = mysql_result($report_result, 0, "rain_6");
$mass_1_1 = mysql_result($report_result, 0, "mass_1_1");
$mass_1_2 = mysql_result($report_result, 0, "mass_1_2");
$mass_1_3 = mysql_result($report_result, 0, "mass_1_3");
$mass_1_4 = mysql_result($report_result, 0, "mass_1_4");
$mass_1_5 = mysql_result($report_result, 0, "mass_1_5");
$mass_1_6 = mysql_result($report_result, 0, "mass_1_6");
$mass_2_1 = mysql_result($report_result, 0, "mass_2_1");
$mass_2_2 = mysql_result($report_result, 0, "mass_2_2");
$mass_2_3 = mysql_result($report_result, 0, "mass_2_3");
$mass_2_4 = mysql_result($report_result, 0, "mass_2_4");
$mass_2_5 = mysql_result($report_result, 0, "mass_2_5");
$mass_2_6 = mysql_result($report_result, 0, "mass_2_6");
$mass_3_1 = mysql_result($report_result, 0, "mass_3_1");
$mass_3_2 = mysql_result($report_result, 0, "mass_3_2");
$mass_3_3 = mysql_result($report_result, 0, "mass_3_3");
$mass_3_4 = mysql_result($report_result, 0, "mass_3_4");
$mass_3_5 = mysql_result($report_result, 0, "mass_3_5");
$mass_3_6 = mysql_result($report_result, 0, "mass_3_6");
$divisions_1_1 = mysql_result($report_result, 0, "divisions_1_1");
$divisions_1_2 = mysql_result($report_result, 0, "divisions_1_2");
$divisions_1_3 = mysql_result($report_result, 0, "divisions_1_3");
$divisions_1_4 = mysql_result($report_result, 0, "divisions_1_4");
$divisions_1_5 = mysql_result($report_result, 0, "divisions_1_5");
$divisions_1_6 = mysql_result($report_result, 0, "divisions_1_6");
$divisions_2_1 = mysql_result($report_result, 0, "divisions_2_1");
$divisions_2_2 = mysql_result($report_result, 0, "divisions_2_2");
$divisions_2_3 = mysql_result($report_result, 0, "divisions_2_3");
$divisions_2_4 = mysql_result($report_result, 0, "divisions_2_4");
$divisions_2_5 = mysql_result($report_result, 0, "divisions_2_5");
$divisions_2_6 = mysql_result($report_result, 0, "divisions_2_6");
$divisions_3_1 = mysql_result($report_result, 0, "divisions_3_1");
$divisions_3_2 = mysql_result($report_result, 0, "divisions_3_2");
$divisions_3_3 = mysql_result($report_result, 0, "divisions_3_3");
$divisions_3_4 = mysql_result($report_result, 0, "divisions_3_4");
$divisions_3_5 = mysql_result($report_result, 0, "divisions_3_5");
$divisions_3_6 = mysql_result($report_result, 0, "divisions_3_6");
$kn_1_1 = mysql_result($report_result, 0, "kn_1_1");
$kn_1_2 = mysql_result($report_result, 0, "kn_1_2");
$kn_1_3 = mysql_result($report_result, 0, "kn_1_3");
$kn_1_4 = mysql_result($report_result, 0, "kn_1_4");
$kn_1_5 = mysql_result($report_result, 0, "kn_1_5");
$kn_1_6 = mysql_result($report_result, 0, "kn_1_6");
$kn_2_1 = mysql_result($report_result, 0, "kn_2_1");
$kn_2_2 = mysql_result($report_result, 0, "kn_2_2");
$kn_2_3 = mysql_result($report_result, 0, "kn_2_3");
$kn_2_4 = mysql_result($report_result, 0, "kn_2_4");
$kn_2_5 = mysql_result($report_result, 0, "kn_2_5");
$kn_2_6 = mysql_result($report_result, 0, "kn_2_6");
$kn_3_1 = mysql_result($report_result, 0, "kn_3_1");
$kn_3_2 = mysql_result($report_result, 0, "kn_3_2");
$kn_3_3 = mysql_result($report_result, 0, "kn_3_3");
$kn_3_4 = mysql_result($report_result, 0, "kn_3_4");
$kn_3_5 = mysql_result($report_result, 0, "kn_3_5");
$kn_3_6 = mysql_result($report_result, 0, "kn_3_6");
$thickness_1_1 = mysql_result($report_result, 0, "thickness_1_1");
$thickness_1_2 = mysql_result($report_result, 0, "thickness_1_2");
$thickness_1_3 = mysql_result($report_result, 0, "thickness_1_3");
$thickness_1_4 = mysql_result($report_result, 0, "thickness_1_4");
$thickness_1_5 = mysql_result($report_result, 0, "thickness_1_5");
$thickness_1_6 = mysql_result($report_result, 0, "thickness_1_6");
$thickness_2_1 = mysql_result($report_result, 0, "thickness_2_1");
$thickness_2_2 = mysql_result($report_result, 0, "thickness_2_2");
$thickness_2_3 = mysql_result($report_result, 0, "thickness_2_3");
$thickness_2_4 = mysql_result($report_result, 0, "thickness_2_4");
$thickness_2_5 = mysql_result($report_result, 0, "thickness_2_5");
$thickness_2_6 = mysql_result($report_result, 0, "thickness_2_6");
$thickness_3_1 = mysql_result($report_result, 0, "thickness_3_1");
$thickness_3_2 = mysql_result($report_result, 0, "thickness_3_2");
$thickness_3_3 = mysql_result($report_result, 0, "thickness_3_3");
$thickness_3_4 = mysql_result($report_result, 0, "thickness_3_4");
$thickness_3_5 = mysql_result($report_result, 0, "thickness_3_5");
$thickness_3_6 = mysql_result($report_result, 0, "thickness_3_6");
$release_1_date = mysql_result($report_result, 0, "release_1_date");
$release_3_date = mysql_result($report_result, 0, "release_3_date");
$release_7_date = mysql_result($report_result, 0, "release_7_date");

if (strpos($product, 'Double Roman') !== false) { $type = 'DR'; }
if (strpos($product, 'Venetian') !== false) { $type = 'VE'; }
if (strpos($product, 'Slate') !== false) { $type = 'SL'; }

if (($test_date=='0000-00-00') OR ($test_date=='') ) {
	   $test_date = date("Y-m-d");
}
require_once ('../include/tc_calendar.php');
$testing_date = strtotime($test_date);
$d = date("d", $testing_date );
$m = date("m", $testing_date );
$y = date("Y", $testing_date );

if (($release_1_date=='0000-00-00') OR ($release_1_date=='') ) {
	   $release_1_date = date("Y-m-d");
}
require_once ('../include/tc_calendar.php');
$rel_1_date = strtotime($release_1_date);
$d1 = date("d", $rel_1_date );
$m1 = date("m", $rel_1_date );
$y1 = date("Y", $rel_1_date );

if (($release_3_date=='0000-00-00') OR ($release_3_date=='') ) {
	   $release_3_date = date("Y-m-d");
}
require_once ('../include/tc_calendar.php');
$rel_3_date = strtotime($release_3_date);
$d3 = date("d", $rel_3_date );
$m3 = date("m", $rel_3_date );
$y3 = date("Y", $rel_3_date );

if (($release_7_date=='0000-00-00') OR ($release_7_date=='') ) {
	   $release_7_date = date("Y-m-d");
}
require_once ('../include/tc_calendar.php');
$rel_7_date = strtotime($release_7_date);
$d7 = date("d", $rel_7_date );
$m7 = date("m", $rel_7_date );
$y7 = date("Y", $rel_7_date );


if ($length_L2_1==0) {$length_L2_1='';}
if ($length_L2_2==0) {$length_L2_2='';}
if ($length_L2_3==0) {$length_L2_3='';}
if ($length_L2_4==0) {$length_L2_4='';}
if ($length_L2_5==0) {$length_L2_5='';}
if ($length_L2_6==0) {$length_L2_6='';}
if ($length_L3_1==0) {$length_L3_1='';}
if ($length_L3_2==0) {$length_L3_2='';}
if ($length_L3_3==0) {$length_L3_3='';}
if ($length_L3_4==0) {$length_L3_4='';}
if ($length_L3_5==0) {$length_L3_5='';}
if ($length_L3_6==0) {$length_L3_6='';}
if ($length_L1_1==0) {$length_L1_1='';}
if ($length_L1_2==0) {$length_L1_2='';}
if ($length_L1_3==0) {$length_L1_3='';}
if ($length_L1_4==0) {$length_L1_4='';}
if ($length_L1_5==0) {$length_L1_5='';}
if ($length_L1_6==0) {$length_L1_6='';}
if ($flatness_1==0) {$flatness_1='';}
if ($flatness_2==0) {$flatness_2='';}
if ($flatness_3==0) {$flatness_3='';}
if ($flatness_4==0) {$flatness_4='';}
if ($flatness_5==0) {$flatness_5='';}
if ($flatness_6==0) {$flatness_6='';}
if ($width_1==0) {$width_1='';}
if ($width_2==0) {$width_2='';}
if ($width_3==0) {$width_3='';}
if ($width_4==0) {$width_4='';}
if ($width_5==0) {$width_5='';}
if ($width_6==0) {$width_6='';}
if ($nail_1==0) {$nail_1='';}
if ($nail_2==0) {$nail_2='';}
if ($nail_3==0) {$nail_3='';}
if ($nail_4==0) {$nail_4='';}
if ($nail_5==0) {$nail_5='';}
if ($nail_6==0) {$nail_6='';}
if ($rain_1==0) {$rain_1='';}
if ($rain_2==0) {$rain_2='';}
if ($rain_3==0) {$rain_3='';}
if ($rain_4==0) {$rain_4='';}
if ($rain_5==0) {$rain_5='';}
if ($rain_6==0) {$rain_6='';}
if ($mass_1_1==0) {$mass_1_1='';}
if ($mass_1_2==0) {$mass_1_2='';}
if ($mass_1_3==0) {$mass_1_3='';}
if ($mass_1_4==0) {$mass_1_4='';}
if ($mass_1_5==0) {$mass_1_5='';}
if ($mass_1_6==0) {$mass_1_6='';}
if ($divisions_1_1==0) {$divisions_1_1='';}
if ($divisions_1_2==0) {$divisions_1_2='';}
if ($divisions_1_3==0) {$divisions_1_3='';}
if ($divisions_1_4==0) {$divisions_1_4='';}
if ($divisions_1_5==0) {$divisions_1_5='';}
if ($divisions_1_6==0) {$divisions_1_6='';}
if ($kn_1_1==0) {$kn_1_1='';}
if ($kn_1_2==0) {$kn_1_2='';}
if ($kn_1_3==0) {$kn_1_3='';}
if ($kn_1_4==0) {$kn_1_4='';}
if ($kn_1_5==0) {$kn_1_5='';}
if ($kn_1_6==0) {$kn_1_6='';}
if ($thickness_1_1==0) {$thickness_1_1='';}
if ($thickness_1_2==0) {$thickness_1_2='';}
if ($thickness_1_3==0) {$thickness_1_3='';}
if ($thickness_1_4==0) {$thickness_1_4='';}
if ($thickness_1_5==0) {$thickness_1_5='';}
if ($thickness_1_6==0) {$thickness_1_6='';}
if ($mass_2_1==0) {$mass_2_1='';}
if ($mass_2_2==0) {$mass_2_2='';}
if ($mass_2_3==0) {$mass_2_3='';}
if ($mass_2_4==0) {$mass_2_4='';}
if ($mass_2_5==0) {$mass_2_5='';}
if ($mass_2_6==0) {$mass_2_6='';}
if ($divisions_2_1==0) {$divisions_2_1='';}
if ($divisions_2_2==0) {$divisions_2_2='';}
if ($divisions_2_3==0) {$divisions_2_3='';}
if ($divisions_2_4==0) {$divisions_2_4='';}
if ($divisions_2_5==0) {$divisions_2_5='';}
if ($divisions_2_6==0) {$divisions_2_6='';}
if ($kn_2_1==0) {$kn_2_1='';}
if ($kn_2_2==0) {$kn_2_2='';}
if ($kn_2_3==0) {$kn_2_3='';}
if ($kn_2_4==0) {$kn_2_4='';}
if ($kn_2_5==0) {$kn_2_5='';}
if ($kn_2_6==0) {$kn_2_6='';}
if ($thickness_2_1==0) {$thickness_2_1='';}
if ($thickness_2_2==0) {$thickness_2_2='';}
if ($thickness_2_3==0) {$thickness_2_3='';}
if ($thickness_2_4==0) {$thickness_2_4='';}
if ($thickness_2_5==0) {$thickness_2_5='';}
if ($thickness_2_6==0) {$thickness_2_6='';}
if ($mass_3_1==0) {$mass_3_1='';}
if ($mass_3_2==0) {$mass_3_2='';}
if ($mass_3_3==0) {$mass_3_3='';}
if ($mass_3_4==0) {$mass_3_4='';}
if ($mass_3_5==0) {$mass_3_5='';}
if ($mass_3_6==0) {$mass_3_6='';}
if ($divisions_3_1==0) {$divisions_3_1='';}
if ($divisions_3_2==0) {$divisions_3_2='';}
if ($divisions_3_3==0) {$divisions_3_3='';}
if ($divisions_3_4==0) {$divisions_3_4='';}
if ($divisions_3_5==0) {$divisions_3_5='';}
if ($divisions_3_6==0) {$divisions_3_6='';}
if ($kn_3_1==0) {$kn_3_1='';}
if ($kn_3_2==0) {$kn_3_2='';}
if ($kn_3_3==0) {$kn_3_3='';}
if ($kn_3_4==0) {$kn_3_4='';}
if ($kn_3_5==0) {$kn_3_5='';}
if ($kn_3_6==0) {$kn_3_6='';}
if ($thickness_3_1==0) {$thickness_3_1='';}
if ($thickness_3_2==0) {$thickness_3_2='';}
if ($thickness_3_3==0) {$thickness_3_3='';}
if ($thickness_3_4==0) {$thickness_3_4='';}
if ($thickness_3_5==0) {$thickness_3_5='';}
if ($thickness_3_6==0) {$thickness_3_6='';}

?>

<script>
function ave_mass_1() {
	var mass_1_1 = parseFloat(document.getElementById('mass_1_1').value);
	var mass_1_2 = parseFloat(document.getElementById('mass_1_2').value);
	var mass_1_3 = parseFloat(document.getElementById('mass_1_3').value);
	var mass_1_4 = parseFloat(document.getElementById('mass_1_4').value);
	var mass_1_5 = parseFloat(document.getElementById('mass_1_5').value);
	var mass_1_6 = parseFloat(document.getElementById('mass_1_6').value);
	
	var count = 0;
	var total = 0;
		
	if ((mass_1_1)||(mass_1_1==0)) {count = count + 1;  total = total + mass_1_1;} else {mass_1_1=0; total = total + 0;}
	if ((mass_1_2)||(mass_1_2==0)) {count = count + 1;  total = total + mass_1_2;} else {mass_1_2=0; total = total + 0;}
	if ((mass_1_3)||(mass_1_3==0)) {count = count + 1;  total = total + mass_1_3;} else {mass_1_3=0; total = total + 0;}
	if ((mass_1_4)||(mass_1_4==0)) {count = count + 1;  total = total + mass_1_4;} else {mass_1_4=0; total = total + 0;}
	if ((mass_1_5)||(mass_1_5==0)) {count = count + 1;  total = total + mass_1_5;} else {mass_1_5=0; total = total + 0;}
	if ((mass_1_6)||(mass_1_6==0)) {count = count + 1;  total = total + mass_1_6;} else {mass_1_6=0; total = total + 0;}
		
	var mass_1_ave = 0;
	mass_1_ave = total / count;
	
	if (mass_1_ave) {
	document.getElementById('mass_1_ave').value = mass_1_ave.toFixed(2);
	}
}
</script>

<script>
function ave_div_1() {
	var divisions_1_1 = parseFloat(document.getElementById('divisions_1_1').value);
	var divisions_1_2 = parseFloat(document.getElementById('divisions_1_2').value);
	var divisions_1_3 = parseFloat(document.getElementById('divisions_1_3').value);
	var divisions_1_4 = parseFloat(document.getElementById('divisions_1_4').value);
	var divisions_1_5 = parseFloat(document.getElementById('divisions_1_5').value);
	var divisions_1_6 = parseFloat(document.getElementById('divisions_1_6').value);
	
	var count = 0;
	var total = 0;
		
	if ((divisions_1_1)||(divisions_1_1==0)) {count = count + 1;  total = total + divisions_1_1;} else {divisions_1_1=0; total = total + 0;}
	if ((divisions_1_2)||(divisions_1_2==0)) {count = count + 1;  total = total + divisions_1_2;} else {divisions_1_2=0; total = total + 0;}
	if ((divisions_1_3)||(divisions_1_3==0)) {count = count + 1;  total = total + divisions_1_3;} else {divisions_1_3=0; total = total + 0;}
	if ((divisions_1_4)||(divisions_1_4==0)) {count = count + 1;  total = total + divisions_1_4;} else {divisions_1_4=0; total = total + 0;}
	if ((divisions_1_5)||(divisions_1_5==0)) {count = count + 1;  total = total + divisions_1_5;} else {divisions_1_5=0; total = total + 0;}
	if ((divisions_1_6)||(divisions_1_6==0)) {count = count + 1;  total = total + divisions_1_6;} else {divisions_1_6=0; total = total + 0;}
		
	var div_1_ave = 0;
	div_1_ave = total / count;
	
	if (div_1_ave) {
	document.getElementById('div_1_ave').value = div_1_ave.toFixed(2);;
	}
}
</script>

<script>
function ave_kn_1() {
	var kn_1_1 = parseFloat(document.getElementById('kn_1_1').value);
	var kn_1_2 = parseFloat(document.getElementById('kn_1_2').value);
	var kn_1_3 = parseFloat(document.getElementById('kn_1_3').value);
	var kn_1_4 = parseFloat(document.getElementById('kn_1_4').value);
	var kn_1_5 = parseFloat(document.getElementById('kn_1_5').value);
	var kn_1_6 = parseFloat(document.getElementById('kn_1_6').value);
	
	var count = 0;
	var total = 0;
		
	if ((kn_1_1)||(kn_1_1==0)) {count = count + 1;  total = total + kn_1_1;} else {kn_1_1=0; total = total + 0;}
	if ((kn_1_2)||(kn_1_2==0)) {count = count + 1;  total = total + kn_1_2;} else {kn_1_2=0; total = total + 0;}
	if ((kn_1_3)||(kn_1_3==0)) {count = count + 1;  total = total + kn_1_3;} else {kn_1_3=0; total = total + 0;}
	if ((kn_1_4)||(kn_1_4==0)) {count = count + 1;  total = total + kn_1_4;} else {kn_1_4=0; total = total + 0;}
	if ((kn_1_5)||(kn_1_5==0)) {count = count + 1;  total = total + kn_1_5;} else {kn_1_5=0; total = total + 0;}
	if ((kn_1_6)||(kn_1_6==0)) {count = count + 1;  total = total + kn_1_6;} else {kn_1_6=0; total = total + 0;}
		
	var kn_1_ave = 0;
	kn_1_ave = total / count;
	
	if (kn_1_ave) {
	document.getElementById('kn_1_ave').value = kn_1_ave.toFixed(2);;
	}
}
</script>

<script>
function ave_thick_1() {
	var thickness_1_1 = parseFloat(document.getElementById('thickness_1_1').value);
	var thickness_1_2 = parseFloat(document.getElementById('thickness_1_2').value);
	var thickness_1_3 = parseFloat(document.getElementById('thickness_1_3').value);
	var thickness_1_4 = parseFloat(document.getElementById('thickness_1_4').value);
	var thickness_1_5 = parseFloat(document.getElementById('thickness_1_5').value);
	var thickness_1_6 = parseFloat(document.getElementById('thickness_1_6').value);
	
	var count = 0;
	var total = 0;
		
	if ((thickness_1_1)||(thickness_1_1==0)) {count = count + 1;  total = total + thickness_1_1;} else {thickness_1_1=0; total = total + 0;}
	if ((thickness_1_2)||(thickness_1_2==0)) {count = count + 1;  total = total + thickness_1_2;} else {thickness_1_2=0; total = total + 0;}
	if ((thickness_1_3)||(thickness_1_3==0)) {count = count + 1;  total = total + thickness_1_3;} else {thickness_1_3=0; total = total + 0;}
	if ((thickness_1_4)||(thickness_1_4==0)) {count = count + 1;  total = total + thickness_1_4;} else {thickness_1_4=0; total = total + 0;}
	if ((thickness_1_5)||(thickness_1_5==0)) {count = count + 1;  total = total + thickness_1_5;} else {thickness_1_5=0; total = total + 0;}
	if ((thickness_1_6)||(thickness_1_6==0)) {count = count + 1;  total = total + thickness_1_6;} else {thickness_1_6=0; total = total + 0;}
		
	var thickness_1_ave = 0;
	thickness_1_ave = total / count;
	
	if (thickness_1_ave) {
	document.getElementById('thick_1_ave').value = thickness_1_ave.toFixed(2);;
	}
}
</script>

<script>
function ave_mass_2() {
	var mass_2_1 = parseFloat(document.getElementById('mass_2_1').value);
	var mass_2_2 = parseFloat(document.getElementById('mass_2_2').value);
	var mass_2_3 = parseFloat(document.getElementById('mass_2_3').value);
	var mass_2_4 = parseFloat(document.getElementById('mass_2_4').value);
	var mass_2_5 = parseFloat(document.getElementById('mass_2_5').value);
	var mass_2_6 = parseFloat(document.getElementById('mass_2_6').value);
	
	var count = 0;
	var total = 0;
		
	if ((mass_2_1)||(mass_2_1==0)) {count = count + 1;  total = total + mass_2_1;} else {mass_2_1=0; total = total + 0;}
	if ((mass_2_2)||(mass_2_2==0)) {count = count + 1;  total = total + mass_2_2;} else {mass_2_2=0; total = total + 0;}
	if ((mass_2_3)||(mass_2_3==0)) {count = count + 1;  total = total + mass_2_3;} else {mass_2_3=0; total = total + 0;}
	if ((mass_2_4)||(mass_2_4==0)) {count = count + 1;  total = total + mass_2_4;} else {mass_2_4=0; total = total + 0;}
	if ((mass_2_5)||(mass_2_5==0)) {count = count + 1;  total = total + mass_2_5;} else {mass_2_5=0; total = total + 0;}
	if ((mass_2_6)||(mass_2_6==0)) {count = count + 1;  total = total + mass_2_6;} else {mass_2_6=0; total = total + 0;}
		
	var mass_2_ave = 0;
	mass_2_ave = total / count;
	
	if (mass_2_ave) {
	document.getElementById('mass_2_ave').value = mass_2_ave.toFixed(2);
	}
}
</script>

<script>
function ave_div_2() {
	var divisions_2_1 = parseFloat(document.getElementById('divisions_2_1').value);
	var divisions_2_2 = parseFloat(document.getElementById('divisions_2_2').value);
	var divisions_2_3 = parseFloat(document.getElementById('divisions_2_3').value);
	var divisions_2_4 = parseFloat(document.getElementById('divisions_2_4').value);
	var divisions_2_5 = parseFloat(document.getElementById('divisions_2_5').value);
	var divisions_2_6 = parseFloat(document.getElementById('divisions_2_6').value);
	
	var count = 0;
	var total = 0;
		
	if ((divisions_2_1)||(divisions_2_1==0)) {count = count + 1;  total = total + divisions_2_1;} else {divisions_2_1=0; total = total + 0;}
	if ((divisions_2_2)||(divisions_2_2==0)) {count = count + 1;  total = total + divisions_2_2;} else {divisions_2_2=0; total = total + 0;}
	if ((divisions_2_3)||(divisions_2_3==0)) {count = count + 1;  total = total + divisions_2_3;} else {divisions_2_3=0; total = total + 0;}
	if ((divisions_2_4)||(divisions_2_4==0)) {count = count + 1;  total = total + divisions_2_4;} else {divisions_2_4=0; total = total + 0;}
	if ((divisions_2_5)||(divisions_2_5==0)) {count = count + 1;  total = total + divisions_2_5;} else {divisions_2_5=0; total = total + 0;}
	if ((divisions_2_6)||(divisions_2_6==0)) {count = count + 1;  total = total + divisions_2_6;} else {divisions_2_6=0; total = total + 0;}
		
	var div_2_ave = 0;
	div_2_ave = total / count;
	
	if (div_2_ave) {
	document.getElementById('div_2_ave').value = div_2_ave.toFixed(2);;
	}
}
</script>

<script>
function ave_kn_2() {
	var kn_2_1 = parseFloat(document.getElementById('kn_2_1').value);
	var kn_2_2 = parseFloat(document.getElementById('kn_2_2').value);
	var kn_2_3 = parseFloat(document.getElementById('kn_2_3').value);
	var kn_2_4 = parseFloat(document.getElementById('kn_2_4').value);
	var kn_2_5 = parseFloat(document.getElementById('kn_2_5').value);
	var kn_2_6 = parseFloat(document.getElementById('kn_2_6').value);
	
	var count = 0;
	var total = 0;
		
	if ((kn_2_1)||(kn_2_1==0)) {count = count + 1;  total = total + kn_2_1;} else {kn_2_1=0; total = total + 0;}
	if ((kn_2_2)||(kn_2_2==0)) {count = count + 1;  total = total + kn_2_2;} else {kn_2_2=0; total = total + 0;}
	if ((kn_2_3)||(kn_2_3==0)) {count = count + 1;  total = total + kn_2_3;} else {kn_2_3=0; total = total + 0;}
	if ((kn_2_4)||(kn_2_4==0)) {count = count + 1;  total = total + kn_2_4;} else {kn_2_4=0; total = total + 0;}
	if ((kn_2_5)||(kn_2_5==0)) {count = count + 1;  total = total + kn_2_5;} else {kn_2_5=0; total = total + 0;}
	if ((kn_2_6)||(kn_2_6==0)) {count = count + 1;  total = total + kn_2_6;} else {kn_2_6=0; total = total + 0;}
		
	var kn_2_ave = 0;
	kn_2_ave = total / count;
	
	if (kn_2_ave) {
	document.getElementById('kn_2_ave').value = kn_2_ave.toFixed(2);;
	}
}
</script>

<script>
function ave_thick_2() {
	var thickness_2_1 = parseFloat(document.getElementById('thickness_2_1').value);
	var thickness_2_2 = parseFloat(document.getElementById('thickness_2_2').value);
	var thickness_2_3 = parseFloat(document.getElementById('thickness_2_3').value);
	var thickness_2_4 = parseFloat(document.getElementById('thickness_2_4').value);
	var thickness_2_5 = parseFloat(document.getElementById('thickness_2_5').value);
	var thickness_2_6 = parseFloat(document.getElementById('thickness_2_6').value);
	
	var count = 0;
	var total = 0;
		
	if ((thickness_2_1)||(thickness_2_1==0)) {count = count + 1;  total = total + thickness_2_1;} else {thickness_2_1=0; total = total + 0;}
	if ((thickness_2_2)||(thickness_2_2==0)) {count = count + 1;  total = total + thickness_2_2;} else {thickness_2_2=0; total = total + 0;}
	if ((thickness_2_3)||(thickness_2_3==0)) {count = count + 1;  total = total + thickness_2_3;} else {thickness_2_3=0; total = total + 0;}
	if ((thickness_2_4)||(thickness_2_4==0)) {count = count + 1;  total = total + thickness_2_4;} else {thickness_2_4=0; total = total + 0;}
	if ((thickness_2_5)||(thickness_2_5==0)) {count = count + 1;  total = total + thickness_2_5;} else {thickness_2_5=0; total = total + 0;}
	if ((thickness_2_6)||(thickness_2_6==0)) {count = count + 1;  total = total + thickness_2_6;} else {thickness_2_6=0; total = total + 0;}
		
	var thickness_2_ave = 0;
	thickness_2_ave = total / count;
	
	if (thickness_2_ave) {
	document.getElementById('thick_2_ave').value = thickness_2_ave.toFixed(2);;
	}
}
</script>

<script>
function ave_mass_3() {
	var mass_3_1 = parseFloat(document.getElementById('mass_3_1').value);
	var mass_3_2 = parseFloat(document.getElementById('mass_3_2').value);
	var mass_3_3 = parseFloat(document.getElementById('mass_3_3').value);
	var mass_3_4 = parseFloat(document.getElementById('mass_3_4').value);
	var mass_3_5 = parseFloat(document.getElementById('mass_3_5').value);
	var mass_3_6 = parseFloat(document.getElementById('mass_3_6').value);
	
	var count = 0;
	var total = 0;
		
	if ((mass_3_1)||(mass_3_1==0)) {count = count + 1;  total = total + mass_3_1;} else {mass_3_1=0; total = total + 0;}
	if ((mass_3_2)||(mass_3_2==0)) {count = count + 1;  total = total + mass_3_2;} else {mass_3_2=0; total = total + 0;}
	if ((mass_3_3)||(mass_3_3==0)) {count = count + 1;  total = total + mass_3_3;} else {mass_3_3=0; total = total + 0;}
	if ((mass_3_4)||(mass_3_4==0)) {count = count + 1;  total = total + mass_3_4;} else {mass_3_4=0; total = total + 0;}
	if ((mass_3_5)||(mass_3_5==0)) {count = count + 1;  total = total + mass_3_5;} else {mass_3_5=0; total = total + 0;}
	if ((mass_3_6)||(mass_3_6==0)) {count = count + 1;  total = total + mass_3_6;} else {mass_3_6=0; total = total + 0;}
		
	var mass_3_ave = 0;
	mass_3_ave = total / count;
	
	if (mass_3_ave) { 
	document.getElementById('mass_3_ave').value = mass_3_ave.toFixed(2);
	}
}
</script>

<script>
function ave_div_3() {
	var divisions_3_1 = parseFloat(document.getElementById('divisions_3_1').value);
	var divisions_3_2 = parseFloat(document.getElementById('divisions_3_2').value);
	var divisions_3_3 = parseFloat(document.getElementById('divisions_3_3').value);
	var divisions_3_4 = parseFloat(document.getElementById('divisions_3_4').value);
	var divisions_3_5 = parseFloat(document.getElementById('divisions_3_5').value);
	var divisions_3_6 = parseFloat(document.getElementById('divisions_3_6').value);
	
	var count = 0;
	var total = 0;
		
	if ((divisions_3_1)||(divisions_3_1==0)) {count = count + 1;  total = total + divisions_3_1;} else {divisions_3_1=0; total = total + 0;}
	if ((divisions_3_2)||(divisions_3_2==0)) {count = count + 1;  total = total + divisions_3_2;} else {divisions_3_2=0; total = total + 0;}
	if ((divisions_3_3)||(divisions_3_3==0)) {count = count + 1;  total = total + divisions_3_3;} else {divisions_3_3=0; total = total + 0;}
	if ((divisions_3_4)||(divisions_3_4==0)) {count = count + 1;  total = total + divisions_3_4;} else {divisions_3_4=0; total = total + 0;}
	if ((divisions_3_5)||(divisions_3_5==0)) {count = count + 1;  total = total + divisions_3_5;} else {divisions_3_5=0; total = total + 0;}
	if ((divisions_3_6)||(divisions_3_6==0)) {count = count + 1;  total = total + divisions_3_6;} else {divisions_3_6=0; total = total + 0;}
		
	var div_3_ave = 0;
	div_3_ave = total / count;
	
	if (div_3_ave) {
	document.getElementById('div_3_ave').value = div_3_ave.toFixed(2);;
	}
}
</script>

<script>
function ave_kn_3() {
	var kn_3_1 = parseFloat(document.getElementById('kn_3_1').value);
	var kn_3_2 = parseFloat(document.getElementById('kn_3_2').value);
	var kn_3_3 = parseFloat(document.getElementById('kn_3_3').value);
	var kn_3_4 = parseFloat(document.getElementById('kn_3_4').value);
	var kn_3_5 = parseFloat(document.getElementById('kn_3_5').value);
	var kn_3_6 = parseFloat(document.getElementById('kn_3_6').value);
	
	var count = 0;
	var total = 0;
		
	if ((kn_3_1)||(kn_3_1==0)) {count = count + 1;  total = total + kn_3_1;} else {kn_3_1=0; total = total + 0;}
	if ((kn_3_2)||(kn_3_2==0)) {count = count + 1;  total = total + kn_3_2;} else {kn_3_2=0; total = total + 0;}
	if ((kn_3_3)||(kn_3_3==0)) {count = count + 1;  total = total + kn_3_3;} else {kn_3_3=0; total = total + 0;}
	if ((kn_3_4)||(kn_3_4==0)) {count = count + 1;  total = total + kn_3_4;} else {kn_3_4=0; total = total + 0;}
	if ((kn_3_5)||(kn_3_5==0)) {count = count + 1;  total = total + kn_3_5;} else {kn_3_5=0; total = total + 0;}
	if ((kn_3_6)||(kn_3_6==0)) {count = count + 1;  total = total + kn_3_6;} else {kn_3_6=0; total = total + 0;}
		
	var kn_3_ave = 0;
	kn_3_ave = total / count;
	
	if (kn_3_ave) {
	document.getElementById('kn_3_ave').value = kn_3_ave.toFixed(2);;
	}
}
</script>

<script>
function ave_thick_3() {
	var thickness_3_1 = parseFloat(document.getElementById('thickness_3_1').value);
	var thickness_3_2 = parseFloat(document.getElementById('thickness_3_2').value);
	var thickness_3_3 = parseFloat(document.getElementById('thickness_3_3').value);
	var thickness_3_4 = parseFloat(document.getElementById('thickness_3_4').value);
	var thickness_3_5 = parseFloat(document.getElementById('thickness_3_5').value);
	var thickness_3_6 = parseFloat(document.getElementById('thickness_3_6').value);
	
	var count = 0;
	var total = 0;
		
	if ((thickness_3_1)||(thickness_3_1==0)) {count = count + 1;  total = total + thickness_3_1;} else {thickness_3_1=0; total = total + 0;}
	if ((thickness_3_2)||(thickness_3_2==0)) {count = count + 1;  total = total + thickness_3_2;} else {thickness_3_2=0; total = total + 0;}
	if ((thickness_3_3)||(thickness_3_3==0)) {count = count + 1;  total = total + thickness_3_3;} else {thickness_3_3=0; total = total + 0;}
	if ((thickness_3_4)||(thickness_3_4==0)) {count = count + 1;  total = total + thickness_3_4;} else {thickness_3_4=0; total = total + 0;}
	if ((thickness_3_5)||(thickness_3_5==0)) {count = count + 1;  total = total + thickness_3_5;} else {thickness_3_5=0; total = total + 0;}
	if ((thickness_3_6)||(thickness_3_6==0)) {count = count + 1;  total = total + thickness_3_6;} else {thickness_3_6=0; total = total + 0;}
		
	var thickness_3_ave = 0;
	thickness_3_ave = total / count;
	
	if (thickness_3_ave) {
	document.getElementById('thick_3_ave').value = thickness_3_ave.toFixed(2);;
	}
}
</script>

</head>

<body onLoad="<?php if ($approve==1) {?> alertMessage(1, '', '<?php echo $approve_message ?> ')<?php } ?>; <?php if ($approve==5) {?> alertMessage(1, '', '<?php echo $approve_message_2 ?> ')<?php } ?>; ave_mass_1(); ave_mass_2(); ave_mass_3(); ave_div_1(); ave_div_2(); ave_div_3(); ave_kn_1(); ave_kn_2(); ave_kn_3(); ave_thick_1(); ave_thick_2(); ave_thick_3();">

<div class="main_frame">
 
<div class="page_head_frame">
        <table width="630" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><label class="label_page_head">Dry tile inspections <?php echo $item_type ?></label></td>
            </tr>
        </table>
</div>
<br>
<br>
<form action="dry_tile_inspection_save.php" method="POST" name='form1'>
<div class="page_middle_frame">
<div class="page_inside_frame">
<table width="682" id="table_details_display">
  <tr>
    <td><label class="label_std" style="font-size:14px;">Report no:</label></td>
    <td><?php echo $report_no ?></td>
    <td>Batch code:</td>
    <td width="215"><?php echo $batch_code ?>
      <input type="hidden" name="report_no" id="report_no" value="<?php echo $report_no ?>"></td>
    </tr>
  <tr>
    <td>Product(s):</td>
    <td colspan="3"><?php echo $product ?>(<?php echo $type; ?>)<input name="type" type="hidden" value="<?php echo $type ?>"></td>
    </tr>
  <tr>
    <td>Tested by:</td>
    <td><span class="wizard_frame">
      <select name="tested_by_select" id="tested_by_select" class="select160" onChange="document.getElementById('p_edit').value='yes'">
        <option value="<?php echo $tested_by?>" selected="selected"><?php echo $tested_by?></option>
        <?php 
    	for ($w = 0; $w < count($arrId1); $w++) {
		echo "<option value=\"".$arrId1[$w] . "\"" . ">" . $arrName1[$w] . "</option>";	
	    }
     ?>
      </select>
    </span></td>
    <td>Production date:</td>
    <td><?php echo date("d-m-Y", strtotime($production_date))?>
      <input type="hidden" name="production_date" id="production_date" value="<?php echo $production_date ?>"></td>
    </tr>
  <tr>
    <td width="98">Date:</td>
    <td width="243"><?php

		$myCalendar = new tc_calendar("test_date", true);
		$myCalendar->setIcon("../images/iconCalendar.gif");
		$myCalendar->setDate($d, $m, $y);
		$myCalendar->setPath("./");
		$myCalendar->setYearInterval(2015, 2090);
		$myCalendar->writeScript();
?>
&nbsp;&nbsp;</td>
    <td width="106">Tile type:</td>
    <td><p>
       Flat <input name="flat_checkbox" type="checkbox" <?php if ($flat_type==1) { ?> checked <?php } ?>  onChange="document.getElementById('p_edit').value='yes'">
       &nbsp;&nbsp;&nbsp;&nbsp;
       Profiled<input name="profiled_checkbox" type="checkbox" <?php if ($profiled_type==1) { ?> checked <?php } ?>  onChange="document.getElementById('p_edit').value='yes'">
      <br>
    </p></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><input type="hidden" name="edit" id="edit" value='0'>
Click <a href="" onMouseOver="ddrivetip('Click to approve this inspection report.', 250)"; onMouseOut="hideddrivetip()" onClick=
    "if (document.getElementById('p_edit').value==1) {alertMessage(1, '', 'The last changes were not saved.<br><br>Save the report first and than try again.'); return false;  } else { editwindow=dhtmlmodal.open('editBox', 'iframe', '../edit_windows/dry_tile_approve.php?report_no=<?php echo $report_no ?>', 'Approve dry tile inspection.', 'width=450px,height=300px,center=1,resize=0,scrolling=0');
needToConfirm = false;
editwindow.onclose=function(){return window}; return false; }"><b>here</b></a> to approve.</td>
    <td>Colour:</td>
    <td><span class="wizard_frame">
      <select name="color_select_1" id="color_select_1" class="select100" onChange="document.getElementById('p_edit').value='yes'">
        <option value="<?php echo $colour_1?>" selected="selected"><?php echo $colour_1?></option>
        <?php 
    	for ($w = 0; $w < count($arrId3); $w++) {
		echo "<option value=\"".$arrId3[$w] . "\"" . ">" . $arrName3[$w] . "</option>";	
	    }
     ?>
      </select>
      <select name="color_select_2" id="color_select_2" class="select100" onChange="document.getElementById('p_edit').value='yes'">
        <option value="<?php echo $colour_2?>" selected="selected"><?php echo $colour_2?></option>
        <?php 
    	for ($w = 0; $w < count($arrId3); $w++) {
		echo "<option value=\"".$arrId3[$w] . "\"" . ">" . $arrName3[$w] . "</option>";	
	    }
     ?>
      </select>
    </span></td>
    </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>Finish:</td>
    <td>True Colour: 
      <input type="checkbox" name="true_colour_checkbox" id="true_colour_checkbox" <?php if ($true_colour==1) { ?> checked <?php } ?>  onChange="document.getElementById('p_edit').value='yes'"> 
      &nbsp;&nbsp;&nbsp;&nbsp;Antique:&nbsp;&nbsp;
      <input type="checkbox" name="antique_checkbox" id="antique_checkbox"<?php if ($antique==1) { ?> checked <?php } ?>  onChange="document.getElementById('p_edit').value='yes'"></td>
  </tr>
</table>
</div>
<div class="page_inside_frame">
  <table width="689" id="table_details_display">
    <tr>
      <td width="95">Requirements<br>
        BOS24:2009</td>
      <td colspan="2">Manufacturing<br>
        specification</td>
      <td colspan="7">Recordings</td>
      </tr>
    <tr>
      <td>&nbsp;</td>
      <td colspan="2">&nbsp;</td>
      <td width="36" align="center">Tile</td>
      <td width="68" align="center">1</td>
      <td width="72" align="center">2</td>
      <td width="68" align="center">3</td>
      <td width="65" align="center">4</td>
      <td width="56" align="center">5</td>
      <td width="63" align="center">6</td>
      </tr>
    <tr>
      <td rowspan="2">Hanging lengths</td>
      <td colspan="2" rowspan="2">400mm &plusmn;4mm</td>
      <td align="center">L2</td>
      <td align="center"><input type="text" name="length_L2_1" id="length_L2_1" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $length_L2_1 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"></td>
      <td align="center"><input type="text" name="length_L2_2" id="length_L2_2" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $length_L2_2 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"></td>
      <td align="center"><input type="text" name="length_L2_3" id="length_L2_3" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $length_L2_3 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"></td>
      <td align="center"><input type="text" name="length_L2_4" id="length_L2_4" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $length_L2_4 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"></td>
      <td align="center"><input type="text" name="length_L2_5" id="length_L2_5" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $length_L2_5 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"></td>
      <td align="center"><input type="text" name="length_L2_6" id="length_L2_6" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $length_L2_6 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"></td>
      </tr>
    <tr>
      <td align="center">L3</td>
      <td align="center"><input type="text" name="length_L3_1" id="length_L3_1" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $length_L3_1 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"></td>
      <td align="center"><input type="text" name="length_L3_2" id="length_L3_2" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $length_L3_2 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"></td>
      <td align="center"><input type="text" name="length_L3_3" id="length_L3_3" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $length_L3_3 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"></td>
      <td align="center"><input type="text" name="length_L3_4" id="length_L3_4" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $length_L3_4 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"></td>
      <td align="center"><input type="text" name="length_L3_5" id="length_L3_5" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $length_L3_5 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"></td>
      <td align="center"><input type="text" name="length_L3_6" id="length_L3_6" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $length_L3_6 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"></td>
      </tr>
    <tr>
      <td>Squarness</td>
      <td colspan="2">L1 = 400mm &plusmn;4mm</td>
      <td align="center">L1</td>
      <td align="center"><input type="text" name="length_L1_1" id="length_L1_1" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $length_L1_1 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"></td>
      <td align="center"><input type="text" name="length_L1_2" id="length_L1_2" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $length_L1_2 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"></td>
      <td align="center"><input type="text" name="length_L1_3" id="length_L1_3" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $length_L1_3 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"></td>
      <td align="center"><input type="text" name="length_L1_4" id="length_L1_4" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $length_L1_4 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"></td>
      <td align="center"><input type="text" name="length_L1_5" id="length_L1_5" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $length_L1_5 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"></td>
      <td align="center"><input type="text" name="length_L1_6" id="length_L1_6" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $length_L1_6 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"></td>
      </tr>
    <tr>
      <td>Flatness</td>
      <td colspan="2">3 mm max pass/fail</td>
      <td>&nbsp;</td>
      <td align="center"><div style="float:left; background-color:#090; width:22px;"><input type="checkbox" name="flatness_1a"  id="flatness_1a" <?php if ($flatness_1==1) { ?> checked <?php } ?>  onChange="if (document.getElementById('flatness_1a').checked=true) {document.getElementById('flatness_1b').checked=false;} document.getElementById('p_edit').value='yes' "></div>
                       <div style="float:left; background-color:#F00; width:22px;"><input type="checkbox" name="flatness_1b" id="flatness_1b" <?php if ($flatness_1==2) { ?> checked <?php } ?>  onChange="if (document.getElementById('flatness_1b').checked=true) {document.getElementById('flatness_1a').checked=false;} document.getElementById('p_edit').value='yes' "></div>
              <img src="../images/clear.png" width="10" height="10" style="cursor:pointer;"  onClick="document.getElementById('flatness_1a').checked=false; document.getElementById('flatness_1b').checked=false; document.getElementById('p_edit').value='yes' "></td>
    <td align="center"><div style="float:left; background-color:#090; width:22px;"><input type="checkbox" name="flatness_2a"  id="flatness_2a" <?php if ($flatness_2==1) { ?> checked <?php } ?>  onChange="if (document.getElementById('flatness_2a').checked=true) {document.getElementById('flatness_2b').checked=false;} document.getElementById('p_edit').value='yes' "></div>
                       <div style="float:left; background-color:#F00; width:22px;"><input type="checkbox" name="flatness_2b" id="flatness_2b" <?php if ($flatness_2==2) { ?> checked <?php } ?>  onChange="if (document.getElementById('flatness_2b').checked=true) {document.getElementById('flatness_2a').checked=false;} document.getElementById('p_edit').value='yes' "></div>
              <img src="../images/clear.png" width="10" height="10" style="cursor:pointer;"  onClick="document.getElementById('flatness_2a').checked=false; document.getElementById('flatness_2b').checked=false; document.getElementById('p_edit').value='yes' "></td>
    <td align="center"><div style="float:left; background-color:#090; width:22px;"><input type="checkbox" name="flatness_3a"  id="flatness_3a" <?php if ($flatness_3==1) { ?> checked <?php } ?>  onChange="if (document.getElementById('flatness_3a').checked=true) {document.getElementById('flatness_3b').checked=false;} document.getElementById('p_edit').value='yes' "></div>
                       <div style="float:left; background-color:#F00; width:22px;"><input type="checkbox" name="flatness_3b" id="flatness_3b" <?php if ($flatness_3==2) { ?> checked <?php } ?>  onChange="if (document.getElementById('flatness_3b').checked=true) {document.getElementById('flatness_3a').checked=false;} document.getElementById('p_edit').value='yes' "></div>
              <img src="../images/clear.png" width="10" height="10" style="cursor:pointer;"  onClick="document.getElementById('flatness_3a').checked=false; document.getElementById('flatness_3b').checked=false; document.getElementById('p_edit').value='yes' "></td>
    <td align="center"><div style="float:left; background-color:#090; width:22px;"><input type="checkbox" name="flatness_4a"  id="flatness_4a" <?php if ($flatness_4==1) { ?> checked <?php } ?>  onChange="if (document.getElementById('flatness_4a').checked=true) {document.getElementById('flatness_4b').checked=false;} document.getElementById('p_edit').value='yes' "></div>
                       <div style="float:left; background-color:#F00; width:22px;"><input type="checkbox" name="flatness_4b" id="flatness_4b" <?php if ($flatness_4==2) { ?> checked <?php } ?>  onChange="if (document.getElementById('flatness_4b').checked=true) {document.getElementById('flatness_4a').checked=false;} document.getElementById('p_edit').value='yes' "></div>
              <img src="../images/clear.png" width="10" height="10" style="cursor:pointer;"  onClick="document.getElementById('flatness_4a').checked=false; document.getElementById('flatness_4b').checked=false; document.getElementById('p_edit').value='yes' "></td>
    <td align="center"><div style="float:left; background-color:#090; width:22px;"><input type="checkbox" name="flatness_5a"  id="flatness_5a" <?php if ($flatness_5==1) { ?> checked <?php } ?>  onChange="if (document.getElementById('flatness_5a').checked=true) {document.getElementById('flatness_5b').checked=false;} document.getElementById('p_edit').value='yes' "></div>
                       <div style="float:left; background-color:#F00; width:22px;"><input type="checkbox" name="flatness_5b" id="flatness_5b" <?php if ($flatness_5==2) { ?> checked <?php } ?>  onChange="if (document.getElementById('flatness_5b').checked=true) {document.getElementById('flatness_5a').checked=false;} document.getElementById('p_edit').value='yes' "></div>
              <img src="../images/clear.png" width="10" height="10" style="cursor:pointer;"  onClick="document.getElementById('flatness_5a').checked=false; document.getElementById('flatness_5b').checked=false; document.getElementById('p_edit').value='yes' "></td>
    <td align="center"><div style="float:left; background-color:#090; width:22px;"><input type="checkbox" name="flatness_6a"  id="flatness_6a" <?php if ($flatness_6==1) { ?> checked <?php } ?>  onChange="if (document.getElementById('flatness_6a').checked=true) {document.getElementById('flatness_6b').checked=false;} document.getElementById('p_edit').value='yes' "></div>
                       <div style="float:left; background-color:#F00; width:22px;"><input type="checkbox" name="flatness_6b" id="flatness_6b" <?php if ($flatness_6==2) { ?> checked <?php } ?>  onChange="if (document.getElementById('flatness_6b').checked=true) {document.getElementById('flatness_6a').checked=false; } document.getElementById('p_edit').value='yes' "></div>
              <img src="../images/clear.png" width="10" height="10" style="cursor:pointer;"  onClick="document.getElementById('flatness_6a').checked=false; document.getElementById('flatness_6b').checked=false; document.getElementById('p_edit').value='yes' "></td>
    <tr>
      <td>Cover width</td>
      <td width="56">profiled</td>
      <td width="66">flat</td>
      <td>&nbsp;</td>
      <td>Prof C wc</td>
      <td>Prof C wd</td>
      <td>Prof C w</td>
      <td>Flat C wc</td>
      <td>Flat C wd</td>
      <td>Flat C w</td>
      </tr>
    <tr>
      <td>&nbsp;</td>
      <td>334 mm<br>        &plusmn;4mm <br></td>
      <td>334 mm<br>
&plusmn;5mm </td>
      <td>&nbsp;</td>
      <td><?php if ($type!='SL') { ?><input type="text" name="width_1" id="width_1" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\..).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $width_1 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"><?php } else { echo '&nbsp;&nbsp;&nbsp;---'; } ?></td>
      <td><?php if ($type!='SL') { ?><input type="text" name="width_2" id="width_2" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\..).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $width_2 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"><?php } else { echo '&nbsp;&nbsp;&nbsp;---'; } ?></td>
      <td><?php if ($type!='SL') { ?><input type="text" name="width_3" id="width_3" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\..).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $width_3 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"><?php } else { echo '&nbsp;&nbsp;&nbsp;---'; } ?></td>
      <td><?php if ($type=='SL') { ?><input type="text" name="width_4" id="width_4" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\..).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $width_4 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"><?php } else { echo '&nbsp;&nbsp;&nbsp;---'; } ?></td>
      <td><?php if ($type=='SL') { ?><input type="text" name="width_5" id="width_5" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\..).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $width_5 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"><?php } else { echo '&nbsp;&nbsp;&nbsp;---'; } ?></td>
      <td><?php if ($type=='SL') { ?><input type="text" name="width_6" id="width_6" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\..).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $width_6 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"><?php } else { echo '&nbsp;&nbsp;&nbsp;---'; } ?></td>
      </tr>
    <tr>
      <td>Nail hole</td>
      <td colspan="2">14-20 mm</td>
      <td>&nbsp;</td>
      <td><?php if ($type!='SL') { ?><input type="text" name="nail_1" id="nail_1" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="2" value="<?php echo $nail_1 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"><?php } else { echo '&nbsp;&nbsp;&nbsp;---'; } ?></td>
      <td><?php if ($type!='SL') { ?><input type="text" name="nail_2" id="nail_2" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="2" value="<?php echo $nail_2 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"><?php } else { echo '&nbsp;&nbsp;&nbsp;---'; } ?></td>
      <td><?php if ($type!='SL') { ?><input type="text" name="nail_3" id="nail_3" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="2" value="<?php echo $nail_3 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"><?php } else { echo '&nbsp;&nbsp;&nbsp;---'; } ?></td>
      <td><?php if ($type=='SL') { ?><input type="text" name="nail_4" id="nail_4" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="2" value="<?php echo $nail_4 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"><?php } else { echo '&nbsp;&nbsp;&nbsp;---'; } ?></td>
      <td><?php if ($type=='SL') { ?><input type="text" name="nail_5" id="nail_5" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="2" value="<?php echo $nail_5 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"><?php } else { echo '&nbsp;&nbsp;&nbsp;---'; } ?></td>
      <td><?php if ($type=='SL') { ?><input type="text" name="nail_6" id="nail_6" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="2" value="<?php echo $nail_6 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"><?php } else { echo '&nbsp;&nbsp;&nbsp;---'; } ?></td>
      </tr>
    <tr>
      <td>Rain penetration</td>
      <td colspan="2">pass/fail</td>
      <td>&nbsp;</td>
      <td align="center"><div style="float:left; background-color:#090; width:22px;"><input type="checkbox" name="rain_1a"  id="rain_1a" <?php if ($rain_1==1) { ?> checked <?php } ?>  onChange="if (document.getElementById('rain_1a').checked=true) {document.getElementById('rain_1b').checked=false;} document.getElementById('p_edit').value='yes' "></div>
                       <div style="float:left; background-color:#F00; width:22px;"><input type="checkbox" name="rain_1b" id="rain_1b" <?php if ($rain_1==2) { ?> checked <?php } ?>  onChange="if (document.getElementById('rain_1b').checked=true) {document.getElementById('rain_1a').checked=false;} document.getElementById('p_edit').value='yes' "></div>
              <img src="../images/clear.png" width="10" height="10" style="cursor:pointer;"  onClick="document.getElementById('rain_1a').checked=false; document.getElementById('rain_1b').checked=false; document.getElementById('p_edit').value='yes' "></td>
    <td align="center"><div style="float:left; background-color:#090; width:22px;"><input type="checkbox" name="rain_2a"  id="rain_2a" <?php if ($rain_2==1) { ?> checked <?php } ?>  onChange="if (document.getElementById('rain_2a').checked=true) {document.getElementById('rain_2b').checked=false;} document.getElementById('p_edit').value='yes' "></div>
                       <div style="float:left; background-color:#F00; width:22px;"><input type="checkbox" name="rain_2b" id="rain_2b" <?php if ($rain_2==2) { ?> checked <?php } ?>  onChange="if (document.getElementById('rain_2b').checked=true) {document.getElementById('rain_2a').checked=false;} document.getElementById('p_edit').value='yes' "></div>
              <img src="../images/clear.png" width="10" height="10" style="cursor:pointer;"  onClick="document.getElementById('rain_2a').checked=false; document.getElementById('rain_2b').checked=false; document.getElementById('p_edit').value='yes' "></td>
    <td align="center"><div style="float:left; background-color:#090; width:22px;"><input type="checkbox" name="rain_3a"  id="rain_3a" <?php if ($rain_3==1) { ?> checked <?php } ?>  onChange="if (document.getElementById('rain_3a').checked=true) {document.getElementById('rain_3b').checked=false;} document.getElementById('p_edit').value='yes' "></div>
                       <div style="float:left; background-color:#F00; width:22px;"><input type="checkbox" name="rain_3b" id="rain_3b" <?php if ($rain_3==2) { ?> checked <?php } ?>  onChange="if (document.getElementById('rain_3b').checked=true) {document.getElementById('rain_3a').checked=false;} document.getElementById('p_edit').value='yes' "></div>
              <img src="../images/clear.png" width="10" height="10" style="cursor:pointer;"  onClick="document.getElementById('rain_3a').checked=false; document.getElementById('rain_3b').checked=false; document.getElementById('p_edit').value='yes' "></td>
    <td align="center"><div style="float:left; background-color:#090; width:22px;"><input type="checkbox" name="rain_4a"  id="rain_4a" <?php if ($rain_4==1) { ?> checked <?php } ?>  onChange="if (document.getElementById('rain_4a').checked=true) {document.getElementById('rain_4b').checked=false;} document.getElementById('p_edit').value='yes' "></div>
                       <div style="float:left; background-color:#F00; width:22px;"><input type="checkbox" name="rain_4b" id="rain_4b" <?php if ($rain_4==2) { ?> checked <?php } ?>  onChange="if (document.getElementById('rain_4b').checked=true) {document.getElementById('rain_4a').checked=false;} document.getElementById('p_edit').value='yes' "></div>
              <img src="../images/clear.png" width="10" height="10" style="cursor:pointer;"  onClick="document.getElementById('rain_4a').checked=false; document.getElementById('rain_4b').checked=false; document.getElementById('p_edit').value='yes' "></td>
    <td align="center"><div style="float:left; background-color:#090; width:22px;"><input type="checkbox" name="rain_5a"  id="rain_5a" <?php if ($rain_5==1) { ?> checked <?php } ?>  onChange="if (document.getElementById('rain_5a').checked=true) {document.getElementById('rain_5b').checked=false;} document.getElementById('p_edit').value='yes' "></div>
                       <div style="float:left; background-color:#F00; width:22px;"><input type="checkbox" name="rain_5b" id="rain_5b" <?php if ($rain_5==2) { ?> checked <?php } ?>  onChange="if (document.getElementById('rain_5b').checked=true) {document.getElementById('rain_5a').checked=false;} document.getElementById('p_edit').value='yes' "></div>
              <img src="../images/clear.png" width="10" height="10" style="cursor:pointer;"  onClick="document.getElementById('rain_5a').checked=false; document.getElementById('rain_5b').checked=false; document.getElementById('p_edit').value='yes' "></td>
    <td align="center"><div style="float:left; background-color:#090; width:22px;"><input type="checkbox" name="rain_6a"  id="rain_6a" <?php if ($rain_6==1) { ?> checked <?php } ?>  onChange="if (document.getElementById('rain_6a').checked=true) {document.getElementById('rain_6b').checked=false;} document.getElementById('p_edit').value='yes' "></div>
                       <div style="float:left; background-color:#F00; width:22px;"><input type="checkbox" name="rain_6b" id="rain_6b" <?php if ($rain_6==2) { ?> checked <?php } ?>  onChange="if (document.getElementById('rain_6b').checked=true) {document.getElementById('rain_6a').checked=false; } document.getElementById('p_edit').value='yes' "></div>
              <img src="../images/clear.png" width="10" height="10" style="cursor:pointer;"  onClick="document.getElementById('rain_6a').checked=false; document.getElementById('rain_6b').checked=false; document.getElementById('p_edit').value='yes' "></td>
      </tr>
   </table>
<br>

   <table width="686" id="table_details_display">   
    <tr>
      <td>&nbsp;</td>
      <td colspan="4" align="center">One day</td>
      <td colspan="4" align="center" style="border-left:double;">Three days</td>
      <td colspan="4" align="center" style="border-left:double;">Seven days</td>
      </tr>
    <tr>
      <td width="41">Tile</td>
      <td width="49">Mass</td>
      <td width="49">Div</td>
      <td width="49">Kn</td>
      <td width="49">Thick</td>
      <td width="49" style="border-left:double;">Mass</td>
      <td width="49">Div</td>
      <td width="49">Kn</td>
      <td width="49">Thick</td>
      <td width="49" style="border-left:double;">Mass</td>
      <td width="49">Div</td>
      <td width="49">Kn</td>
      <td width="50">Thick</td>
      </tr>
    <tr>
      <td align="center">1</td>
      <td align="center"><input type="text" name="mass_1_1" id="mass_1_1" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $mass_1_1 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_mass_1();"></td>
      <td align="center"><input type="text" name="divisions_1_1" id="divisions_1_1" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $divisions_1_1 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_div_1();"></td>
      <td align="center"><input type="text" name="kn_1_1" id="kn_1_1" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $kn_1_1 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_kn_1();"></td>
      <td align="center"><input type="text" name="thickness_1_1" id="thickness_1_1" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\..).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $thickness_1_1 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_thick_1();"></td>
      <td align="center" style="border-left:double;"><input type="text" name="mass_2_1" id="mass_2_1" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $mass_2_1 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"  onBlur="ave_mass_2();"></td>
      <td align="center"><input type="text" name="divisions_2_1" id="divisions_2_1" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $divisions_2_1 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_div_2();"></td>
      <td align="center"><input type="text" name="kn_2_1" id="kn_2_1" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $kn_2_1 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_kn_2();"></td>
      <td align="center"><input type="text" name="thickness_2_1" id="thickness_2_1" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\..).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $thickness_2_1 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_thick_2();"></td>
      <td align="center" style="border-left:double;"><input type="text" name="mass_3_1" id="mass_3_1" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $mass_3_1 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_mass_3();"></td>
      <td align="center"><input type="text" name="divisions_3_1" id="divisions_3_1" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $divisions_3_1 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_div_3();"></td>
      <td align="center"><input type="text" name="kn_3_1" id="kn_3_1" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $kn_3_1 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_kn_3();"></td>
      <td align="center"><input type="text" name="thickness_3_1" id="thickness_3_1" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\..).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $thickness_3_1 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_thick_3();"></td>
      </tr>
    <tr>
      <td align="center">2</td>
      <td align="center"><input type="text" name="mass_1_2" id="mass_1_2" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $mass_1_2 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_mass_1();"></td>
      <td align="center"><input type="text" name="divisions_1_2" id="divisions_1_2" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $divisions_1_2 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_div_1();"></td>
      <td align="center"><input type="text" name="kn_1_2" id="kn_1_2" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $kn_1_2 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_kn_1();"></td>
      <td align="center"><input type="text" name="thickness_1_2" id="thickness_1_2" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\..).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $thickness_1_2 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_thick_1();"></td>
      <td align="center" style="border-left:double;"><input type="text" name="mass_2_2" id="mass_2_2" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $mass_2_2 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_mass_2();"></td>
      <td align="center"><input type="text" name="divisions_2_2" id="divisions_2_2" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $divisions_2_2 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_div_2();"></td>
      <td align="center"><input type="text" name="kn_2_2" id="kn_2_2" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $kn_2_2 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_kn_2();"></td>
      <td align="center"><input type="text" name="thickness_2_2" id="thickness_2_2" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\..).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $thickness_2_2 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_thick_2();"></td>
      <td align="center" style="border-left:double;"><input type="text" name="mass_3_2" id="mass_3_2" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $mass_3_2 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_mass_3();"></td>
      <td align="center"><input type="text" name="divisions_3_2" id="divisions_3_2" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $divisions_3_2 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_div_3();"></td>
      <td align="center"><input type="text" name="kn_3_2" id="kn_3_2" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $kn_3_2 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_kn_3();"></td>
      <td align="center"><input type="text" name="thickness_3_2" id="thickness_3_2" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\..).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $thickness_3_2 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_thick_3();"></td>
      </tr>
    <tr>
      <td align="center">3</td>
      <td align="center"><input type="text" name="mass_1_3" id="mass_1_3" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $mass_1_3 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_mass_1();"></td>
      <td align="center"><input type="text" name="divisions_1_3" id="divisions_1_3" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $divisions_1_3 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_div_1();"></td>
      <td align="center"><input type="text" name="kn_1_3" id="kn_1_3" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $kn_1_3 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_kn_1();"></td>
      <td align="center"><input type="text" name="thickness_1_3" id="thickness_1_3" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\..).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $thickness_1_3 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_thick_1();"></td>
      <td align="center" style="border-left:double;"><input type="text" name="mass_2_3" id="mass_2_3" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $mass_2_3 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_mass_2();"></td>
      <td align="center"><input type="text" name="divisions_2_3" id="divisions_2_3" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $divisions_2_3 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_div_2();"></td>
      <td align="center"><input type="text" name="kn_2_3" id="kn_2_3" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $kn_2_3 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_kn_2();"></td>
      <td align="center"><input type="text" name="thickness_2_3" id="thickness_2_3" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\..).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $thickness_2_3 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_thick_2();"></td>
      <td align="center" style="border-left:double;"><input type="text" name="mass_3_3" id="mass_3_3" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $mass_3_3 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_mass_3();"></td>
      <td align="center"><input type="text" name="divisions_3_3" id="divisions_3_3" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $divisions_3_3 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_div_3();"></td>
      <td align="center"><input type="text" name="kn_3_3" id="kn_3_3" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $kn_3_3 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_kn_3();"></td>
      <td align="center"><input type="text" name="thickness_3_3" id="thickness_3_3" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\..).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $thickness_3_3 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_thick_3();"></td>
      </tr>
    <tr>
      <td align="center">4</td>
      <td align="center"><input type="text" name="mass_1_4" id="mass_1_4" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $mass_1_4 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_mass_1();"></td>
      <td align="center"><input type="text" name="divisions_1_4" id="divisions_1_4" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $divisions_1_4 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_div_1();"></td>
      <td align="center"><input type="text" name="kn_1_4" id="kn_1_4" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $kn_1_4 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_kn_1();"></td>
      <td align="center"><input type="text" name="thickness_1_4" id="thickness_1_4" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\..).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $thickness_1_4 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_thick_1();"></td>
      <td align="center" style="border-left:double;"><input type="text" name="mass_2_4" id="mass_2_4" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $mass_2_4 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_mass_2();"></td>
      <td align="center"><input type="text" name="divisions_2_4" id="divisions_2_4" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $divisions_2_4 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_div_2();"></td>
      <td align="center"><input type="text" name="kn_2_4" id="kn_2_4" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $kn_2_4 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"  onBlur="ave_kn_2();"></td>
      <td align="center"><input type="text" name="thickness_2_4" id="thickness_2_4" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\..).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $thickness_2_4 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_thick_2();"></td>
      <td align="center" style="border-left:double;"><input type="text" name="mass_3_4" id="mass_3_4" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $mass_3_4 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_mass_3();"></td>
      <td align="center"><input type="text" name="divisions_3_4" id="divisions_3_4" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $divisions_3_4 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_div_3();"></td>
      <td align="center"><input type="text" name="kn_3_4" id="kn_3_4" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $kn_3_4 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_kn_3();"></td>
      <td align="center"><input type="text" name="thickness_3_4" id="thickness_3_4" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\..).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $thickness_3_4 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_thick_3();"></td>
      </tr>
    <tr>
      <td align="center">5</td>
      <td align="center"><input type="text" name="mass_1_5" id="mass_1_5" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $mass_1_5 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_mass_1();"></td>
      <td align="center"><input type="text" name="divisions_1_5" id="divisions_1_5" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $divisions_1_5 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_div_1();"></td>
      <td align="center"><input type="text" name="kn_1_5" id="kn_1_5" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $kn_1_5 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_kn_1();"></td>
      <td align="center"><input type="text" name="thickness_1_5" id="thickness_1_5" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\..).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $thickness_1_5 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_thick_1();"></td>
      <td align="center" style="border-left:double;"><input type="text" name="mass_2_5" id="mass_2_5" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $mass_2_5 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"  onBlur="ave_mass_2();"></td>
      <td align="center"><input type="text" name="divisions_2_5" id="divisions_2_5" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $divisions_2_5 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_div_2();"></td>
      <td align="center"><input type="text" name="kn_2_5" id="kn_2_5" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $kn_2_5 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"  onBlur="ave_kn_2();"></td>
      <td align="center"><input type="text" name="thickness_2_5" id="thickness_2_5" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\..).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $thickness_2_5 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_thick_2();"></td>
      <td align="center" style="border-left:double;"><input type="text" name="mass_3_5" id="mass_3_5" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $mass_3_5 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_mass_3();"></td>
      <td align="center"><input type="text" name="divisions_3_5" id="divisions_3_5" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $divisions_3_5 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_div_3();"></td>
      <td align="center"><input type="text" name="kn_3_5" id="kn_3_5" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $kn_3_5 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_kn_3();"></td>
      <td align="center"><input type="text" name="thickness_3_5" id="thickness_3_5" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\..).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $thickness_3_5 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_thick_3();"></td>
      </tr>
    <tr>
      <td align="center">6</td>
      <td align="center"><input type="text" name="mass_1_6" id="mass_1_6" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $mass_1_6 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_mass_1();"></td>
      <td align="center"><input type="text" name="divisions_1_6" id="divisions_1_6" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $divisions_1_6 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_div_1();"></td>
      <td align="center"><input type="text" name="kn_1_6" id="kn_1_6" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $kn_1_6 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_kn_1();"></td>
      <td align="center"><input type="text" name="thickness_1_6" id="thickness_1_6" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\..).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $thickness_1_6 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_thick_1();"></td>
      <td align="center" style="border-left:double;"><input type="text" name="mass_2_6" id="mass_2_6" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $mass_2_6 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"  onBlur="ave_mass_2();"></td>
      <td align="center"><input type="text" name="divisions_2_6" id="divisions_2_6" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $divisions_2_6 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_div_2();"></td>
      <td align="center"><input type="text" name="kn_2_6" id="kn_2_6" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $kn_2_6 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'"  onBlur="ave_kn_2();"></td>
      <td align="center"><input type="text" name="thickness_2_6" id="thickness_2_6" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\..).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $thickness_2_6 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_thick_2();"></td>
      <td align="center" style="border-left:double;"><input type="text" name="mass_3_6" id="mass_3_6" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $mass_3_6 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_mass_3();"></td>
      <td align="center"><input type="text" name="divisions_3_6" id="divisions_3_6" width="40px;" class="text40" autocomplete="off" onkeypress="return numbersonly(this, event)" style="text-align:right" maxlength="3" value="<?php echo $divisions_3_6 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_div_3();"></td>
      <td align="center"><input type="text" name="kn_3_6" id="kn_3_6" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $kn_3_6 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_kn_3();"></td>
      <td align="center"><input type="text" name="thickness_3_6" id="thickness_3_6" width="40px;" class="text40" autocomplete="off" onKeyPress="return isNumberKey(event)" onkeyup=" this.value = this.value.replace (/(\..).*/, '$1')" style="text-align:right" maxlength="5"  value="<?php echo $thickness_3_6 ?>" onfocus = "this.select();" onChange="document.getElementById('p_edit').value='yes'" onBlur="ave_thick_3();"></td>
      </tr>
    <tr style="background-color:#CEE0FD">
      <td align="center">Ave</td>
      <td align="center"><input type="text" name="mass_1_ave" id="mass_1_ave" width="40px;" class="text40" readonly style="text-align:right; background-color:transparent; border:hidden;"></td>
      <td align="center"><input type="text" name="div_1_ave" id="div_1_ave" width="40px;" class="text40" readonly style="text-align:right; background-color:transparent; border:hidden;" ></td>
      <td align="center"><input type="text" name="kn_1_ave" id="kn_1_ave" width="40px;" class="text40" readonly style="text-align:right; background-color:transparent; border:hidden;" ></td>
      <td align="center"><input type="text" name="thick_1_ave" id="thick_1_ave" width="40px;" class="text40" readonly style="text-align:right; background-color:transparent; border:hidden;" ></td>
      <td align="center" style="border-left:double;"><input type="text" name="mass_2_ave" id="mass_2_ave" width="40px;" class="text40" readonly style="text-align:right; background-color:transparent; border:hidden;" ></td>
      <td align="center"><input type="text" name="div_2_ave" id="div_2_ave" width="40px;" class="text40" readonly style="text-align:right; background-color:transparent; border:hidden;" ></td>
      <td align="center"><input type="text" name="kn_2_ave" id="kn_2_ave" width="40px;" class="text40" readonly style="text-align:right; background-color:transparent; border:hidden;" ></td>
      <td align="center"><input type="text" name="thick_2_ave" id="thick_2_ave" width="40px;" class="text40" readonly style="text-align:right; background-color:transparent; border:hidden;" ></td>
      <td align="center" style="border-left:double;"><input type="text" name="mass_3_ave" id="mass_3_ave" width="40px;" class="text40" readonly style="text-align:right; background-color:transparent; border:hidden;" ></td>
      <td align="center"><input type="text" name="div_3_ave" id="div_3_ave" width="40px;" class="text40" readonly style="text-align:right; background-color:transparent; border:hidden;" ></td>
      <td align="center"><input type="text" name="kn_3_ave" id="kn_3_ave" width="40px;" class="text40" readonly style="text-align:right; background-color:transparent; border:hidden;" ></td>
      <td align="center"><input type="text" name="thick_3_ave" id="thick_3_ave" width="40px;" class="text40" readonly style="text-align:right; background-color:transparent; border:hidden;" ></td>
    </tr>
    <tr>
      <td colspan="13" valign="top">Profiled: Ave=5.0N Min=4.5N Mass 4.23 - 5.17&nbsp;&nbsp;&nbsp;&nbsp;Flat: Ave=4.0N Min=3.5N 
        Mass=4.68-5.72</td>
      </tr>
   </table>
</div>
<div class="page_inside_frame">
  <table width="689" id="table_details_display"> 
    <tr>
      <td width="217">Release for delivery day 1:</td>
      <td width="348"><?php

		$myCalendar = new tc_calendar("release_1_date", true);
		$myCalendar->setIcon("../images/iconCalendar.gif");
		$myCalendar->setDate($d1, $m1, $y1);
		$myCalendar->setPath("./");
		$myCalendar->setYearInterval(2015, 2090);
		$myCalendar->writeScript();
?></td>
      <td width="95">&nbsp;</td>
    </tr>
    <tr>
      <td>Release for delivery day 3: </td>
      <td><?php

		$myCalendar = new tc_calendar("release_3_date", true);
		$myCalendar->setIcon("../images/iconCalendar.gif");
		$myCalendar->setDate($d3, $m3, $y3);
		$myCalendar->setPath("./");
		$myCalendar->setYearInterval(2015, 2090);
		$myCalendar->writeScript();
?></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>Release for delivery day 7:</td>
      <td><?php

		$myCalendar = new tc_calendar("release_7_date", true);
		$myCalendar->setIcon("../images/iconCalendar.gif");
		$myCalendar->setDate($d7, $m7, $y7);
		$myCalendar->setPath("./");
		$myCalendar->setYearInterval(2015, 2090);
		$myCalendar->writeScript();
?></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td align="right">Remarks:&nbsp;&nbsp;</td>
      <td colspan="2"><textarea name="remarks" cols="60" rows="4" class="text_box" id="remarks" onkeyup="this.value=this.value.replace(/[']/g,'-');"></textarea></td>
    </tr>
  </table>
</div>
<div class="page_inside_frame">
  <table width="645" border="0">
    <tr>
      <td width="114"><a href="../include/dry_tiles_alert.php?report_no=<?php echo $report_no ?>" onClick="needToConfirm = false;"><input type="button" name="request_button" id="request_button" value="Request approval" class="imagebutton"></a></td>
      <td width="521" align="right">
        <input name="p_edit" id="p_edit" type="hidden" value="no">
        <input type="hidden" name="report_no2" id="report_no2" value="<?php echo $report_no ?>">
        <input name="button2" type="button" class="imagebutton" id="button2" onClick="if (document.getElementById('p_edit').value=='yes') { cancel_confirmation(3, '../quality/quality_main.php?date=&branch=&subCatSelect=Tiles');} else {needToConfirm = false; window.location='../quality/quality_main.php?date=&branch=&subCatSelect=Tiles';}" value="Close"/>
        <input name="save_button"  id="save_button" type="submit" class="imagebutton" value="Save" onClick="needToConfirm = false; confirmRefresh();" />
        <input name="save_close_button"  id="save_close_button" type="submit" class="imagebutton" value="Save &amp; Close" onClick="needToConfirm = false; confirmRefresh();" /></td>
    </tr>
  </table>
 
</div> 
</div>
</form>
</div>

<?php include ('../navigation/side_bar.php'); ?>
</body>

<?php } else { ?>
<script> needToConfirm = false; </script>
<?php
    $_SESSION['denied_return'] = "quality/quality_main.php";	
    include ("../navigation/quality_sidebar.php");?>
    <?php include ('../navigation/side_bar.php'); ?>
	<body onLoad="accessdenied(); return false">	
	</body>
<?php }
?>
</html>