<?php

// -----------------------------------------------------------------------
// This file is part of aroundme
// 
// Copyright (C) 2003, 2005 Barnraiser
// http://www.barnraiser.org/
// info@barnraiser.org
// 
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option) any
// later version.
// 
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with program; see the file COPYING. If not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
// -----------------------------------------------------------------------

?>


<form action="g_apply.php" method="post">
<input type="hidden" name="group_id" value="<?php echo $group['group_id'];?>" />



<table width="770" border="0" cellspacing="0" cellpadding="4">
	<tr>
		<td width="180" valign="top">
			<?php
			include $templatePath . "g_menu.inc.tpl.php";
			?>
		</td>

		<td width="20">&nbsp;</td>

		<td width="570" valign="top">
			<?php
			if (isset($display)) {
			?>
			<table cellpadding="4" cellspacing="0" border="0" width="100%" class="bg_1">
				<tr>
					<td colspan="2" class="txt_title" align="right">
						<?php echo $lang['section_apply'];?><br />
						<hr />
					</td>
				</tr>
				<tr>
					<td>
						<b><?php echo $group['group_title'];?></b><br />
					</td>
				</tr>
				<tr>
					<td>
						<?php echo $group['group_synopsis'];?><br />
					</td>
				</tr>
			</table>

			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />

			<table cellpadding="4" cellspacing="0" border="0" width="100%">
				<tr>
					<td class="txt_title" align="right">
						<?php echo $lang['hdr_join'];?><br />
						<hr />
					</td>
				</tr>
				<tr>
					<td>
						<?php
						if (isset($display) && $display == "group_application_in_progress") {
						    echo $lang['txt_group_pending'];
						}
						elseif (isset($display) && $display == "group_apply_approved") {
						    echo $lang['txt_group_approved'];
							$button = "reg";
						}
						elseif (isset($display) && $display == "group_apply_automatic") {
						    echo $lang['txt_group_automatic'];
							$button = "open";
						}
						?>
					</td>
				</tr>
				<?php
				if (isset($button)) {
				?>
				<tr>
					<td>
						<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />
					</td>
				</tr>
				<tr>
					<td>
						<?php echo $lang['txt_profile_select_txt'];?><br />
					</td>
				</tr>
				<tr>
					<td>
						<select name="data[profile_id]" class="formInput">
							<?php
							foreach($profiles as $key => $i):
								print "<option value='" . $i['profile_id'] . "'>" . $i['profile_name'] . "</option>";
							endforeach;
							?>
						</select>
						<br />
					</td>
				</tr>
				<tr>
					<td>
						<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />
					</td>
				</tr>
				<tr>
					<td align="right">
						<?php
						echo $lang['txt_join_notes'] . "&nbsp;&nbsp;";
						
						if ($button == "reg") {
						?>
						<input type="submit" name="user_pending" value="<?php echo $lang['sub_join'];?>" class="formInput" /><br />
						<?php
						}
						elseif ($button == "open") {
						?>
						<input type="submit" name="user_member" value="<?php echo $lang['sub_join'];?>" class="formInput" /><br />
						<?php
						}
						?>
					</td>
				</tr>
				<?php
				}
				?>
			</table>

			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />

			<table cellpadding="4" cellspacing="0" border="0" width="100%">
				<tr>
					<td class="txt_title" align="right">
						<?php echo $lang['hdr_group_rules'];?><br />
						<hr />
					</td>
				</tr>
				<tr>
					<td>
						<?php echo $group['display_group_rules'];?><br />
					</td>
				</tr>
			</table>

			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />

			<table cellpadding="4" cellspacing="0" border="0" width="100%">
				<tr>
					<td class="txt_title" align="right">
						<?php echo $lang['hdr_node_rules'];?><br />
						<hr />
					</td>
				</tr>
				<tr>
					<td>
						<?php echo $lang['txt_node_rules'];?><br />
					</td>
				</tr>
			</table>
			<?php
			}
			else {
			?>
			<table cellpadding="4" cellspacing="0" border="0" width="100%">
				<tr>
					<td class="txt_title" align="right">
						<?php echo $lang['section_apply'];?><br />
						<hr />
					</td>
				</tr>
				<tr>
					<td>
						<?php echo $lang['txt_group_unavailable'];?><br />
					</td>
				</tr>
			</table>
			<?php
			}
			?>
		</td>
	</tr>
</table>
</form>
