<table width="100%" cellpadding="0" cellspacing="0" border="0">
	<tr><td class="nav"><a href="index.php?section=home">Home</a>&nbsp;&gt;&nbsp;<a href="index.php?section=manage_classifieds">Manage Classifieds</a></td></tr>	
	<tr><td>&nbsp;</td></tr>
	<tr><td>
		<table callpadding="0" cellspacing="3" border="0" align="center">
		<form action="index.php" method="post" name="classifieds_search">
		<input type="hidden" name="section" value="manage_classifieds">
			<tr>
			<td class="form_cell" valign="top">
				<table cellpadding="0" cellspacing="3" border="0">
					<tr><td class="body">Category/Subcategory:</td></tr>
					<tr><td class="highlight"><?php
					$options = array();
					$options[0] = "Please, select...";
					while(list($key,$val) = each($data["categories"])){
						$options[$key] = $val;
					}//while
					admin_form_element( array ("type" => "select", "options" => $options, "name" => "category", "value" => $data["values"][category], "javascript" => "onChange='HS_PopulateSubCategoriesSimple()'") );
					?></td></tr>
					<tr><td class="highlight"><?php
						$subcategory = array (
						"type" => "select",
						"name" => "subcategory",
						"value" => $data["values"][subcategory]
						);
						$subcategory["options"][0] = "Please, select...";
						if($data["values"][category]){
						while(list($key,$val) = each($data["subcategories"][$data["values"][category]])){
							$subcategory["options"][$key] = $val;
						}//while
						}//if
						admin_form_element($subcategory);
					?></td></tr>
				</table>
			</td>
			<td class="form_cell" valign="top">
				<table cellpadding="0" cellspacing="3" border="0">
					<tr><td class="body">Search For:</td></tr>
					<tr><td class="highlight"><?php
					admin_form_element( array ("type" => "input", "name" => "search_text", "size" => 20, "value" => $data["values"][search_text]) );
					?></td></tr>
					<tr><td class="highlight">
					<?php
					$options = array (
					"" => "Please, select...",
					"cls_id" => "Ad ID",
					"title" => "Title",
					"description" => "Description", 
					"mem_id" => "Author Member ID",
					"fname" => "Author First Name",
					"lname" => "Author Last Name",
					"email" => "Author Email"
					);
					admin_form_element( array ("type" => "select", "options" => $options, "value" => $data["values"][search_for], "name" => "search_for") );
					?>
					</td></tr>
				</table>
			</td>			
			<td class="form_cell" valign="top">
				<table cellpadding="0" cellspacing="3" border="0">
					<tr><td class="body">Sort By:</td></tr>
					<tr><td class="highlight"><?php
					$options = array (
						"" => "Please, select...",
						"title" => "Title",
						"cls_id" => "Ad ID",
						"posted" => "Post Date",
						"featured" => "Featured"
					);
					admin_form_element( array ("type" => "select", "options" => $options, "name" => "sort_by", "value" => $data["values"][sort_by]) );
					?></td></tr>
					<tr>
						<td><?php
						$sort_order = array (
						"type" => "select",
						"name" => "sort_order",
						"options" => array (
							"asc" => "ascending",
							"desc" => "descending"
						),
						"value" => $data["values"][sort_order]
						);
						admin_form_element($sort_order);
						?></td>
					</tr>
				</table>
			</td>			
			</tr>
			<tr><td colspan="2" align="center"><?php
			admin_form_element( array ("type" => "button", "value" => "Show") );
			?></td></tr>
		</form>
		</table>
	</td></tr>
	<tr><td>&nbsp;</td></tr>
	<tr><td>
		<table align="center" cellpadding="2" cellspacing="2" border="0" width="500">
		<form action="index.php" method="post">
		<input type="hidden" name="section" value="manage_classifieds">
		<input type="hidden" name="ret_link" value="<?php echo $data["link"]; ?>">
		<input type="hidden" name="action" value="">		
		<tr>
			<td class="list_header" align="center">
			<input type="checkbox" onclick="HS_TickAll('cls_id[]',this.form)" name="tick_tracker">
			</td>
			<td class="list_header" align="center">Ad ID</td>
			<td class="list_header" align="center">Title</td>
			<td class="list_header" align="center">Author</td>						
			<td class="list_header" align="center">Posted</td>
			<td class="list_header" align="center">Action</td>
		</tr>
		<?php
		
			foreach($data["classifieds"] as $ad){
			?>
			<tr>
				<td class="list_cell" align="center">
				<?php admin_form_element( array ("type" => "checkbox", "name" => "cls_id[]", "ovalue" => $ad["id"]) ); ?>
				</td>
				<td class="list_cell" align="center"><?php echo $ad["id"]; ?></td>
				<td class="list_cell" align="center"><?php echo $ad["title"]; ?></td>
				<td class="list_cell" align="center"><?php echo $ad["author"]; ?></td>
				<td class="list_cell" align="center"><?php echo $ad["date"]; ?></td>
				<td class="list_cell" align="center"><?php
				admin_output_image("buttons/but_view_small.gif",$ad["view"],0,"view",1);					
				admin_output_image("buttons/but_edit_small.gif",$ad["edit"],0,"edit");
				if($ad["featured"])
					admin_output_image("buttons/but_featured_remove_small.gif",$ad["featured_remove"],0,"remove from featured");
				else
					admin_output_image("buttons/but_featured_add_small.gif",$ad["featured_add"],0,"add to featured");
				admin_output_image("buttons/but_delete_small.gif",$ad["delete"],0,"delete");
				?></td>
			</tr>
			<?php
			}//foreach
					
		?>
		<tr>			
			<td colspan="6" align="center"><?php
			admin_form_element( array ("type" => "button", "value" => "Delete", "bsubmit" => "this.form.action.value='delete';") );
			?></td>			
		</tr>		
		</form>
		</table>
	</td></tr>
	<tr><td>&nbsp;</td></tr>
	<?php if(is_array($data["pages"][numbers])): ?>
	<tr>
		<td class="pages_line">
			<table cellpadding="0" cellspacing="0" border="0" align="center" height="20">
				<tr>					
					<td align="center" class="pages_body">
					<?php
						if($data["pages"][prev]){
							?><a href="<?php echo $data["pages"][prev]; ?>">&lt;&lt;</a>&nbsp;<?php
						}//if
						while(list($page,$link) = each($data["pages"][numbers])){
							?><a href="<?php echo $link; ?>"><?php echo ($page == $data["pages"][current]) ? "<b>".$page."</b>" : $page ; ?></a>&nbsp;<?php
						}//while
						if($data["pages"][next]){
							?><a href="<?php echo $data["pages"][next]; ?>">&gt;&gt;</a>&nbsp;<?php
						}//if
					?>
					</td>
			</table>			
		</td>
	</tr>
	<?php endif; ?>
</table>