<?php
session_start();

if($_SESSION['dbName']==""){
	header("location:../index.php");
}

print <<<HERE

<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
<meta name="viewport" content="width=device-width, initial-scale=1.0"> 
<link rel="stylesheet" type="text/css" media="all" href="css-v2/style.css">
<script type="text/javascript" src="js/grid/jquery-1.9.1.js"></script>
<link type="text/css" rel="stylesheet" href="dhtmlgoodies_calendar.css?random=20051112" media="screen"></LINK>
<script type="text/javascript" language="javascript">
	
	function searchforstaff()
		{
    win = window.open('staffsearch.php', 'Form_staffSearch', 'toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=775,height=450,top=100,left=100');		
	win.creator = self;
	//alert('gb0');
	win.focus();		
			
}
	function addingstaff(){
			 if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
				{ 	
					document.getElementById('staffchanging').innerHTML=xmlhttp.responseText;
					
				}
		}
  }

  



	xmlhttp.open("GET","staff_action.php?actionmode=readd",true);

xmlhttp.send();

	
	}

  function editstaff(codehouse){
	  
		opener.document.form.staff_code.value=codehouse;
		opener.document.form.submit();
		self.close();		
}


	

	
	
	
	

	
function clearform(){
	document.getElementById('searchby').value='';
	searchforstaff();
	
}

	

	
	
	
	

</script>

HERE;



echo "</head><body></body></html>";


function draw_staffinfo1($connection,$code){
	$querysetup="select grid_color1,grid_color2,DecimalBase, DecimalBase1, DecimalBase2, base1, base2, maxperpage from setup";
			$resultsetup=mysql_query($querysetup,$connection) or die(mysql_error());
			if($result=mysql_fetch_array($resultsetup)){
				$grid_color1=$result[0];
			$grid_color2=$result[1];}
			
	echo "<table border='0' cellpadding='3' cellspacing='0' align='left' valign='center' >
<col width=180>
<col width=40>
<col width=180>
<col width=120>
<col width=150>
<col width=50>
<col width=140>
<col width=200>";

//echo "<button type='button' onclick=' addnewstaff(); return false;'><span ><span>save</span></span></button> ";
//echo "&nbsp;&nbsp;<button type='button' onclick=' addform(); return false;'><span ><span>add</span></span></button> ";
$housestaff="select Staff_code, Staff_firstName, Staff_lastName, Staff_fatherName, Staff_phone1, Staff_phone2, Staff_email, 
Staff_nationality, Staff_Jobtitle, Staff_PassportNb, Staff_Dob, Staff_religion, DATE(Staff_beginingDate), Staff_gender, Staff_bloodgrp, 
Staff_picture, Staff_prvjob, Staff_remark, Staff_InsNb, DATE(Staff_Insissuedate), DATE(Staff_InsExpDate), DATE(Staff_passIssueDate), 
DATE(Staff_PassExpDate), Staff_Rpnb, DATE(Staff_Rpissuedate), DATE(Staff_rpexpdate), Staff_placeofbirth, Staff_visaNo, DATE(Staff_visaIssueDate),
 DATE(Staff_visaExpDate), Staff_bankAcc, Staff_bankName, Staff_quota, Staff_MaritalStatus, Staff_totalChildren, Staff_salary, Staff_leaveDays, 
 Staff_visatype, staff_TempNo, DATE(staff_TempIssueDate),DATE( staff_TempExpDate), staff_Resigned, DATE(staff_ResignedDate), project_code, 
 DATE(Staff_quotaExpired), staff_IBAN, staff_SortCode, Staff_company, DATE(Staff_beginningDate), Staff_fullName, Staff_bankbranch, Staff_localallowance,
 Staff_defaulAll, Staff_accname, Staff_AllienNo, DATE(Staff_AllienFrom), DATE(Staff_AllienTo) from staff where staff_code=$code";
$queryres=mysql_query($housestaff, $connection);

$rowres=mysql_fetch_array($queryres);
 //onclick=' addnewstaff();
// echo "<tr height='30px'></tr>";

/*if ($rowres[0]==''){ echo "<button type='submit'><span ><span>save</span></span></button> ";
echo "&nbsp;&nbsp;<button type='button' onclick=' addform(); return false;'><span ><span>add</span></span></button> ";}
//onclick=' updatestaff(); '
else{
	*///echo "<br><br>";
	echo "<button type='submit' ><span ><span>save</span></span></button> ";
echo "&nbsp;&nbsp;<button type='button' onclick=' addingstaff(); return false;'><span ><span>add</span></span></button> ";
//}
  echo "&nbsp;&nbsp; <button name='btnSearch' type='button' id='btnSearch' value='Search' onclick='searchforstaff();' title='Search Vehicle' ";
			
		        echo " /><span><span>Search</span></span></button>";
$color1='#94E9E0';
if( $rowres[0]!=''){
	$read='readonly';
	$Color22 ="style='background-color:".$grid_color2."'";
		$color ="style='background-color:".$color1."'";
}
echo "<tr height='30px'></tr>";
	echo "	<tr>
			<td > Staffcode</td>
			<td><input type='text' name='staffcode' id='staffcode' value='$rowres[0]' $read $color></td>
			<td> nationality</td>
			<td>
			<select name='nationality'  id='nationality' width='100%' '>";
			$nationalityquery="select nationality_code,nationality_name from nationality";
			$nationality=mysql_query($nationalityquery, $connection) or die(mysql_error('555'));
			while($row=mysql_fetch_array($nationality)){
			echo "	<option value='$row[1]' ";
			if ($row[1]==$rowres[7]) echo "selected";
			
			echo ">$row[1]</option>";
	}
			echo "	
			</select>
			</td>
			<td></td>";
			echo "<td align='right' align=''><input type='file' name='image' >";
				echo "</td>
			<td  rowspan='4' colspan='3' align='right'><img src='photos/$rowres[0]/$rowres[15]' width='120px' height='100px'>";
			/*$picture="select staff_picture,staff_code from staff";
			$res=mysql_query($picture, $connection) or die(mysql_error());
			while($res1=mysql_fetch_array($res)){
				echo "<img src='photos/$res1[1]/$res1[0]'> $res1[0]"."fg";
				}
			*/
			echo" </td>";
	echo "	</tr>
		<tr>
			<td>First name</td>
			<td><input type='text' name='firstname' id='firstname' value='$rowres[1]'></td>
			
			<td>relegions</td>
			<td>
				<select name='religions' id='religions' value=''>";
				$religionquery="select religion_code,religion_name from religion";
			$religion=mysql_query($religionquery, $connection) or die(mysql_error());
			while($religionresult=mysql_fetch_array($religion)){
			echo "	<option value='$religionresult[1]'";
			if ($religionresult[1]==$rowres[11]) echo "selected";
			echo ">$religionresult[1]</option>";
	}
			echo "	
				</select>
			</td>
		</tr>
		<tr>
			<td>Last Name</td>
			<td><input type='text' name='lastname' id='lastname' value='$rowres[2]'></td>
			<td>Employement Date</td>
			<td><input type='text' name='employedate' id='employedate' value='$rowres[12]' size='8'> 
			<a HREF='#' onClick=\"displayCalendar(document.form.employedate,'yyyy-mm-dd',this); return false;\" NAME=\"anchor1\" ID=\"anchor1\" >";

 



 echo"<image src='./img/cal.gif' border=0 align=center ></image></a></td>
			<td align='right'>Project</td>
			<td><input type='text' name='project' id='project' value='$rowres[43]'></td>
		
			
		</tr>
		<tr>
			<td>Father Name</td>
			<td><input type='text' name='fathername' id='fathername'  value='$rowres[3]'></td>
			<td>Full Name</td>
			<td colspan='3'><input type='text' name='fullname' id='fullname' style='width:100%' value='$rowres[49]'></td>	
		</tr>
		<tr>
			<td>Email Adress</td>
			<td><input type='text' name='emailadress' id='emailadress' value='$rowres[6]'></td>
			<td>company</td>
			<td ><select name='company' id='company'  >";
			
			$company="SELECT * FROM STAFF_COMPANY";
			$companyname=mysql_query($company, $connection) or die(mysql_error());
			while($companyresult=mysql_fetch_array($companyname)){
				echo "<option value='$companyresult[0]'";
				if ($companyresult[0]==$rowres[47]) echo "selected";
				echo ">$companyresult[0]</option>";
				
			}
			
	echo"		</select></td>
			<td align='right'>Leave Days</td>		
			<td ><input type='text' name='leavedays' id='leavedays' style='width:100%' value='$rowres[36]'></td>			
			<td align='right' colspan='2'>Blood Grp <input type='text' name='bloodgroup' id='bloodgroup' value'$rowres[14]' size='4'></td>			
		</tr>
		<tr>
			<td>Place of Birth</td>
			<td><input type='text' name='birthplace' id='birthplace' value='$rowres[26]'></td>
			<td>Date of Birth</td>
			<td ><input type='text' name='birthdate' id='birthdate' size='8' value=''> <a HREF='#' onClick=\"displayCalendar(document.form.birthdate,'yyyy-mm-dd',this); return false;\" NAME=\"anchor1\" ID=\"anchor1\" >";

 



 echo"<image src='./img/cal.gif' border=0 align=center ></image></a></td></td>
			<td colspan='2' align='right'>Gender(M-F) &nbsp; &nbsp; 
			<select name='gender'  id='gender'>
			<option value='M'"; 
				if ($companyresult[1]==$rowres[47]) echo "selected";
			if ('M'==$rowres[13]) echo selected ;
			echo ">M</option>
			<option value='F' "; 
			if ('F'==$rowres[13])
				echo selected ;
			echo ">F</option>
			
			</select></td>			
			<td align='right' colspan='2'>Total Children <input type='text' name='totalchildren' id='totalchildren' size='4' value='$rowres[34]'></td>			
		</tr>
		<tr>
			<td>Foreign Phone No</td>
			<td><input type='text' name='phone1' id='phone1' value='$rowres[4]'></td>
			<td>Local Phone No</td>
			<td ><input type='text' name='phone2' style='width:100%' id='phone2' value='$rowres[5]'></td>
			
			<td colspan='2' align='right' name='marialstatus' id='marialstatus' >Marial Status (M/S/D/W) &nbsp; &nbsp;
			<select name='marialstatus'  id='marialstatus' value='$rowres[33]'>
			<option value='M'"; if ('M'==$rowres[33]) echo"selected";
			echo ">M</option>
			<option value='S'"; if ('S'==$rowres[33]) echo"selected";
			echo ">S</option>
			<option value='D'"; if ('D'==$rowres[33]) echo"selected";
			echo ">D</option>
			<option value='W'"; if ('W'==$rowres[33]) echo"selected";
			echo ">W</option>
			
			</select>
			</td>
			<td align='right'>allowance</td>
			<td ><input type='text' name='allowance2' style='width:100%' id='allowance2' value='$rowres[52]'></td>
			
		</tr>
		<tr>
			<td>Bank Acc</td>
			<td><input type='text' name='bankacc' id='bankacc' value=''></td>
			<td>Bank Name</td>
			<td ><select name='bankname' id='bankname' style='width:100%' >
			<option value=''></option>";
			
			$bankquery="select bank_id,bank_name from banks";
			$bankname=mysql_query($bankquery, $connection) or die(mysql_error());
			while($bankresult=mysql_fetch_array($bankname)){
			echo "<option value='$bankresult[0]'";
			if($bankresult[1]==$rowres[31])echo "selected";
			echo ">$bankresult[1]</option>";
			}
			echo "</select></td>
			<td align='right'>Branch</td>		
			<td ><input type='text' name='bankbranch' id='bankbranch' style='width:100%' value='$rowres[50]'></td>			
			<td align='right'>Paid allowance</td>
			<td ><input type='text' name='allowance' style='width:100%' id='allowance' value='$rowres[51]'></td>
			
			
		</tr>
		<tr>
			<td> Acc Holder Name</td>
			<td><input type='text' name='accname' id='accname' value='$rowres[53]'></td>
			<td align='center'>IBAN</td>
			<td ><input type='text' name='iban' style='width:100%' id='iban' value='$rowres[45]'></td>
			<td align='right'> Sort Code </td>		
			<td ><input type='text' name='sortcode' style='width:100%' id='sortcode' ></td>			
			<td align='right'>Salary Amount</td>
			<td ><input type='text' name='salaryamount'  style='width:100%' id='salaryamount' value='$rowres[35]'></td>
			
			
		</tr>
		<tr>
			<td>Quota Position</td>
			<td>
			<select name='quotaname' id='quotaname'>
			<option value=''></option>";
			$quotaquery="select quota_code,quota_name from quota";
			$quota=mysql_query($quotaquery, $connection) or die(mysql_error());
			while($quotaresult=mysql_fetch_array($quota)){
			echo "<option value='$quotaresult[0]'";
			if($quotaresult[1]==$rowres[32])echo "selected";
			echo ">$quotaresult[1]</option>";
			}
			echo "</select>
			</td>
			<td>Current Position</td>
			<td ><select name='curentpos' id='curentpos'>";
			$selectjob ="select job_code from jobs";
				$job=mysql_query($selectjob, $connection) or die(mysql_error());
			while($jobaresult=mysql_fetch_array($job)){
				echo "<option value='$jobaresult[0]'";
				if($jobaresult[0]==$rowres[8])echo "selected";
				echo ">$jobaresult[0]</option>";
			}
			echo "	</select></td>
			<td align='right'>Entry Date</td>		
			<td ><input type='text' name='entrydate'  id='entrydate' size='8'> <a HREF='#' onClick=\"displayCalendar(document.form.entrydate,'yyyy-mm-dd',this); return false;\" NAME=\"anchor1\" ID=\"anchor1\" >";

 



 echo"<image src='./img/cal.gif' border=0 align=center ></image></a></td></td>			
			<td align='right'>Quota Pos Expired</td>
			<td ><input type='text' name='quotaexpire' style='width:100%' id='quotaexpire' value='$rowres[44]'></td>
			
			
		</tr>
		<tr>
			<td>Resignation Date </td>
			<td><input type='text' name='resigndate' id='resigndate' value='$rowres[42]' size='8'> <a HREF='#' onClick=\"displayCalendar(document.form.resigndate,'yyyy-mm-dd',this); return false;\" NAME=\"anchor1\" ID=\"anchor1\" >";

 



 echo"<image src='./img/cal.gif' border=0 align=center ></image></a</td>
			<td>Resignation Reason</td>
			<td ><input type='text' name='resignreason' style='width:100%' id='resignreason' ></td>
			<td><input type='checkbox' name='resigned' id='resigned' value='$rowres[41]'>Resigned</td>		
			
			
		</tr>";
		echo "<tr height='40px'></tr>";
	echo "	<tr><td colspan='3'><table >
		<col width=150>
		<col width=120>
		<col width=100>
		<col width=120>
			<td  colspan='3' height='30px'><b>Passport Information</b></td></tr>
			<tr><td>Passport N</td>
			<td ><input type='text' name='passportnumber' style='width:100%' id='passportnumber' value='$rowres[9]'></td>
			</tr><tr>
			<td>issue Date  ";
			
			
			echo "</td>
			<td ><input type='text' name='passportdate' size='8' id='passportdate' value='$rowres[21]'> 
			<a HREF='#' onClick=\"displayCalendar(document.form.passportdate,'yyyy-mm-dd',this); return false;\" NAME=\"anchor1\" ID=\"anchor1\" >";

 



 echo"<image src='./img/cal.gif' border=0 align=center ></image></a</td></td>
			<td>Expiry Date</td>
			<td ><input type='text' name='passportexpire' size='8' id='passportexpire' value='$rowres[22]'> 
			<a HREF='#' onClick=\"displayCalendar(document.form.passportexpire,'yyyy-mm-dd',this); return false;\" NAME=\"anchor1\" ID=\"anchor1\" >";

 



 echo"<image src='./img/cal.gif' border=0 align=center ></image></a></td>
		</table>
		";
		echo "<td></td>";
echo "</td>
<td colspan='3'><table >
<col width=150>		<col width=120>
		<col width=100>
		<col width=120>
			<td  colspan='3' height='30px'><b>inssurance</b></td></tr>
			<tr><td>inssurance N</td>
			<td ><input type='text' name='inssurancenumber'  id='inssurancenumber' style='width:100%' value='$rowres[0]'> 
			
			</tr><tr>
			<td>Issue Date</td>";
			
		echo "	<td ><input type='text' name='inssurancedate' size='8'  id='inssurancedate' value='$rowres[0]'> 
		<a HREF='#' onClick=\"displayCalendar(document.form.inssurancedate,'yyyy-mm-dd',this); return false;\" NAME=\"anchor1\" ID=\"anchor1\" >";

 



 echo"<image src='./img/cal.gif' border=0 align=center ></image></a></td></td>
			<td>Expiry Date</td>
			<td ><input type='text' name='inssuranceexpire' size='8'  id='inssuranceexpire'value='$rowres[0]'>
			<a HREF='#' onClick=\"displayCalendar(document.form.inssuranceexpire,'yyyy-mm-dd',this); return false;\" NAME=\"anchor1\" ID=\"anchor1\" >";

 



 echo"<image src='./img/cal.gif' border=0 align=center ></image></a></td>
		</table>
</td>


</tr>
";
		echo "<tr height='20px'></tr>";
	echo "
	<tr><td colspan='3'><table >
	<col width=150>		<col width=120>
		<col width=100>
		<col width=120>
			<td  colspan='3' height='30px'><b>Cerpac Information</b></td></tr>
			<tr><td>Card N</td>
			<td ><input type='text' name='cardnumber' style='width:100%' id='cardnumber'value='$rowres[23]'></td>
			</tr><tr>
			<td>issue Date</td>";
			
			echo "
			<td ><input type='text' name='carddate' size='8' id='carddate'value='$rowres[24]'>
			<a HREF='#' onClick=\"displayCalendar(document.form.carddate,'yyyy-mm-dd',this); return false;\" NAME=\"anchor1\" ID=\"anchor1\" >";

 



 echo"<image src='./img/cal.gif' border=0 align=center ></image></a></td>
			<td>Expiry Date</td>
			<td ><input type='text' name='cardexpire' size='8' id='cardexpire' value='$rowres[25]'> <a HREF='#' onClick=\"displayCalendar(document.form.cardexpire,'yyyy-mm-dd',this); return false;\" NAME=\"anchor1\" ID=\"anchor1\" >";

 



 echo"<image src='./img/cal.gif' border=0 align=center ></image></a></td>
		</table>
		
</td>";
echo "<td></td>";	

echo "<td colspan='3'><table ><col width=170><col width=120>
		<col width=100>
		<col width=120>
			<td  colspan='3' height='30px'><b>temporary cart Information</b></td></tr>
			<tr><td>temporary number N</td>
			<td ><input type='text' name='tempnumber' style='width:100%' id='tempnumber' value='$rowres[38]'></td>
			</tr><tr>
			<td>issue Date</td>";
		
			echo "<td ><input type='text' name='tempdate' size='8' id='tempdate' value='$rowres[39]'>
			<a HREF='#' onClick=\"displayCalendar(document.form.tempdate,'yyyy-mm-dd',this); return false;\" NAME=\"anchor1\" ID=\"anchor1\" >";

 



 echo"<image src='./img/cal.gif' border=0 align=center ></image></a></td>
			<td>Expiry Date</td>
			<td ><input type='text' name='tempexpire' size='8' id='tempexpire' value='$rowres[40]'>
			
			<a HREF='#' onClick=\"displayCalendar(document.form.tempexpire,'yyyy-mm-dd',this); return false;\" NAME=\"anchor1\" ID=\"anchor1\" >";

 



 echo"<image src='./img/cal.gif' border=0 align=center ></image></a></td>
		</table>
</td>

</tr>
";
		echo "<tr height='20px'></tr>";
	echo "
	<tr><td colspan='3'><table ><col width=150><col width=120>
		<col width=100>
		<col width=120>
			<td  colspan='3' height='30px'><b>Visa Information</b></td></tr>
			<tr><td>visa N</td>
			<td ><input type='text' name='visanumber' size='8' id='visanumber' value='$rowres[27]'>
			";

 



 echo"</td>
			<td>Type</td>
			<td>
				<select name='visatype' id='visatype' value='$rowres[37]'>
					<option value=''></option>
				</select>
			</td>
			
			</tr><tr>";
		
			
			echo "
			<td>issue Date</td>
			<td ><input type='text' name='visadate' size='8' id='visadate' value='$rowres[28]'> <a HREF='#' onClick=\"displayCalendar(document.form.visadate,'yyyy-mm-dd',this); return false;\" NAME=\"anchor1\" ID=\"anchor1\" >";

 



 echo"<image src='./img/cal.gif' border=0 align=center ></image></a></td>
			<td>Expiry Date</td>
			<td ><input type='text' name='visaexpire' size='8'  id='visaexpire' value='$rowres[29]'>
			 <a HREF='#' onClick=\"displayCalendar(document.form.visaexpire,'yyyy-mm-dd',this); return false;\" NAME=\"anchor1\" ID=\"anchor1\" >";

 



 echo"<image src='./img/cal.gif' border=0 align=center ></image></a></td>
		</table>
		
</td>";
echo "<td></td>	";		
echo "<td colspan='3'><table ><col width=170><col width=120>
		<col width=100>
		<col width=120>
			<td  colspan='3' height='30px'><b>Alien</b></td></tr>
			<tr><td>Alien Card Number N</td>
			<td ><input type='text' name='aliennumber' style='width:100%' id='aliennumber' value='$rowres[54]'></td>
			</tr><tr>
			<td>issue Date</td>";
			
			echo "
			<td ><input type='text' name='aliendate' size='8' id='aliendate' value='$rowres[55]'> 
			 <a HREF='#' onClick=\"displayCalendar(document.form.aliendate,'yyyy-mm-dd',this); return false;\" NAME=\"anchor1\" ID=\"anchor1\" >";

 



 echo"<image src='./img/cal.gif' border=0 align=center ></image></a></td>
			<td>Expiry Date</td>
			<td ><input type='text' name='alienexpire' size='8' id='alienexpire' value='$rowres[56]'> 
			<a HREF='#' onClick=\"displayCalendar(document.form.alienexpire,'yyyy-mm-dd',this); return false;\" NAME=\"anchor1\" ID=\"anchor1\" >";

 



 echo"<image src='./img/cal.gif' border=0 align=center ></image></a></td>
		</table>
</td>


</tr>";
echo "<tr height='30px' ></tr>";

echo"	</table>";
}

function staffsearch($connection,$code,$condition){
		if ($to==10)
				$to = 'selected';
			else if ($to==20)
				$to1 = 'selected';
			else if ($to==30)
				$to2 = 'selected';
			//else if ($to==50)
				//$to = 'selected';
echo "<table>";
echo "<tr><td></td><td>";
echo "<table  align='left' border='0' style='table-layout:fixed'  style='width:100%; margin_left:10px;'>";
echo"<col width=10>
<col width=10>
<col width=100>
<col width=100>
<col width=100>";

$querysetup="select grid_color1,grid_color2,DecimalBase, DecimalBase1, DecimalBase2, base1, base2, maxperpage from setup";
$resultsetup=mysql_query($querysetup,$connection) or die(mysql_error());

echo"<tr>";
		//<td id='search-top1' style='height:34px; width:31px;'>&nbsp;</td>
	  	echo "<td id='search-top2' style='height:34px; width:908px' align='center' valign='middle' colspan='5'>
			<table >
			<tr><td ><span class='style3'>List of Staff</span></td></tr>
			</table>
		</td>
		<td id='search-top3' style='height:34px; width:31px;'>&nbsp;</td>
	</tr>";
echo "
	  <tr bgcolor='#DDDDDD' height=30px>
	    <td align='left' colspan='3'><span class='style1'>Search by Name/No</span></td>
		<td align='left' colspan=''><span class='style1'><input type='text' name='searchby' id='searchby' value='$code' size='15' maxlength='30'/>";
		//<input type='hidden' name='PMode' id='PMode' value='$PMode' size='15' maxlength='30'/>
		echo "<select id='searcchcondition'>
		<option value='Staff_code'>code</option>
		<option value='Staff_firstName'>firstname</option>
		<option value='Staff_email'>email</option>
		</select>";
		echo "</span>
		    <button type='button' name='Submit' value='Find' onclick='searchforvalue()' /><span><span>Find</span></span></button>
			<button type='button' name='btnCancel' value='Cancel' onclick='clearform();'/><span><span>Cancel</span></span></button></td>
		<td  colspan='' align='left' valign='center'><span class='style4'>Result/page</span><span class='style1'><select name='perpage' id='perpage' value='$perpage' onchange=set_limit();>";
         echo "  <tr bgcolor='' height=30px>";
		 /*<td colspan='5' align='center'>perpage:
		 <select name='fromto' >
		 <option value='10' $to>10</option>
		 <option value='20' $to1>20</option>
		 <option value='30' $to2>30</option>
					<option value='30'>30</option>
		 </select >
		  </td>
		  */
		  echo"</tr> "; 
//echo "<tr><td colspan='3'> search by name /No </td><td><input type='text name='searchby' id='searchby' value='$code'></td>
//<td><button type='button' onclick='searchforvalue()'><span><span>search</span></span>
//</td></tr>";
if($result=mysql_fetch_array($resultsetup)){
	$grid_color1=$result[0];
$grid_color2=$result[1];}
echo "<tr  height='30px' height='25'>
		<td  align='center'><span class='style4'></span></td>
		<td  align='center'><span style='style4'></span></td>
		<td  align='center' ><span style='style4'>staff code</span></td>
		<td  align='center'><span style='style4'> staff first name</span></td>
		<td align='center'><span style='style4'>staff last name</span></td>
	</tr>";
	if ($code=='')
	{$staffinf="select staff_code, staff_firstname,staff_lastname from staff";}
else  {$staffinf="select staff_code, staff_firstname,staff_lastname from staff where $condition like '%$code%' "; }
	$result=mysql_query($staffinf, $connection) or die(mysql_error(''));
	$i=0;
	while($rows=mysql_fetch_array($result)){
		if($i%2==0)
								$Color="style='background-color:".$grid_color1."'";
							else			
								$Color="style='background-color:".$grid_color2."'";
		echo "<tr height='20px'>";
		echo"<td align='center'><img src='img/delete.png' onmouseover=\"style.cursor='pointer'\" name='' title='Delete' onclick=\" deletestaff('$rows[0]')\"></td>";
		echo"<td align = 'center' ><img src='img/edit.png' onmouseover=\"style.cursor='pointer'\" id = '$imgSubmit[$i]' name='$imgSubmit[$i]' title='Save' onclick=\"editstaff('$rows[0]')\"></td>";
		echo "<td $Color  class='roundedtext_countrycode' >  $rows[0]</td>" ;
		echo "<td $Color  class='roundedtext_countrycode'>  $rows[1]</td>" ;
		echo "<td $Color  class='roundedtext_countrycode'>  $rows[2]</td>" ;
	/*	
		echo "<td><input type='text' $Color class='roundedtext_countrycode' value= '$rows[2]'></td>" ;*/
		echo "</tr>";
		$i++;
		
}
echo "</table>";
echo "</td></tr></table>";
}

?>