<style type="text/css">
<!--
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
-->
</style>
<script type="text/javascript" src="js/thickbox.js"></script>
<link rel="stylesheet" href="css/thickbox.css" type="text/css" media="screen" />

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
        <td width="38" align="left"><img src="img/showlist.jpg" width="38" height="35" /></td>
        <td width="323" align="left"><span class="head">Apply</span></td>
    
    <? if($_GET["action"]==""){?>

    <form action="index.php?option=apply" method="post">
    <td align="right"><span class="search">
      <label for="keyword"></label>
      <input type="text" name="keyword" id="keyword" />
      &nbsp; 
      <label for="imageField"></label>
      <input type="image" name="imageField" id="imageField" width="20" height="20" src="images/search.jpeg" />
    </span></td>
    </form>
        <? }?>
  </tr>
    </table>
<br />
<?PHP
$option=$_GET["option"];
switch($_GET["action"])
{case"showdetail":{ 
 $sql="SELECT * FROM sbs_job1  LEFT JOIN sbs_job2  ON (sbs_job1.id_job = sbs_job2.id_job)
 LEFT JOIN sbs_job3  ON (sbs_job1.id_job = sbs_job3.id_job)
 LEFT JOIN sbs_job4  ON (sbs_job1.id_job = sbs_job4.id_job)
 WHERE sbs_job1.id_job='".$_GET["itemid"]."' ";
 $result=mysql_query($sql) or die ($sql);
 $ROW=mysql_fetch_array($result);
mysql_query("Update sbs_job1 SET mark_read='Y' where id_job='".$_GET["itemid"]."'");
?>
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
        <td width="7" height="5" valign="top"><img src="images/border_01.jpg" width="7" height="5" /></td>
        <td background="images/border_02.jpg" style="background-repeat:repeat-x"></td>
        <td width="6" height="5" valign="top"><img src="images/border_03.jpg" width="6" height="5" /></td>
      </tr>
      <tr>
        <td background="images/border_04.jpg" style="background-repeat:repeat-y"></td>
        <td>
<table width="100%" cellspacing="0" cellpadding="0">
                    <tr>
                      <td colspan="3" class="required-field" style="padding-bottom:5px;"><strong>Please fill in all fields maked with (*)</strong></td>
                    </tr>
                    <tr>
                      <td width="26%" height="30"><strong>Position Required</strong></td>
                      <td width="4%" height="30"><strong>:</strong></td>
                      <td width="70%" height="30">
                      <?=$ROW["j1"]?></td>
                    </tr>
                    <tr>
                      <td height="30"><strong>Expected Salary</strong></td>
                      <td height="30"><strong>:</strong></td>
                      <td height="30"><?=$ROW["j2"]?></td>
                    </tr>
                    <tr>
                      <td colspan="3" class="required-field" style="padding-bottom:5px; padding-top:50px;"><strong>Personal Information</strong></td>
                    </tr>
                    <tr>
                      <td height="30"><strong>Full Name (English)</strong></td>
                      <td height="30"><strong>:</strong></td>
                      <td height="30"><?=$ROW["j3"]?></td>
                    </tr>
                    <tr>
                      <td height="30"><strong>Full Name (Thai)</strong></td>
                      <td height="30"><strong>:</strong></td>
                      <td height="30"><?=$ROW["j4"]?></td>
                    </tr>
                    <tr>
                      <td height="30"><strong>Date of Birth</strong></td>
                      <td height="30"><strong>:</strong></td>
                      <td height="30"><?=$ROW["j5"]?>
                        -
                        <?=$ROW["j6"]?>
                        -
                       <?=$ROW["j7"]?></td>
                    </tr>
                    <tr>
                      <td height="30"><strong>Place of Birth</strong></td>
                      <td height="30"><strong>:</strong></td>
                      <td height="30"><?=$ROW["j8"]?></td>
                    </tr>
                    <tr>
                      <td height="30"><strong>Age</strong></td>
                      <td height="30"><strong>:</strong></td>
                      <td height="30"><?=$ROW["j9"]?></td>
                    </tr>
                    <tr>
                      <td height="30"><strong>Nationality</strong></td>
                      <td height="30"><strong>:</strong></td>
                      <td height="30"><?=$ROW["j10"]?></td>
                    </tr>
                    <tr>
                      <td height="30"><strong>Status</strong></td>
                      <td height="30"><strong>:</strong></td>
                      <td height="30"><table width="100%" cellspacing="0" cellpadding="0">
                        <tr>
                          <td width="16%">[<?if($ROW["j11"]=="S")echo"/";?>]
                            Single </td>
                          <td width="16%">[<?if($ROW["j11"]=="M")echo"/";?>]
                            Married</td>
                          <td width="68%">[<?if($ROW["j11"]=="D")echo"/";?>]
                            Divorced</td>
                        </tr>
                      </table></td>
                    </tr>
                    <tr>
                      <td colspan="3" style="padding-bottom:5px; padding-top:50px;"><strong class="required-field">Contact Information</strong></td>
                    </tr>
                    <tr>
                      <td height="30"><strong>Address</strong></td>
                      <td height="30"><strong>:</strong></td>
                      <td height="30"><?=$ROW["j14"]?></td>
                    </tr>
                    <tr>
                      <td height="30"><strong>Province</strong></td>
                      <td height="30"><strong>:</strong></td>
                      <td height="30"><?=$ROW["j15"]?></td>
                    </tr>
                    <tr>
                      <td height="30"><strong>Postal Code</strong></td>
                      <td height="30"><strong>:</strong></td>
                      <td height="30"><?=$ROW["j16"]?></td>
                    </tr>
                    <tr>
                      <td height="30"><strong>Country</strong></td>
                      <td height="30"><strong>:</strong></td>
                      <td height="30"><?=$ROW["j17"]?></td>
                    </tr>
                    <tr>
                      <td height="30"><strong>Email</strong></td>
                      <td height="30"><strong>:</strong></td>
                      <td height="30"><?=$ROW["j18"]?></td>
                    </tr>
                    <tr>
                      <td height="30"><strong>Telephone</strong></td>
                      <td height="30"><strong>:</strong></td>
                      <td height="30"><?=$ROW["j19"]?></td>
                    </tr>
                    <tr>
                      <td height="30"><strong>Mobile</strong></td>
                      <td height="30"><strong>:</strong></td>
                      <td height="30"><?=$ROW["j20"]?></td>
                    </tr>
                    <tr>
                      <td colspan="3" style="padding-bottom:5px; padding-top:50px;"><strong class="required-field">Education</strong></td>
                    </tr>
                    <tr>
                      <td>&nbsp;</td>
                      <td height="15">&nbsp;</td>
                      <td height="30" rowspan="2" valign="top"><table width="100%" cellspacing="4" cellpadding="0">
                        <tr>
                          <td width="7%" align="center"><strong>From</strong></td>
                          <td align="center"><strong>To</strong></td>
                          <td align="center"><strong>Institution</strong></td>
                          <td align="center"><strong>Area of Study</strong></td>
                          <td align="center"><strong>Degree / Certificate</strong></td>
                        </tr>
                        <tr>
                          <td><?=$ROW["j21"]?></td>
                          <td width="7%"><?=$ROW["j22"]?></td>
                          <td width="21%"><?=$ROW["j23"]?></td>
                          <td width="21%"><?=$ROW["j24"]?></td>
                          <td width="44%"><?=$ROW["j25"]?></td>
                        </tr>
                      </table></td>
                    </tr>
                    <tr>
                      <td><strong>Primary</strong></td>
                      <td height="15"><strong>:</strong></td>
                    </tr>
                    <tr>
                      <td><strong>High School</strong></td>
                      <td height="15"><strong>:</strong></td>
                      <td height="30" valign="top"><table width="100%" cellspacing="4" cellpadding="0">
                        <tr>
                          <td width="7%"><?=$ROW["j26"]?></td>
                          <td width="7%"><?=$ROW["j27"]?></td>
                          <td width="21%"><?=$ROW["j28"]?></td>
                          <td width="21%"><?=$ROW["j29"]?></td>
                          <td width="44%"><?=$ROW["j30"]?></td>
                        </tr>
                      </table></td>
                    </tr>
                    <tr>
                      <td><strong>Vocational</strong></td>
                      <td height="15"><strong>:</strong></td>
                      <td height="30" valign="top"><table width="100%" cellspacing="4" cellpadding="0">
                        <tr>
                          <td width="7%"><?=$ROW["j31"]?></td>
                          <td width="7%"><?=$ROW["j32"]?></td>
                          <td width="21%"><?=$ROW["j33"]?></td>
                          <td width="21%"><?=$ROW["j34"]?></td>
                          <td width="44%"><?=$ROW["j35"]?>></td>
                        </tr>
                      </table></td>
                    </tr>
                    <tr>
                      <td><strong>Diploma</strong></td>
                      <td height="15"><strong>:</strong></td>
                      <td height="30" valign="top"><table width="100%" cellspacing="4" cellpadding="0">
                        <tr>
                         <td width="7%"><?=$ROW["j36"]?></td>
                          <td width="7%"><?=$ROW["j37"]?></td>
                          <td width="21%"><?=$ROW["j38"]?></td>
                          <td width="21%"><?=$ROW["j39"]?></td>
                          <td width="44%"><?=$ROW["j40"]?>></td>
                        </tr>
                      </table></td>
                    </tr>
                    <tr>
                      <td><strong>Undergraduate</strong></td>
                      <td height="15"><strong>:</strong></td>
                      <td height="30" valign="top"><table width="100%" cellspacing="4" cellpadding="0">
                        <tr>
                          <td width="7%"><?=$ROW["j41"]?></td>
                          <td width="7%"><?=$ROW["j42"]?></td>
                          <td width="21%"><?=$ROW["j43"]?></td>
                          <td width="21%"><?=$ROW["j44"]?></td>
                          <td width="44%"><?=$ROW["j45"]?>></td>
                        </tr>
                      </table></td>
                    </tr>
                    <tr>
                      <td><strong>Graduate</strong></td>
                      <td height="15"><strong>:</strong></td>
                      <td height="30" valign="top"><table width="100%" cellspacing="4" cellpadding="0">
                        <tr>
                         <td width="7%"><?=$ROW["j46"]?></td>
                          <td width="7%"><?=$ROW["j47"]?></td>
                          <td width="21%"><?=$ROW["j48"]?></td>
                          <td width="21%"><?=$ROW["j49"]?></td>
                          <td width="44%"><?=$ROW["j50"]?>></td>
                        </tr>
                      </table></td>
                    </tr>
                    <tr>
                      <td><strong>Special Training / Course</strong></td>
                      <td height="15"><strong>:</strong></td>
                      <td height="30" valign="top"><table width="100%" cellspacing="4" cellpadding="0">
                        <tr>
                            <td width="7%"><?=$ROW["j51"]?></td>
                          <td width="7%"><?=$ROW["j52"]?></td>
                          <td width="21%"><?=$ROW["j53"]?></td>
                          <td width="21%"><?=$ROW["j54"]?></td>
                          <td width="44%"><?=$ROW["j55"]?></td>
                        </tr>
                      </table></td>
                    </tr>
                    <tr>
                      <td colspan="3" style="padding-bottom:5px; padding-top:50px;"><strong class="required-field">Special Skills and Attributes</strong>
                        <table width="100%" cellspacing="0" cellpadding="0" style="margin-top:18px;">
                          <tr>
                            <td><?=$ROW["j56"]?></td>
                          </tr>
                        </table></td>
                    </tr>
                    <tr>
                      <td colspan="3" style="padding-bottom:5px; padding-top:50px;"><strong class="required-field">Employment Record</strong>
                        <table width="100%" cellspacing="4" cellpadding="0" style="margin-top:13px;">
                          <tr>
                            <td width="7%" align="center"><strong>From</strong></td>
                            <td align="center"><strong>To</strong></td>
                            <td align="center"><strong>Employer's name</strong></td>
                            <td align="center"><strong>Position</strong></td>
                            <td align="center"><strong>Salary</strong></td>
                          </tr>
                          <tr>
                            <td><?=$ROW["j57"]?></td>
                            <td width="7%"><?=$ROW["j58"]?></td>
                            <td width="29%"><?=$ROW["j59"]?></td>
                            <td width="29%"><?=$ROW["j83"]?></td>
                            <td width="28%"><?=$ROW["j60"]?></td>
                          </tr>
                          <tr>
                            <td><?=$ROW["j61"]?></td>
                            <td><?=$ROW["j62"]?></td>
                            <td><?=$ROW["j63"]?></td>
                            <td><?=$ROW["j64"]?></td>
                            <td><?=$ROW["j65"]?></td>
                          </tr>
                          <tr>
                           <td><?=$ROW["j66"]?></td>
                            <td><?=$ROW["j67"]?></td>
                            <td><?=$ROW["j68"]?></td>
                            <td><?=$ROW["j69"]?></td>
                            <td><?=$ROW["j70"]?></td>
                          </tr>
                          <tr>
                            <td><?=$ROW["j71"]?></td>
                            <td><?=$ROW["j72"]?></td>
                            <td><?=$ROW["j73"]?></td>
                            <td><?=$ROW["j74"]?></td>
                            <td><?=$ROW["j75"]?></td>
                          </tr>
                          <tr>
                           <td><?=$ROW["j76"]?></td>
                            <td><?=$ROW["j77"]?></td>
                            <td><?=$ROW["j78"]?></td>
                            <td><?=$ROW["j79"]?></td>
                            <td><?=$ROW["j80"]?></td>
                          </tr>
                        </table></td>
                    </tr>
                    <tr>
                      <td colspan="3" class="required-field" style="padding-bottom:5px; padding-top:50px;"><strong>Please attach your photograph and / or resume here (pdf, doc, docx file) </strong></td>
                    </tr>
                    <tr>
                      <td colspan="3" style="padding-top:10px;"><a href="../datacenter/<?=$ROW["j81"]?>"><?=$ROW["j81"]?></a></td>
                    </tr>
                    <tr>
                      <td colspan="3" class="required-field" style="padding-bottom:5px; padding-top:50px;"><strong>Ready to make live interview through
                        Skye or Face time</strong></td>
                    </tr>
                    <tr>
                      <td colspan="3" style="padding-top:10px;"><table width="100%" cellspacing="0" cellpadding="0">
                        <tr>
                          <td width="16%">
						  
						  [<?if($ROW["j82"]=="Y")echo"/";?>]
                            Yes</td>
                          <td>
						  [<?if($ROW["j82"]=="N")echo"/";?>]
                            No</td>
                        </tr>
                      </table></td>
                    </tr>
                    <tr>
                      <td height="50" colspan="3" valign="bottom" style="padding-top:10px;"></td>
                    </tr>
                  </table>

		</td>
        <td background="images/border_06.jpg" style="background-repeat:repeat-y"></td>
      </tr>
      <tr>
        <td width="7" height="7" valign="top"><img src="images/border_07.jpg" width="7" height="7" /></td>
        <td background="images/border_08.jpg" style="background-repeat:repeat-x">&nbsp;</td>
        <td width="6" height="7" valign="top"><img src="images/border_09.jpg" width="6" height="7" /></td>
      </tr>
    </table>
                

<? break;}default:{ ?>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
        <td width="7" height="5" valign="top"><img src="images/border_01.jpg" width="7" height="5" /></td>
        <td background="images/border_02.jpg" style="background-repeat:repeat-x"></td>
        <td width="6" height="5" valign="top"><img src="images/border_03.jpg" width="6" height="5" /></td>
      </tr>
      <tr>
        <td background="images/border_04.jpg" style="background-repeat:repeat-y"></td>
        <td>
                  <?PHP

$limit="20";
if(empty($_GET["page"])) {
	$page = 1;
} else {
	$page = $_GET["page"];
}	

$keyword=$_POST["keyword"];
if($_POST["keyword"]==""){
$keyword=$_GET["keyword"];
}


if($keyword!=""){	 		
$sql="select  * from sbs_job1  where j4 like '%".$keyword."%' order by cont_id desc";
} else{
$sql="select  * from sbs_job1  order by id_job desc";
}

$total = mysql_num_rows(mysql_query($sql));
$total=$total;
if($total % $limit) {
	$total_page = floor($total / $limit) + 1;	
} else {
	$total_page = floor($total / $limit);	
}
$start = (($page - 1) * $limit);
$sql = $sql." limit $start, $limit";
$query =mysql_query($sql)or die($sql);
$n = 1;
?>
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
            <td height="5" colspan="4" align="center" class="font"></td>
            </tr>
         <tr>
            <td height="20" colspan="4" align="right" class="font"><table width="300" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align="right"><span class="font-menu">Page&nbsp;                    <?
$end_page = 2;
$start = $page - $end_page;
if($page <= $end_page) {
	$start = 1;
}
$stop = $page + $end_page;
if($stop >= $total_page) {
	$stop = $total_page;
}
for($i = $start; $i <= $stop; $i ++) {
	if($i == $page) {
?>
                    <span class='page-numbers current'>
                      [<?=$page?>]                      </span>
                    <? } else { ?>
<a class='page-numbers' href='index.php?option=<?=$option?>&page=<?=$i?>&keyword=<?=$keyword?>'>&nbsp;<?=$i?>&nbsp;</a><? }}?></span></td>
                <td width="5" align="right"><span class="font-menu"><!--<a href="index.php?option=<?=$option?>&action=addform"><img src="img/add.jpg" width="70" height="26" border="0" /></a>--></span></td>
              </tr>
            </table></td>
            </tr>
          <tr>
            <td height="10" colspan="3" align="center" class="font"></td>
            </tr>
          <tr>
            <td width="5%" height="30" align="center" bgcolor="#BDD5F6" class="font"><strong>List</strong></td>
            <td align="center" bgcolor="#BDD5F6" class="font"><strong>Name</strong></td>
            <td width="10%" align="center" bgcolor="#BDD5F6" class="font"><strong>Process</strong></td>
        </tr>
<?
$start = (($page - 1) * $limit);
$bg="#D8E8FE";
while($Row = mysql_fetch_array($query)) {
	if($bg=="#D8E8FE"){
				$bg="#EDF4FE";
			}else if($bg=="#EDF4FE"){
				$bg="#D8E8FE";
			}	
			if($Row["mark_read"]=="N"){$mark="<font color=red>Unread</font>";}elseif($Row["mark_read"]=="Y"){$mark="read";}
	
				?>
          <tr class="font">
            <td align="center" bgcolor="<?=$bg;?>"><?=$start+$n++;?>.</td>
            <td bgcolor="<?=$bg;?>"> &nbsp;<?=$Row["j1"]?>  |  <?=$Row["j3"]?> | <?=$Row["mark_time"]?> <sub><?=$mark?></sub></td>
            <td align="center" bgcolor="<?=$bg;?>"><img src="images/faqseditconticon.gif" width="13" height="13" border="0"  style="cursor:pointer" onClick="window.location='index.php?option=apply&action=showdetail&itemid=<?=$Row["id_job"]?>'">&nbsp;
				
			</td>
          </tr>
          <? }?>
                    <tr>
            <td height="10" colspan="3" align="center" class="font"></td>
            </tr>
          <tr>
            <td colspan="3" align="center" class="font"><span class="font-menu">      <? if($page <= $total_page) {
					 $prevpage = $page - 1; 
					 if($prevpage < "1")
						$prevpage="1";
					 ?>
      <a href='index.php?option=<?=$option?>&page=1&keyword=<?=$keyword?>'><span class="hproduct">First</span></a>&nbsp;  <a href='index.php?option=<?=$option?>&page=<?=$prevpage?>&keyword=<?=$keyword?>'><span class="hproduct">Back</span></a>
      <? } ?>&nbsp;Page&nbsp;             
                    <?
$end_page = 2;
$start = $page - $end_page;
if($page <= $end_page) {
	$start = 1;
}
$stop = $page + $end_page;
if($stop >= $total_page) {
	$stop = $total_page;
}
for($i = $start; $i <= $stop; $i ++) {
	if($i == $page) {
?>
                    <span class='page-numbers current'>
                      [<?=$page?>]                      </span>
                    <? } else { ?>
<a class='page-numbers' href='index.php?option=<?=$option?>&page=<?=$i?>&keyword=<?=$keyword?>'>&nbsp;<?=$i?>&nbsp;</a><? }}?>&nbsp;<? if($page <= $total_page) { 
						$nextpage = $page + 1; 
						if($nextpage > $total_page)
						$nextpage=$total_page;
						?>
      <a href='index.php?option=<?=$option?>&page=<?=$nextpage?>&keyword=<?=$keyword?>'><span class="hproduct">Next</span></a> <a href='index.php?option=<?=$option?>&page=<?=$total_page?>&keyword=<?=$keyword?>'><span class="hnews">&nbsp; End</span></a>
      <? } ?> &nbsp;&nbsp;&nbsp;Page <?=$page?> of <?=$total_page?> &nbsp;&nbsp;Total list &nbsp;<?=$total;?> list</td>
</tr>
                      <tr>
            <td height="5" colspan="3" align="center" class="font"></td>
            </tr>
        </table>
</td>
        <td background="images/border_06.jpg" style="background-repeat:repeat-y"></td>
      </tr>
      <tr>
        <td width="7" height="7" valign="top"><img src="images/border_07.jpg" width="7" height="7" /></td>
        <td background="images/border_08.jpg" style="background-repeat:repeat-x">&nbsp;</td>
        <td width="6" height="7" valign="top"><img src="images/border_09.jpg" width="6" height="7" /></td>
      </tr>
    </table>
    <? }}?>