<?php
$PageSecurity = 2;
include('includes/session.inc');
$title = _('Search Site Code ');
include('includes/header.inc');
$Sql = "select loccode from locations";
$ErrMsg = _('Query Fail!') . '. ' . _('The error says');
$Result = DB_query($Sql,$db,$ErrMsg);

?>
<form action="" method="post">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><div align="center"><b><?php echo $title; ?></b></div></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td width="24%">&nbsp;</td>
    <td width="11%">Site Code </td>
    <td width="19%"><input name="sitecode" type="text" id="sitecode" /></td>
    <td width="46%"><input type="submit" name="Submit" value="Search " /></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="4"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr bgcolor="#CCCCCC">
        <td width="4%" >&nbsp;</td>
        <td width="100%" align="center"> Site Code</td>
        
      </tr>
	  <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
	  <?php   
	  
	  $counter = $_REQUEST['rowcount'];
	  $ct = explode("_",$counter);
	  while($myrow =DB_fetch_array($Result))
	  {  
	  $ct=1;
	 ?>
	  <tr>
        <td>&nbsp;</td>
        <td><A HREF="javascript:loadValue('<?php echo $myrow['loccode']; ?>')"><?php echo $myrow['loccode'];?></A></td>
      </tr>
	  <?php } ?>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
    </table></td>
    </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>

</form>
<script>

function loadValue(i)
{
	
	
	window.opener.document.getElementById('site').value = i;
	
	window.close();
	
	//window.opener.document.getElementById('StockID').value = i;
	//window.close();
}
</script>
<?
 
include('includes/footer.inc');
?>