<?php session_start();
	include_once("../../functions/init.php"); 

	$tmp = $thisUrl."adm1n/functions/access.php";
	include ($tmp);

	$tmp = $thisUrl."adm1n/functions/koneksi.php";
	include_once ($tmp);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<?php
		$tmp = $thisUrl."adm1n/functions/head_section.php";
		include ($tmp);
		?>
    </head>	
	<body>
    	<div class="se-pre-con"></div>
		<center>
			<table width="1024">
				<tr valign="top">
					<td width="207" class="bg">
						<?php 
						$tmp = $thisUrl."adm1n/functions/kiri.php";
						include ($tmp);
						?>
					</td>
					<td width="10"></td>
					<td width="807">
						<?php 
						$tmp = $thisUrl."adm1n/functions/logo.php";
						include ($tmp);
						
						$tmp = $thisUrl."adm1n/functions/getUrl.php";
						include ($tmp);
						
						$tmp = $thisUrl."adm1n/functions/php_functions.php";
						include ($tmp);

						echo '<div>'.$txt_legend.'</div>';

						$action = $_REQUEST["action"];
						$exhibitorID = $_POST["exhibitorID"];
						
						if ($action == "addRecord"){
							include ("add_record.php");
						} else if ($action == "Manage Company Info"){
							include ("edit_record.php");
						} else if ($action == "addProduct" || $action == "editProduct"){
							include ("add_product.php");	
						} else if ($action == "delete"){
						} else {
							$addRecord = "location='?action=addRecord'";
							echo '						
							<div style="display:block;">
								<div style="margin-top:15px"></div>
								<div style="float:left">
									<form name="form" id="form" class="form" action="?action=search" onsubmit="return validate(this)" method="post">
										<strong>Company Name</strong>: <br>
										<input type="text" name="s_text" size="50">
										<input type="submit" name="s_submit" class="button1" value="Search">
									</form>
								</div>
								<div style="float:right">
									<div id="tab1" class="button" onClick="'.$addRecord.'">Add Record</div>
								</div>
							</div>
							<div style="clear:both; margin-top:15px">&nbsp;</div>
							<div class="tabel font15">
								<div class="head-column border-both">
									<div class="tabel5 padding10 alignCenter">
										<strong>No</strong>
									</div>
									<div class="tabel50 border-left padding10">
										<strong>Company Name</strong>
									</div>
									<div class="tabel30 border-left padding10">
										<strong>Hall Number</strong>
									</div>
									<div class="tabel5 border-left alignCenter padding10">
									</div>
								</div>
							
							';
							$sql  = "select * from exhibitor_list ";
							if ($action=="search") $sql .= "where UPPER(companyName) like '%".strtoupper($_POST["s_text"])."%' ";
							$sql .= "order by exhibitorID desc";
							
							$max = mysql_num_rows(mysql_query($sql));
							$perhalaman = 15;
							$page = $_SESSION['page'];
							if (!$page) $page = $_REQUEST["page"];
							if ($page){
								$start=($page - 1) * $perhalaman;
							} else {
								$start=0;
							}
							
							$sql  .= " LIMIT $start, $perhalaman";
							//echo "<br>sql: ".$sql;
							if ($hasil = mysql_query($sql)) {
								$counter = $start;
								while ($data = mysql_fetch_array($hasil)) {
									$counter++;
									$addProduct  = 'onclick="';
									$addProduct .= "location='?action=addProduct&id=".$data["exhibitorID"]."'";
									$addProduct .= '"';
									echo '
									<div '.$addProduct.' class="content-column border-right border-bottom border-left">
										<div class="tabel5 padding10 alignCenter">
											'.$counter.'
										</div>
										<div class="tabel50 border-left padding10">
											'.strtoupper($data["companyName"]).'
										</div>
										<div class="tabel30 border-left padding10">
											'.FindDataRepeat("exhibitor_list_hallstand", "form_element_value", "to_exhibitor_id", "to_hall_id", "valueID", $data["exhibitorID"], "").'
										</div>
										<div class="tabel5 border-left alignCenter padding10">
											<img width="15" src="'.$thisPage.'/images/icons/delete-icon.png" border="0">
										</div>
									</div>
									';
								}
							}
							echo '
							</div>';
							echo '	
							<div align="center" style="margin:15px 0px 35px 0px">';
								$tmp = $thisUrl."functions/fungsi_paging.php";
								include($tmp);
								halaman($max, $perhalaman, 3, "?");
							echo '
							</div>';
						
						}

						?>
					</td>
				</tr>
			</table>
		</center>
	</body>
</html>	