<?php

function draw_job($job_id,$connection){
	echo "<table width='490px'>
		<col width='30px'><col width='30px'>
		<col width='150px'><col width='250px'>
		<col width='30px'>
		<tr height='20px' class='Search-Label-bg'>
			<td  align='center' ><span class='style44'></span></td>
			<td  align='center' ><span class='style44'></td>			
			<td align='center'><span class='style44'>job code</span></td>
			<td align='center'><span class='style44'>job description</span></td>
			<td  align='center' ><span class='style44'></span></td>
		</tr>";
	if($job_id != ''){
		$query = "select Job_code, Job_description from jobs where job_id = $job_id";
		$res = mysql_query($query, $connection);
		$row = mysql_fetch_row($res);
		$newjobcode = $row[0];
		$newdescription = $row[1];
	}	
	echo "<tr height='20px'>";
		echo"<td align = 'center'></td>";
		echo"<td align = 'center' >	
			<img src='img/undo-1.png' onmouseover=\"style.cursor='pointer'\" title=Clear' onclick=\"clearJob();\" style='cursor: pointer;' height='20' width='20'></span>
		</td>";
		echo "<td ><input type='text' value= '$newjobcode' name='newjobcode' id='newjobcode' style='width: 145px;'></td>";
		echo "<td ><input type='text' value= '$newdescription' name='newdescription' id='newdescription' style='width: 245px;' ></td>";
		echo"<td align = 'center' >
			<input id='imgSubmit_1' onclick=\"insertjob('$job_id'); return false;\" title='Submit Record' style='width:20px; height:20px; vertical-align:bottom; cursor:pointer; outline:none; border:0px; background-image:url(img/confirm-1.png)' type='button'>
		</td>";
	echo "</tr>";
	echo "<tr height='15px'><td></td></tr>";
					////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	$jobquery="select Job_id, Job_code, Job_description from jobs";
	
	$jobs=mysql_query($jobquery, $connection);
	$i=0;
	echo "<tr><td colspan='5'><div style='overflow-y: scroll;overflow-x: hidden;height:300px;'><table border='0' cellspaving=0 cellpadding=0>
		<col width='30px'><col width='30px'>
		<col width='150px'><col width='250px'>
		<col width='30px'>";
	while($jobresult=mysql_fetch_array($jobs)){
		if($i%2==0)
			$Color="background-color:#E6E6E6;";
		else			
			$Color="background-color:#F7F7F7;";	
		if($job_id == $jobresult[0]) $Color="background-color:#1e87a5;";
		
		echo "<tr height='20px' style='$Color'>";
		echo"<td align = 'center'><img src='img/delete.png' onmouseover=\"style.cursor='pointer'\" name='' title='Delete' onclick=\" deletejob('$jobresult[0]');\"></td>";
		echo"<td align = 'center' ><img src='img/edit.png' onmouseover=\"style.cursor='pointer'\"  title='Save' onclick=\"getjob('$jobresult[0]');\"></td>";
		echo "<td >$jobresult[1]</td>";
		echo "<td >$jobresult[2]</td>";
		echo "<td></td>";
		echo "</tr>";
		$i++;
	}
	echo "</table></div></td></tr>";
		//////////////////////////////////////////////////////////////////////////////////
		echo "</table>";
}


function draw_ship($id,$message,$connection){
	if($message!=''){
		$message='Check Ledger Number';
	}
	echo "<table width='490px'>
		<col width='30px'><col width='30px'>
		<col width='150px'><col width='250px'><col width='250px'>
		<col width='30px'>
		<tr height='20px' class='Search-Label-bg'>
			<td  align='center' ><span class='style44'></span></td>
			<td  align='center' ><span class='style44'></td>			
			<td align='center'><span class='style44'>Ledger Number</span></td>
			<td align='center'><span class='style44'>Expences Ledger</span></td>
			<td align='center'><span class='style44'>Income Ledger</span></td>
			<td  align='center' ><span class='style44'></span></td>
		</tr>";
	if($id != ''){
		$query = "select Ledger_number, Expences_ledger, Income_ledger from ShipmentClosing_setup where id = $id";
		$res = mysql_query($query, $connection);
		$row = mysql_fetch_row($res);
		$Ledger_number = $row[0];
		$Expences_ledger = $row[1];
		$Income_ledger = $row[2];
	}	
	echo "<tr height='20px'>";
		echo"<td align = 'center'></td>";
		echo"<td align = 'center' >	
			<img src='img/undo-1.png' onmouseover=\"style.cursor='pointer'\" title=Clear' onclick=\"clearship();\" style='cursor: pointer;' height='20' width='20'></span>
		</td>";
		echo "<td ><input type='text' value= '$Ledger_number' name='Ledger_number' id='Ledger_number' style='width: 145px;'></td>";
		echo "<td ><input type='text' value= '$Expences_ledger' name='Expences_ledger' id='Expences_ledger' style='width: 245px;' ></td>";
		echo "<td ><input type='text' value= '$Income_ledger' name='Income_ledger' id='Income_ledger' 	style='width: 245px;' ></td>";
		echo"<td align = 'center' >
			<input id='imgSubmit_1' onclick=\"insertship('$id'); return false;\" title='Submit Record' style='width:20px; height:20px; vertical-align:bottom; cursor:pointer; outline:none; border:0px; background-image:url(img/confirm-1.png)' type='button'>
		</td>";
	echo "</tr>";
	echo "<tr height='15px'><td colspan='5' align='center'><font color='red'><b>$message</b></font></td></tr>";
					////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	$shipquery="select id, Ledger_number, Expences_ledger, Income_ledger from ShipmentClosing_setup order by Ledger_number;";
	
	$ship=mysql_query($shipquery, $connection);
	$i=0;
	$k=1;
	echo "<tr><td colspan='5'><div style='overflow-y: scroll;overflow-x: hidden;height:700px;'><table border='0' cellspaving=0 cellpadding=0>
		<col width='30px'><col width='30px'><col width='30px'>
		<col width='150px'><col width='250px'><col width='250px'>
		";
	while($shipresult=mysql_fetch_array($ship)){
		if($i%2==0)
			$Color="background-color:#E6E6E6;";
		else			
			$Color="background-color:#F7F7F7;";	
		if($job_id == $shipresult[0]) $Color="background-color:#1e87a5;";
		
		echo "<tr height='20px' style='$Color'>";
		echo"<td align = 'center'><b>$k</b></td>";
		echo"<td align = 'center'><img src='img/delete.png' onmouseover=\"style.cursor='pointer'\" name='' title='Delete' onclick=\" deleteship('$shipresult[0]');\"></td>";
		echo"<td align = 'center' ><img src='img/edit.png' onmouseover=\"style.cursor='pointer'\"  title='Save' onclick=\"getship('$shipresult[0]');\"></td>";
		echo "<td >$shipresult[1]</td>";
		echo "<td >$shipresult[2]</td>";
		echo "<td >$shipresult[3]</td>";
		
		echo "</tr>";

		$k++;
		$i++;
	}
	echo "</table></div></td></tr>";
		//////////////////////////////////////////////////////////////////////////////////
		echo "</table>";
}


function draw_company($company_code, $connection){
echo "<table width='540px'>
	<col width='30px'><col width='30px'>
	<col width='150px'><col width='300px'>
	<col width='30px'>
	<tr class='Search-Label-bg'>
	<td  align='center' ><span class='style4'></span></td>
	<td  align='center' ><span class='style4'></span></td>
	<td align='center'><span class='style4'>company code</span></td>
	<td align='center'><span class='style4'>company name</span></td>
	<td  align='center' ><span class='style4'></span></td>
	</tr>";
	if($company_code != ''){
		$query="select Company_name from staff_company where Company_code='$company_code';";
		$res=mysql_query($query, $connection);
		$row = mysql_fetch_row($res);
		$newcompanyname = $row[0];
	}
	echo "<tr height='20px'>";
	echo"<td align = 'center'></td>";
	echo"<td align = 'center' >
		<img src='img/undo-1.png' onmouseover=\"style.cursor='pointer'\" title=Clear' onclick=\"clearCompany();\" style='cursor: pointer;' height='20' width='20'></span>
	</td>";
	echo "<td ><input type='text' value= '$company_code' name='newcompanycode' id='newcompanycode' style='width: 150px;' ></td>";
	echo "<td ><input type='text' value= '$newcompanyname' name='newcompanyname' id='newcompanyname' style='width: 300px;'></td>";
	echo"<td align = 'center' >
			<input id='imgSubmit_1' onclick=\"insertcompany('$company_code'); return false;\" title='Submit Record' style='width:20px; height:20px; vertical-align:bottom; cursor:pointer; outline:none; border:0px; background-image:url(img/confirm-1.png)' type='button'>
		</td>";
	echo "</tr>";
	echo "<tr height='15px'><td></td></tr>";
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	echo "<tr><td colspan='5'><div style='overflow-y: scroll;overflow-x: hidden;height:300px;'>
		<table border='0' cellspaving=0 cellpadding=0 width='540px'>
		<col width='30px'><col width='30px'>
		<col width='150px'><col width='300px'>
		<col width='30px'>";
	$companyquery="select Company_code, Company_name from staff_company ";
	
	$companyquery=mysql_query($companyquery, $connection);
	$i=0;
	while($companyresult=mysql_fetch_array($companyquery)){
		if($i%2==0)
			$Color="background-color:#E6E6E6;";
		else			
			$Color="background-color:#F7F7F7;";	
		if($job_id == $companyresult[0]) $Color="background-color:#1e87a5;";
		
		echo "<tr height='20px' style='$Color'>";
		echo"<td align = 'center'><img src='img/delete.png' onmouseover=\"style.cursor='pointer'\" name='' title='Delete' onclick=\" deletecompany('$companyresult[0]')\"></td>";
		echo"<td align = 'center' ><img src='img/edit.png' onmouseover=\"style.cursor='pointer'\" id = 'imgSubmit' name='imgSubmit' title='Save' onclick=\"getcompany('$companyresult[0]')\"></td>";
		echo "<td >$companyresult[0]</td>";
		echo "<td >$companyresult[1]</td>";
		echo "</tr>";
		$i++;
		
	
	}
	echo "</table></div></td></tr>";
	//////////////////////////////////////////////////////////////////////////////////
	echo "</table>";
}
function draw_bank($bank_id, $connection){
echo "<table width='1080px'>
<col width='20px'><col width='20px'>
<col width='120px'><col width='150px'>
<col width='90px'><col width='90px'>
<col width='90px'><col width='100px'>
<col width='90px'><col width='90px'>
<col width='50px'><col width='50px'>
<col width='100px'><col width='20px'>
<tr class='Search-Label-bg'>
	<td  align='center' ><span class='style44'></span></td>
	<td  align='center' ><span class='style44'></span></td>";
echo"<td align='center'><span class='style44'>Bank name</span></td>
    <td align='center'><span class='style44'>Bank Branch</span>
	<td align='center'><span class='style44'>Telephone 1</span>
	<td align='center'><span class='style44'>Telephone 2</span>
	<td align='center'><span class='style44'>Fax</span></td>
	<td align='center'><span class='style44'>Address</span></td>
	<td align='center'><span class='style44'>Email</span></td>
	<td align='center'><span class='style44'>Website</span></td>
	<td align='center'><span class='style44'>Credit Limit 1</span></td>
	<td align='center'><span class='style44'>Credit Limit 2</span></td>
	<td align='center'><span class='style44'>Branch Owner</span></td>";
echo"<td align = 'center' ></td>";	
echo "</tr>";
if($bank_id != ''){
		$query = "select bank_Name, Bank_Branch, Bank_Telephone1, Bank_Telephone2, Bank_Fax, Bank_Address, Bank_Email, 
				Bank_Website, Bank_creditlimit1, Bank_creditlimit2, Owner_Branch 
				from banks where Bank_ID = $bank_id"; 
		$res = mysql_query($query, $connection);
		$row = mysql_fetch_row($res);
		$newjobcode 		= $row[0];
		$newdescription 	= $row[1];
		$Bank_Telephone1 	= $row[2];
		$Bank_Telephone2 	= $row[3];
		$Bank_Fax 			= $row[4]; 
		$Bank_Address 		= $row[5];
		$Bank_Email 		= $row[6];
		$Bank_Website 		= $row[7];
		$Bank_creditlimit1 	= $row[8];
		$Bank_creditlimit2 	= $row[9];
		$Owner_Branch 		= $row[10];
		
	}	
echo "<tr height='20px'>";
echo"<td align = 'center'></td>";
echo"<td align = 'center' >
	<img src='img/undo-1.png' onmouseover=\"style.cursor='pointer'\" title=Clear' onclick=\"clearBank();\" style='cursor: pointer;' height='20' width='20'></span></td>";
echo "<td ><input type='text' value= '$newjobcode' name='newbankname' id='newbankname' style='width:120px;'></td>";
echo "<td ><input type='text' value= '$newdescription' name='newbankbranch' id='newbankbranch' style='width:150px;'></td>";
echo "<td ><input type='text' value= '$Bank_Telephone1' name='Bank_Telephone1' id='Bank_Telephone1' style='width:90px;'></td>";
echo "<td ><input type='text' value= '$Bank_Telephone2' name='Bank_Telephone2' id='Bank_Telephone2' style='width:90px;'></td>";
echo "<td ><input type='text' value= '$Bank_Fax' name='Bank_Fax' id='Bank_Fax' style='width:90px;'></td>";
echo "<td ><input type='text' value= '$Bank_Address' name='Bank_Address' id='Bank_Address' style='width:100px;'></td>";
echo "<td ><input type='text' value= '$Bank_Email' name='Bank_Email' id='Bank_Email' style='width:90px;'></td>";
echo "<td ><input type='text' value= '$Bank_Website' name='Bank_Website' id='Bank_Website' style='width:90px;'></td>";
echo "<td ><input type='text' value= '$Bank_creditlimit1' name='Bank_creditlimit1' id='Bank_creditlimit1' style='width:50px;'></td>";
echo "<td ><input type='text' value= '$Bank_creditlimit2' name='Bank_creditlimit2' id='Bank_creditlimit2' style='width:50px;'></td>";
echo "<td ><input type='text' value= '$Owner_Branch' name='Owner_Branch' id='Owner_Branch' style='width:100px;'></td>";
echo "<td>
	<input id='imgSubmit_1' onclick=\"insertbank('$bank_id'); return false;\" title='Submit Record' style='width:20px; height:20px; vertical-align:bottom; cursor:pointer; outline:none; border:0px; background-image:url(img/confirm-1.png)' type='button'>
	</td>";
echo "</tr>";					////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
echo "<tr height='15px'><td></td></tr>";
echo "<tr><td colspan='14'><div style='overflow-y: scroll;overflow-x: hidden;height:300px;width: 1090px;'>
	<table border='0' cellspaving='0' cellpadding='0' width='1080px'>
	<col width='20px'><col width='20px'>
	<col width='120px'><col width='150px'>
	<col width='90px'><col width='90px'>
	<col width='90px'><col width='100px'>
	<col width='90px'><col width='90px'>
	<col width='50px'><col width='50px'>
	<col width='100px'><col width='20px'>";
	
$bankquery="select Bank_ID, bank_Name, Bank_Branch, Bank_Telephone1, Bank_Telephone2, Bank_Fax, Bank_Address, 
			Bank_Email, Bank_Website, Bank_creditlimit1, Bank_creditlimit2, Owner_Branch from banks ";

$bank=mysql_query($bankquery, $connection);
$i=0;

while($bankresult=mysql_fetch_row($bank)){
	if($i%2==0)
			$Color="background-color:#E6E6E6;";
	else			
		$Color="background-color:#F7F7F7;";	
	if($bank_id == $bankresult[0]) $Color="background-color:#1e87a5;";
	
	echo "<tr height='20px' style='$Color'>";
		echo"<td align = 'center'><img src='img/delete.png' onmouseover=\"style.cursor='pointer'\" name='' title='Delete' onclick=\" deletebank('$bankresult[0]')\"></td>";
		echo"<td align = 'center' ><img src='img/edit.png' onmouseover=\"style.cursor='pointer'\" id = 'imgSubmit' name='imgSubmi' title='Save' onclick=\"getbank('$bankresult[0]')\"></td>";
		echo "<td >$bankresult[1]</td>";
		echo "<td >$bankresult[2]</td>";
		echo "<td >$bankresult[3]</td>";
		echo "<td >$bankresult[4]</td>";
		echo "<td >$bankresult[5]</td>";
		echo "<td >$bankresult[6]</td>";
		echo "<td >$bankresult[7]</td>";
		echo "<td >$bankresult[8]</td>";
		echo "<td >$bankresult[9]</td>";
		echo "<td >$bankresult[10]</td>";
		echo "<td >$bankresult[11]</td>";
		echo "<td ></td>";
	echo "</tr>";
	$i++;
}
	echo "</table></div></td></tr>";
	//////////////////////////////////////////////////////////////////////////////////
	echo "</table>";
}

function draw_quota($quota_id, $searchquota, $connection){
echo "<table width='490px'>
	<col width='30px'><col width='30px'>
	<col width='150px'><col width='250px'>
	<col width='130px'><col width='130px'>
	<col width='50px'><col width='30px'>";
echo "<tr height='30px'>
	  <td colspan='8' align='right'><input type='text' name='searchquota' id='searchquota' value='$searchquota' >
	  <button type='button' id='btnSearch' name='btnSearch' onclick='searchQuota();return false;' title='Search Quota'><span><span>Search</span></span></button>
	  <button type='button' id='btnClearQ' name='btnClearQ' onclick='clearQuota();return false;' title='Clear Page'><span><span>Clear</span></span></button>
	  </td></tr> ";	
echo "<tr class='Search-Label-bg'>
	<td  align='center' ><span class='style4'></span></td>
	<td  align='center' ><span class='style4'></span></td>
	<td align='center'><span class='style4'>Company Quota</span></td>
	<td align='center'><span class='style4'>Quota Position</span></td>
	<td align='center'><span class='style4'>Quota Issue date</span></td>
	<td align='center'><span class='style4'>Quota Expire</span></td>
	<td align='center'><span class='style4'>Quota Used</span></td>
	<td  align='center' ><span class='style4'></span></td>
</tr>";

if($quota_id != ''){
	$query = "select Quota_code, Quota_Name, date_format(Quota_issuedate,'%Y-%m-%d'), date_format(Quota_expirydate,'%Y-%m-%d'), Quota_used 
				from quota where quota_id = '$quota_id'"; 
	$res = mysql_query($query,$connection);
	$row = mysql_fetch_row($res);	
	$quotacode 		= $row[0];
	$quotaname 		= $row[1];
	$quotaissuedate = $row[2];
	$quotaexire 	= $row[3];
	$quotaused 		= $row[4];
}	

echo "<tr height='20px'>";
	echo"<td align = 'center'></td>";
	echo"<td align = 'center' >
	<img src='img/undo-1.png' onmouseover=\"style.cursor='pointer'\" title=Clear' onclick=\"clearQuota();\" style='cursor: pointer;' height='20' width='20'></span>
		</td>";
	echo "<td ><input type='text' value= '$quotacode' name='quotacode' id='quotacode' style='width:150px;'></td>";
	echo "<td ><input type='text' value= '$quotaname' name='quotaname' id='quotaname' style='width:250px;' ></td>";
	echo "<td ><input type='date' value= '$quotaissuedate' name='quotaissuedate' id='quotaissuedate' style='width:130px;'>
		</td>";
	echo "<td ><input type='date' value= '$quotaexire' name='quotaexire' id='quotaexire' style='width:130px;'>
		</td>";
	echo "<td ><input type='checkbox' value='$quotaused' name='quotaused' id='quotaused' ".($quotaused == '1'?'checked':'')."></td>";
echo"<td align = 'center' >
			<input id='imgSubmit_1' onclick=\"insertquota('$quota_id'); return false;\" title='Submit Record' style='width:20px; height:20px; vertical-align:bottom; cursor:pointer; outline:none; border:0px; background-image:url(img/confirm-1.png)' type='button'>
		</td>";		
echo "</tr>";
echo "<tr height='15px'><td></td></tr>";
echo "<tr><td colspan='8'><div style='overflow-y: scroll;overflow-x: hidden;height:300px;'>
	<table border='0' cellspaving=0 cellpadding=0 >
	<col width='30px'><col width='30px'>
	<col width='150px'><col width='250px'>
	<col width='130px'><col width='130px'>
	<col width='50px'><col width='30px'>";
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	$quotaquery="select Quota_id, Quota_code, Quota_Name, date_format(Quota_issuedate,'%d-%m-%Y'), date_format(Quota_expirydate,'%d-%m-%Y'), 
				Quota_used from quota ";
	if($searchquota != '')	
	$quotaquery .=	" where Quota_code like '%$searchquota%' or Quota_Name like '%$searchquota%' ";
	$quotaquery .=	" order by Quota_Name ";
	//echo $quotaquery;
	$quotaquery=mysql_query($quotaquery, $connection);
	$i=0;
	while($quotaresult=mysql_fetch_row($quotaquery)){
		if($i%2==0)
			$Color="background-color:#E6E6E6;";
		else			
			$Color="background-color:#F7F7F7;";	
		if($quota_id == $quotaresult[0]) $Color="background-color:#1e87a5;";
		
	echo "<tr height='20px' style='$Color'>";
		echo"<td align = 'center'><img src='img/delete.png' onmouseover=\"style.cursor='pointer'\" name='' title='Delete' onclick=\" deletequota('$quotaresult[0]')\"></td>";
		echo"<td align = 'center' ><img src='img/edit.png' onmouseover=\"style.cursor='pointer'\" id = '$imgSubmit[$i]' name='$imgSubmit[$i]' title='Save' onclick=\"getquota('$quotaresult[0]')\"></td>";
		echo "<td >$quotaresult[1]</td>";
		echo "<td >$quotaresult[2]</td>";
		echo "<td >$quotaresult[3]</td>";
		echo "<td >$quotaresult[4]</td>";
		echo "<td align='center'>";
		if($quotaresult[5] == '1') echo "&#10003";
		echo "</td>";
		echo "<td></td>";	
	echo "</tr>";
		$i++;
		
	
	}
	echo "</table></div></td></tr>";
	//////////////////////////////////////////////////////////////////////////////////
	echo "</table>";
}
function draw_religions($religion_id, $connection){
echo "<table width='490px'>
	<col width='30px'><col width='30px'>
	<col width='150px'><col width='250px'>
	<col width='30px'>
<tr height='20px' class='Search-Label-bg'>
	<td  align='center' ><span class='style44'></span></td>
	<td  align='center' ><span class='style44'></td>			
	<td align='center'><span class='style44'>Religion Code</span></td>
	<td align='center'><span class='style44'>Religion Name</span></td>
	<td  align='center' ><span class='style44'></span></td>
</tr>";
	if( $religion_id != '' ){
		$query = "select Religion_code, Religion_name from religion where Religion_id = $religion_id;";
		$res = mysql_query($query, $connection);
		$row = mysql_fetch_row($res);
		$religion_code = $row[0];
		$religion_name = $row[1];
	}

echo "<tr height='20px'>";
echo"<td align = 'center'></td>";
echo"<td align = 'center' >	
		<img src='img/undo-1.png' onmouseover=\"style.cursor='pointer'\" title=Clear' onclick=\"clearReligion();\" style='cursor: pointer;' height='20' width='20'></span>
	</td>";
echo "<td ><input type='text' value= '$religion_code' name='religion_code' id='religion_code' style='width: 145px;'></td>";
echo "<td ><input type='text' value= '$religion_name' name='religion_name' id='religion_name' style='width: 245px;' ></td>";
echo"<td align = 'center' >
		<input id='imgSubmit_1' onclick=\"insertreligion('$religion_id'); return false;\" title='Submit Record' style='width:20px; height:20px; vertical-align:bottom; cursor:pointer; outline:none; border:0px; background-image:url(img/confirm-1.png)' type='button'>
	</td>";
echo "</tr>";
	
echo "<tr height='15px'><td></td></tr>";	

echo "<tr><td colspan='5'><div style='overflow-y: scroll;overflow-x: hidden;height:330px;'>
	<table border='0' cellspaving=0 cellpadding=0>
		<col width='30px'><col width='30px'>
		<col width='150px'><col width='250px'>
		<col width='30px'>";
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	$religionquery="select Religion_id, Religion_code, Religion_name from religion";
	$religionqu=mysql_query($religionquery, $connection);
	$i=0;
	while($religionresult=mysql_fetch_row($religionqu)){ 
		if($i%2==0)
			$Color="background-color:#E6E6E6;";
		else			
			$Color="background-color:#F7F7F7;";	
		if($religion_id == $religionresult[0]) $Color="background-color:#1e87a5;";
	
		echo "<tr height='20px' style='$Color'> ";
			echo"<td align = 'center'><img src='img/delete.png' onmouseover=\"style.cursor='pointer'\" name='' title='Delete' onclick=\" deletereligion('$religionresult[0]');\"></td>";
			echo"<td align = 'center' ><img src='img/edit.png' onmouseover=\"style.cursor='pointer'\" id = '$imgSubmit[$i]' name='$imgSubmit[$i]' title='Save' onclick=\"getreligion('$religionresult[0]');\"></td>";
			echo "<td >$religionresult[1]</td>";
			echo "<td >$religionresult[2]</td>";
			echo "<td ></td>";
		echo "</tr>";
			$i++;
		
	
	}
	echo "</table></div></td></tr>";
//////////////////////////////////////////////////////////////////////////////////
echo "</table>";
}
function draw_nationality($nationality_id, $connection){
echo "<table width='490px'>
<col width='30px'><col width='30px'>
<col width='150px'><col width='250px'>
<col width='30px'>
<tr height='20px' class='Search-Label-bg'>
	<td  align='center' ><span class='style44'></span></td>
	<td  align='center' ><span class='style44'></td>			
	<td align='center'><span class='style44'>Nationality Code</span></td>
	<td align='center'><span class='style44'>Nationality Name</span></td>
	<td  align='center' ><span class='style44'></span></td>
</tr>";

if($nationality_id != ''){
		$query = "select Nationality_code, Nationality_name from nationality where Nationality_id = $nationality_id";
		$res = mysql_query($query, $connection);
		$row = mysql_fetch_row($res);
		$nationality_code = $row[0];
		$nationality_name = $row[1];
	}	
echo "<tr height='20px' >";
	echo"<td align = 'center'></td>";
	echo"<td align = 'center' >	
		<img src='img/undo-1.png' onmouseover=\"style.cursor='pointer'\" title=Clear' onclick=\"clearNationality();\" style='cursor: pointer;' height='20' width='20'></span>
	</td>";
	echo "<td ><input type='text' value= '$nationality_code' name='nationality_code' id='nationality_code' style='width: 145px;'></td>";
	echo "<td ><input type='text' value= '$nationality_name' name='nationality_name' id='nationality_name' style='width: 245px;' ></td>";
	echo"<td align = 'center' >
		<input id='imgSubmit_1' onclick=\"insertnationality('$nationality_id'); return false;\" title='Submit Record' style='width:20px; height:20px; vertical-align:bottom; cursor:pointer; outline:none; border:0px; background-image:url(img/confirm-1.png)' type='button'>
	</td>";
echo "</tr>";
echo "<tr height='15px'><td></td></tr>";

echo "<tr><td colspan='5'><div style='overflow-y: scroll;overflow-x: hidden;height:300px;'><table border='0' cellspaving=0 cellpadding=0>
	<col width='30px'><col width='30px'>
	<col width='150px'><col width='250px'>
	<col width='30px'>";
					////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$nationalityquery="select Nationality_id,Nationality_code, Nationality_name from nationality";
$nationalityqu=mysql_query($nationalityquery, $connection);
	$i=0;
while($nationalityresult=mysql_fetch_array($nationalityqu)){
	if($i%2==0)
		$Color="background-color:#E6E6E6;";
	else			
		$Color="background-color:#F7F7F7;";	
	if($job_id == $nationalityresult[0]) $Color="background-color:#1e87a5;";
		
	echo "<tr height='20px' style='$Color'>";
	echo"<td align = 'center'><img src='img/delete.png' onmouseover=\"style.cursor='pointer'\" name='' title='Delete' onclick=\" deletenationality('$nationalityresult[0]')\"></td>";
	echo"<td align = 'center' ><img src='img/edit.png' onmouseover=\"style.cursor='pointer'\" id = '$imgSubmit[$i]' name='$imgSubmit[$i]' title='Save' onclick=\"getnationality('$nationalityresult[0]')\"></td>";
	echo "<td >$nationalityresult[1]</td>";
	echo "<td >$nationalityresult[2]</td>";
	echo "<td></td>";
	echo "</tr>";
	$i++;
}
echo "</table></div></td></tr>";
	//////////////////////////////////////////////////////////////////////////////////
	echo "</table>";
}




?>