<?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" name="frm" id="id_frm">
<input type="hidden" name="group_id" value="<?php echo $group['group_id'];?>" />



<table width="100%" border="0" cellspacing="0" cellpadding="4">
	<tr>
		<td width="760" valign="top">
			<div class="box_top">
				<?php echo $lang['section_apply'];?><br />
			</div>
			
			<div class="box_mid" style="padding: 9px;">
			<?php
			if (isset($display)) {
			?>
			<table cellpadding="4" cellspacing="0" border="0" width="100%">
				<tr>
					<td width="50%" valign="top">
						<b><?php echo $group['group_title'];?></b><br />
						<?php echo $group['group_synopsis'];?><br />
					</td>
					<td width="20">
						<img src="<?php echo $templatePath;?>img/pixel.png" width="20" height="1" alt="" /><br />
					</td>
					<td width="50%" valign="top">
						<b><?php echo $lang['hdr_join'];?></b><br />
						
						<p>
						<?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";
						}
						?>
						</p>
						<?php
						if (isset($button)) {
						?>
						
						<p>
						<?php echo $lang['txt_profile_select_txt'];?><br />
						</p>
						<p>
						<label for="id_profile_id"><?php echo $lang['from_profile'];?></label>
						
						<select id="id_profile_id" 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 />
						</p>
						
						<p 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="button_urgent" /><br />
						<?php
						}
						elseif ($button == "open") {
						?>
						<input type="submit" name="user_member" value="<?php echo $lang['sub_join'];?>" class="button_urgent" /><br />
						<?php
						}}
						?>
						</p>
					</td>
				</tr>
			</table>

			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />
			<hr />
			<?php echo $lang['hdr_group_rules'];?><br />
			<p>
			<b><?php echo $group['display_group_rules'];?></b><br />
			</p>

			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />
			<hr />
			<b><?php echo $lang['hdr_node_rules'];?></b><br />
			<p>
			<?php echo $lang['txt_node_rules'];?><br />
			</p>
			
			
			<?php
			}
			else {
			?>
			<?php echo $lang['txt_group_unavailable'];?><br />
			<?php }?>
		
			</div>
			
			<div id="box_bottom">
				<table cellpadding="0" cellspacing="0" border="0" width="100%">
					<tr>
						<td align="left">
							<img src="<?php echo $templatePath;?>img/box_bottom_left.png" width="5" height="18" alt="" border="0" /><br />
						</td>
						<td align="left">
							<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="9" alt="" border="0" /><br />
						</td>
						<td align="right">
							<img src="<?php echo $templatePath;?>img/box_bottom_right.png" width="5" height="18" alt="" border="0" /><br />
						</td>
					</tr>
				</table>
			</div>
		</td>
	</tr>
</table>
</form>
