<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=ads&theme=<?php echo $data["theme"] ?>">Advertisements</a>&nbsp;&gt;&nbsp;<a href="<?php echo $data["link"]; ?>"><?php echo $data["campaign"][name]; ?></a>&nbsp;&gt;&nbsp;Add/Edit Banner</td></tr>
	<tr><td>&nbsp;</td></tr>
	<?php if($data["output"]){ ?>
	<tr><td align="center"><?php echo $data["output"]; ?></td></tr>
	<tr><td>&nbsp;</td></tr>
	<?php } ?>
	<tr><td><table cellpadding="2" cellspacing="2" border="0" width="500" align="center">
	<form action="index.php" method="post" enctype="multipart/form-data">
	<input type="hidden" name="section" value="ads">
	<input type="hidden" name="action" value="save_banner">
	<input type="hidden" name="theme" value="<?php echo $data["theme"]; ?>">
	<input type="hidden" name="cmp_id" value="<?php echo $data["cmp_id"]; ?>">
	<input type="hidden" name="ban_id" value="<?php echo $data["ban_id"]; ?>">
	<input type="hidden" name="ret_link" value="<?php echo $data["link"]; ?>">
		<tr><td class="lined blue_bcg white_body padded" align="center">Banner Settings</td></tr>
		<tr><td class="form_cell"><table cellpadding="0" cellspacing="3" align="center" width="400">
			<tr><td class="body" width="150">Name:</td><td class="highlight"><?php
			admin_form_element( array ("type" => "input", "name" => "name", "size" => 30, "value" => $data["values"][name]) );
			?></td></tr>
			<tr><td class="body">Format:</td><td class="highlight"><?php
			admin_form_element( array ("type" => "select", "name" => "format", "options" => $data["formats"], "value" => $data["values"][format]) );
			?></td></tr>
			<tr><td class="body" valign="top">Type:</td><td class="highlight"><table cellpadding="0" cellspacing="2" border="0">
				<tr><td><?php
				admin_form_element( array ("type" => "radio", "name" => "type", "ovalue" => "external", "value" => $data["values"][type], "javascript" => "onclick='HS_UpdateBannerFields(this.form)'") );
				?></td><td class="highlight">External</td></tr>
				<tr><td><?php
				admin_form_element( array ("type" => "radio", "name" => "type", "ovalue" => "static", "value" => $data["values"][type], "javascript" => "onclick='HS_UpdateBannerFields(this.form)'") );
				?></td><td class="highlight">GIF/JPEG</td></tr>
				<tr><td><?php
				admin_form_element( array ("type" => "radio", "name" => "type", "ovalue" => "rich", "value" => $data["values"][type], "javascript" => "onclick='HS_UpdateBannerFields(this.form)'") );
				?></td><td class="highlight">Flash</td></tr>
			</table></td></tr>
			<tr id="url_row" <?php echo ($data["values"][type] == "external") ? "style='display:none'" : ""; ?>><td class="body">Banner URL:<br><small>use <i>click_url</i> variable in flash banners</small></td><td class="highlight" valign="top"><?php
			admin_form_element( array ("type" => "input", "name" => "url", "size" => 30, "value" => $data["values"][url]) );
			?></td></tr>
			<tr id="upload1" <?php echo ($data["values"][type] == "external") ? "style='display:none'" : ""; ?>><td class="body">Upload Banner:</td><td class="highlight"><?php
			admin_form_element( array ("type" => "file", "name" => "primary", "size" => 30) );
			?></td></tr>
			<tr id="upload2" <?php echo ($data["values"][type] != "rich") ? "style='display:none'" : ""; ?>><td class="body">Upload Secondary Banner:<br><small>(GIF/JPEG for non-flash users)</small></td><td valign="top" class="highlight"><?php
			admin_form_element( array ("type" => "file", "name" => "secondary", "size" => 30) );
			?></td></tr>
			<tr id="special_tag" <?php echo ($data["values"][type] == "static") ? "style='display:none'" : ""; ?>><td class="body" valign="top">Special Tag:</td><td class="highlight"><?php
			admin_form_element( array ("type" => "textarea", "name" => "tag", "rows" => "6", "cols" => "40", "value" => $data["values"][tag]) );
			?><br><div id="notice" <?php echo ($data["values"][type] != "rich") ? "style='display:none'" : ""; ?>>|file| - banner file URL</div></td></tr>
			<tr><td colspan="2" align="center"><?php
			admin_form_element( array ("type" => "button", "value" => "Back", "link" => $data["link"]) );
			echo "&nbsp;";
			admin_form_element( array ("type" => "button", "value" => "Add/Update") );
			?></td></tr>
		</table></td></tr>		
	</form>
	</table></td></tr>	
	<?php if($data["ban_id"]): ?>
	<tr><td>&nbsp;</td></tr>
	<tr><td><table cellpadding="2" cellspacing="2" border="0" width="500" align="center">
	<form action="index.php" method="post">
	<input type="hidden" name="section" value="ads">
	<input type="hidden" name="action" value="save_banner_areas">
	<input type="hidden" name="theme" value="<?php echo $data["theme"]; ?>">
	<input type="hidden" name="cmp_id" value="<?php echo $data["cmp_id"]; ?>">
	<input type="hidden" name="ban_id" value="<?php echo $data["ban_id"]; ?>">
	<input type="hidden" name="ret_link" value="<?php echo $data["link"]; ?>">
		<tr><td class="lined blue_bcg white_body padded" align="center"><a name="areas"></a>Banner Areas</td></tr>
		<tr><td class="form_cell"><table cellpadding="0" cellspacing="3" align="center">
			<?php
			
				while(list($key,$val) = each($data["areas"])){
					?><tr><td><?php
					admin_form_element( array ("type" => "checkbox", "name" => "areas[".$key."]", "ovalue" => 1, "value" => $data["values"]["areas"][$key]) );
					?></td><td class="highlight"><?php echo $val; ?></td></tr><?php
				}//while
			
			?>
			<tr><td align="center" colspan="2"><?php
			admin_form_element( array ("type" => "button", "value" => "Save") );
			?></td></tr>
		</table></td></tr>
	</form>
	</table></td></tr>
	<tr><td>&nbsp;</td></tr>
	<tr><td><table cellpadding="2" cellspacing="2" border="0" width="500" align="center">
	<form action="index.php" method="post" name="banner_pages">
	<input type="hidden" name="section" value="ads">
	<input type="hidden" name="action" value="save_banner_pages">
	<input type="hidden" name="theme" value="<?php echo $data["theme"]; ?>">
	<input type="hidden" name="cmp_id" value="<?php echo $data["cmp_id"]; ?>">
	<input type="hidden" name="ban_id" value="<?php echo $data["ban_id"]; ?>">
	<input type="hidden" name="ret_link" value="<?php echo $data["link"]; ?>">
	<input type="hidden" name="banner_pages" value="">
		<tr><td class="lined blue_bcg white_body padded" align="center"><a name="pages"></a>Content Targeting</td></tr>
		<tr><td class="form_cell"><table cellpadding="0" cellspacing="3" border="0" align="center">
			<tr>
				<td class="highlight" align="center">Site Pages</td>
				<td>&nbsp;</td>
				<td class="highlight" align="center">Banner Pages</td>
			</tr>
			<tr>
				<td><?php
				admin_form_element( array ("type" => "select", "name" => "b_npages", "size" => 10, "options" => array(), "width" => 230, "multiple" => 1) );
				?></td>
				<td align="center" class="padded">
					<table cellpadding="0" cellspacing="0" border="0">
					<tr><td><?php
					admin_form_element( array ("type" => "button", "value" => "&gt;&gt;", "onclick" => "HS_MoveOptions(document.banner_pages.b_npages,document.banner_pages.b_pages)") );
					?></td></tr>
					<tr><td height="5"><?php
					admin_output_image("spacer.gif");
					?></td></tr>
					<tr><td><?php 						
					admin_form_element( array ("type" => "button", "value" => "&lt;&lt;", "onclick" => "HS_MoveOptions(document.banner_pages.b_pages,document.banner_pages.b_npages)") );
					?></td></tr>
					</table>
				<td><?php
				admin_form_element( array ("type" => "select", "name" => "b_pages", "size" => 10, "options" => array(), "width" => 230, "multiple" => 1) );
				?></td>
			</tr>
			<tr><td colspan="3" align="center"><?php
				admin_form_element( array ("type" => "button", "value" => "Save", "onclick" => "HS_PrepareData(document.banner_pages.b_pages,document.banner_pages.banner_pages);document.banner_pages.submit();") );
			?></td></tr>
		</table></td></tr>
	</form>
	</table></td></tr>
	<tr><td>&nbsp;</td></tr>
	<tr><td><table cellpadding="2" cellspacing="2" border="0" width="500" align="center">
	<form action="index.php" method="post">
	<input type="hidden" name="section" value="ads">
	<input type="hidden" name="action" value="save_banner_countries">
	<input type="hidden" name="theme" value="<?php echo $data["theme"]; ?>">
	<input type="hidden" name="cmp_id" value="<?php echo $data["cmp_id"]; ?>">
	<input type="hidden" name="ban_id" value="<?php echo $data["ban_id"]; ?>">
	<input type="hidden" name="ret_link" value="<?php echo $data["link"]; ?>">
		<tr><td class="lined blue_bcg white_body padded" align="center"><a name="countries"></a>Geo Targeting</td></tr>
		<tr><td class="form_cell"><table cellpadding="0" cellspacing="0" align="center" width="100%">
			<tr><td colspan="2" align="center" class="highlight"><input type="checkbox" onclick="HS_TickAll('countries',this.form)" name="tick_tracker"> - Tick/Untick All</td></tr>
			<tr><td><table cellpadding="0" cellspacing="3" border="0">			
			<?php
				
				$half = round(count($data["countries"])/2);
				$count = 1;
				while(list($key,$val) = each($data["countries"])){
					?><tr><td><?php
					admin_form_element( array ("type" => "checkbox", "name" => "countries[".$key."]", "ovalue" => "1", "value" => $data["values"]["countries"][$key]) );
					?></td><td class="highlight"><?php echo $val; ?></td></tr><?php
					if($count == $half)
						break;
						
					$count++;
				}//while
				
			?>
			</table></td>
			<td><table cellpadding="0" cellspacing="3" border="0">
			<?php				
				
				while(list($key,$val) = each($data["countries"])){
					?><tr><td><?php
					admin_form_element( array ("type" => "checkbox", "name" => "countries[".$key."]", "ovalue" => "1", "value" => $data["values"]["countries"][$key]) );
					?></td><td class="highlight"><?php echo $val; ?></td></tr><?php
				}//while
				
			?>
			</table></td></tr>
			<tr><td align="center" colspan="2"><?php
			admin_form_element( array ("type" => "button", "value" => "Save") );
			?></td></tr>
		</table></td></tr>
	</form>
	</table></td></tr>
	<tr><td>&nbsp;</td></tr>
	<tr><td><table cellpadding="2" cellspacing="2" border="0" width="500" align="center">
	<form action="index.php" method="post">
	<input type="hidden" name="section" value="ads">
	<input type="hidden" name="action" value="save_banner_categories">
	<input type="hidden" name="pro" value="classifieds">
	<input type="hidden" name="theme" value="<?php echo $data["theme"]; ?>">
	<input type="hidden" name="cmp_id" value="<?php echo $data["cmp_id"]; ?>">
	<input type="hidden" name="ban_id" value="<?php echo $data["ban_id"]; ?>">
	<input type="hidden" name="ret_link" value="<?php echo $data["link"]; ?>">
		<tr><td class="lined blue_bcg white_body padded" align="center"><a name="cls_categories"></a>Categories Targeting - Classifieds</td></tr>
		<tr><td class="grey-lined"><table cellpadding="2" cellspacing="2" align="center" width="100%">
			<tr>
			<td class="list_header" align="center">Enable</td>
			<td class="list_header" align="center">Category</td>
			<td class="list_header" align="center">Subcategories</td>
			</tr>
			<?php
				
				while(list($key,$val) = each($data["cls_categories"])){
					?><tr><td class="list_cell" align="center"><?php
					admin_form_element( array ("type" => "checkbox", "name" => "categories[".$key."]", "ovalue" => "1", "value" => $data["values"]["cls_categories"][$key]) );
					echo ($data["cls_subcategories"][$key]) ? " *" : "";
					?></td><td class="list_cell"><?php echo $val; ?></td><td class="list_cell" align="center"><?php
					admin_output_image("buttons/but_edit_small.gif","index.php?section=ads&action=edit_banner_subcategories&pro=classifieds&category=".$key."&theme=".$data["theme"]."&cmp_id=".$data["cmp_id"]."&ban_id=".$data["ban_id"]."&ret_link=".urlencode($data["link"]),0,"edit subcategories");
					?></td></tr><?php
				}//while
				
			?>
			<tr><td class="highlight" colspan="3" align="center">* - subcategories are partially enabled</td></tr>
			<tr><td align="center" colspan="3"><?php
			admin_form_element( array ("type" => "button", "value" => "Save") );
			?></td></tr>
		</table></td></tr>
	</form>
	</table></td></tr>
	<tr><td>&nbsp;</td></tr>
	<tr><td><table cellpadding="2" cellspacing="2" border="0" width="500" align="center">
	<form action="index.php" method="post">
	<input type="hidden" name="section" value="ads">
	<input type="hidden" name="action" value="save_banner_categories">
	<input type="hidden" name="pro" value="events">
	<input type="hidden" name="theme" value="<?php echo $data["theme"]; ?>">
	<input type="hidden" name="cmp_id" value="<?php echo $data["cmp_id"]; ?>">
	<input type="hidden" name="ban_id" value="<?php echo $data["ban_id"]; ?>">
	<input type="hidden" name="ret_link" value="<?php echo $data["link"]; ?>">
		<tr><td class="lined blue_bcg white_body padded" align="center"><a name="evn_categories"></a>Categories Targeting - Events</td></tr>
		<tr><td class="grey-lined"><table cellpadding="2" cellspacing="2" align="center" width="100%">
			<tr>
			<td class="list_header" align="center">Enable</td>
			<td class="list_header" align="center">Category</td>
			<td class="list_header" align="center">Subcategories</td>
			</tr>
			<?php
				
				while(list($key,$val) = each($data["evn_categories"])){
					?><tr><td class="list_cell" align="center"><?php
					admin_form_element( array ("type" => "checkbox", "name" => "categories[".$key."]", "ovalue" => "1", "value" => $data["values"]["evn_categories"][$key]) );
					echo ($data["evn_subcategories"][$key]) ? " *" : "";
					?></td><td class="list_cell"><?php echo $val; ?></td><td class="list_cell" align="center"><?php
					admin_output_image("buttons/but_edit_small.gif","index.php?section=ads&action=edit_banner_subcategories&pro=events&category=".$key."&theme=".$data["theme"]."&cmp_id=".$data["cmp_id"]."&ban_id=".$data["ban_id"]."&ret_link=".urlencode($data["link"]),0,"edit subcategories");
					?></td></tr><?php
				}//while
				
			?>
			<tr><td class="highlight" colspan="3" align="center">* - subcategories are partially enabled</td></tr>
			<tr><td align="center" colspan="3"><?php
			admin_form_element( array ("type" => "button", "value" => "Save") );
			?></td></tr>
		</table></td></tr>
	</form>
	</table></td></tr>
	<tr><td>&nbsp;</td></tr>
	<tr><td><table cellpadding="2" cellspacing="2" border="0" width="500" align="center">
	<form action="index.php" method="post">
	<input type="hidden" name="section" value="ads">
	<input type="hidden" name="action" value="save_banner_categories">
	<input type="hidden" name="pro" value="clubs">
	<input type="hidden" name="theme" value="<?php echo $data["theme"]; ?>">
	<input type="hidden" name="cmp_id" value="<?php echo $data["cmp_id"]; ?>">
	<input type="hidden" name="ban_id" value="<?php echo $data["ban_id"]; ?>">
	<input type="hidden" name="ret_link" value="<?php echo $data["link"]; ?>">
		<tr><td class="lined blue_bcg white_body padded" align="center"><a name="clb_categories"></a>Categories Targeting - Clubs</td></tr>
		<tr><td class="grey-lined"><table cellpadding="2" cellspacing="2" align="center" width="100%">
			<tr>
			<td class="list_header" align="center">Enable</td>
			<td class="list_header" align="center">Category</td>
			<td class="list_header" align="center">Subcategories</td>
			</tr>
			<?php
				
				while(list($key,$val) = each($data["clb_categories"])){
					?><tr><td class="list_cell" align="center"><?php
					admin_form_element( array ("type" => "checkbox", "name" => "categories[".$key."]", "ovalue" => "1", "value" => $data["values"]["clb_categories"][$key]) );
					echo ($data["cls_subcategories"][$key]) ? " *" : "";
					?></td><td class="list_cell"><?php echo $val; ?></td><td class="list_cell" align="center"><?php
					admin_output_image("buttons/but_edit_small.gif","index.php?section=ads&action=edit_banner_subcategories&pro=clubs&category=".$key."&theme=".$data["theme"]."&cmp_id=".$data["cmp_id"]."&ban_id=".$data["ban_id"]."&ret_link=".urlencode($data["link"]),0,"edit subcategories");
					?></td></tr><?php
				}//while
				
			?>
			<tr><td class="highlight" colspan="3" align="center">* - subcategories are partially enabled</td></tr>
			<tr><td align="center" colspan="3"><?php
			admin_form_element( array ("type" => "button", "value" => "Save") );
			?></td></tr>
		</table></td></tr>
	</form>
	</table></td></tr>
	<?php endif; ?>
</table>