<?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.
// -----------------------------------------------------------------------

?>

<script language="JavaScript" src="js/imageHandling.js" type="text/javascript"></script>

<form action="my_profile.php" method="post" name="frm" id="id_frm">

<?php
if (isset($display) && $display == "edit_profile") {
?>
<input type="hidden" name="profile_id" value="<?php if (isset($profile['profile_id'])) { echo $profile['profile_id'];}?>" />

<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td width="370" valign="top">
			<div class="box_top">
				<?php echo $lang['hdr_profile'];?><br />
			</div>

			<div class="box_mid" style="padding: 9px;">
			<table border="0" cellspacing="0" cellpadding="2" width="100%">
				<tr>
					<td>
						<?php echo $lang['txt_profile_edit_intro'];?><br />
						<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="12" alt="" /><br />

					</td>
					<td valign="top" colspan="2" align="right">
						<br />
					</td>
				</tr>
				<tr>
					<td valign="top">
						<fieldset>
						<legend><?php echo $lang['txt_header_1'];?></legend>
						<p>
						<?php echo $lang['txt_overview_intro'];?><br />
						</p>

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

						<table border="0" cellspacing="0" cellpadding="0" width="100%">
							<tr>
								<td valign="top" width="310">
									<p>
									<label for="id_profile_name"><?php echo $lang['txt_profile_name'];?></label>
									<input id="id_profile_name" type="text" name="profile_name" size="35" value="<?php if (isset($profile['profile_name'])) { echo $profile['profile_name'];}?>" /><br />
									</p>

									<p>
									<label for="id_profile_nic"><?php echo $lang['txt_profile_nic'];?></label>
									<input id="id_profile_nic" type="text" maxlength="50" name="profile_nic" size="35" value="<?php if (isset($profile['profile_nic'])) { echo $profile['profile_nic'];}?>" /><br />
									</p>

									<p>
									<label for="id_profile_hometown"><?php echo $lang['txt_profile_hometown'];?></label>
									<input id="id_profile_hometown" type="text" name="profile_hometown" size="35" value="<?php if (isset($profile['profile_hometown'])) { echo $profile['profile_hometown'];}?>" /><br />
									</p>

									<?php
									if (!empty($lang['txt_profile_text1'])) {
									?>
									<p>
									<label for="id_profile_text1"><?php echo $lang['txt_profile_text1'];?></label>
									<input id="id_profile_text1" type="text" name="profile_text1" size="35" value="<?php if (isset($profile['profile_text1'])) { echo $profile['profile_text1'];}?>" /><br />
									</p>
									<?php }?>

									<?php
									if (!empty($lang['txt_profile_text2'])) {
									?>
									<p>
									<label for="id_profile_text2"><?php echo $lang['txt_profile_text2'];?></label>
									<input id="id_profile_text2" type="text" name="profile_text2" size="35" value="<?php if (isset($profile['profile_text2'])) { echo $profile['profile_text2'];}?>" /><br />
									</p>
									<?php }?>

									<?php
									if (!empty($lang['txt_profile_text3'])) {
									?>
									<p>
									<label for="id_profile_text3"><?php echo $lang['txt_profile_text3'];?></label>
									<input id="id_profile_text3" type="text" name="profile_text3" size="35" value="<?php if (isset($profile['profile_text3'])) { echo $profile['profile_text3'];}?>" /><br />
									</p>
									<?php }?>

									<?php
									if (!empty($lang['txt_profile_text4'])) {
									?>
									<p>
									<label for="id_profile_text4"><?php echo $lang['txt_profile_text4'];?></label>
									<input id="id_profile_text4" type="text" name="profile_text4" size="35" value="<?php if (isset($profile['profile_text4'])) { echo $profile['profile_text4'];}?>" /><br />
									</p>
									<?php }?>

									<?php
									if (!empty($lang['txt_profile_text5'])) {
									?>
									<p>
									<label for="id_profile_text5"><?php echo $lang['txt_profile_text5'];?></label>
									<input id="id_profile_text5" type="text" name="profile_text5" size="35" value="<?php if (isset($profile['profile_text5'])) { echo $profile['profile_text5'];}?>" /><br />
									</p>
									<?php }?>

									<?php
									if (!empty($lang['txt_profile_text6'])) {
									?>
									<p>
									<label for="id_profile_text6"><?php echo $lang['txt_profile_text6'];?></label>
									<input id="id_profile_text6" type="text" name="profile_text6" size="35" value="<?php if (isset($profile['profile_text6'])) { echo $profile['profile_text6'];}?>" /><br />
									</p>
									<?php }?>

									<?php
									if (!empty($lang['txt_profile_text7'])) {
									?>
									<p>
									<label for="id_profile_text7"><?php echo $lang['txt_profile_text7'];?></label>
									<input id="id_profile_text7" type="text" name="profile_text7" size="35" value="<?php if (isset($profile['profile_text7'])) { echo $profile['profile_text7'];}?>" /><br />
									</p>
									<?php }?>

									<?php
									if (!empty($lang['txt_profile_text8'])) {
									?>
									<p>
									<label for="id_profile_text8"><?php echo $lang['txt_profile_text8'];?></label>
									<input id="id_profile_text8" type="text" name="profile_text8" size="35" value="<?php if (isset($profile['profile_text8'])) { echo $profile['profile_text8'];}?>" /><br />
									</p>
									<?php }?>

									<?php
									if (!empty($lang['txt_profile_text9'])) {
									?>
									<p>
									<label for="id_profile_text9"><?php echo $lang['txt_profile_text9'];?></label>
									<input id="id_profile_text9" type="text" name="profile_text9" size="35" value="<?php if (isset($profile['profile_text9'])) { echo $profile['profile_text9'];}?>" /><br />
									</p>
									<?php }?>

									<?php
									if (!empty($lang['txt_profile_text10'])) {
									?>
									<p>
									<label for="id_profile_text10"><?php echo $lang['txt_profile_text10'];?></label>
									<input id="id_profile_text10" type="text" name="profile_text10" size="35" value="<?php if (isset($profile['profile_text10'])) { echo $profile['profile_text10'];}?>" /><br />
									</p>
									<?php }?>
								</td>
								<td>
									<img src="<?php echo $templatePath;?>img/pixel.png" width="10" height="1" alt="" /><br />
								</td>
								<td valign="top">
									<p>
									<label for="id_gender"><?php echo $lang['txt_gender'];?></label><br />

									<input type="radio" id="id_gender" name="profile_gender" class="checkbox" value="0" checked="checked">&nbsp;<?php echo $lang['txt_none'];?><br />
									<input type="radio" id="id_gender" name="profile_gender" class="checkbox" value="1" <?php if (isset($profile['profile_gender']) && $profile['profile_gender'] == "1") { echo "checked=\"checked\"";}?>>&nbsp;<?php echo $lang['txt_male'];?><br />
									<input type="radio" id="id_gender" name="profile_gender" class="checkbox" value="2" <?php if (isset($profile['profile_gender']) && $profile['profile_gender'] == "2") { echo "checked=\"checked\"";}?>>&nbsp;<?php echo $lang['txt_female'];?><br />
									</p>

									<table border="0" cellspacing="0" cellpadding="4" width="100%">
										<tr>
											<td valign="top">
												<input type="checkbox" id="id_profile_allow_msg" class="checkbox" name="profile_allow_msg" value="1" <?php if (isset($profile['profile_allow_msg']) && $profile['profile_allow_msg'] == 1) echo "checked=\"checked\"";?> />
											</td>
											<td valign="top">
												<label style="width:100%" for="id_profile_allow_msg"><?php echo $lang['txt_profile_allow_msg'];?></label><br />
											</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
						</fieldset>


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

						<fieldset>
						<legend><?php echo $lang['txt_header_2'];?></legend>
						<p>
						<?php echo $lang['txt_detail_intro'];?><br />
						</p>

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

						<table border="0" cellspacing="0" cellpadding="2" width="10%">
							<tr>
								<td valign="top">
									<label for="id_profile_summary"><?php echo $lang['form_body'];?></label>
									<div id="gui_wiki" align="right" valign="bottom">
										<script language="JavaScript" type="text/javascript" src="js/gui_wiki.js"></script>
									</div>
								</td>
							</tr>
							<tr>
								<td>
									<textarea id="id_profile_summary" name="profile_summary" cols="78" rows="10" onchange="textChanged = true;" tabindex="1"><?php if (isset($profile['profile_summary'])) { echo $profile['profile_summary'];}?></textarea><br />
									<script language="JavaScript" type="text/javascript">
										var txtarea = document.frm.profile_summary;
									</script>
								</td>
							</tr>
							<?php
							if (isset($allow_spellcheck)) {
							?>
							<tr>
								<td align="right">
									<input type="submit" name="preview" value="<?php echo $lang['form_submit_preview'];?>" class="button_light" />&nbsp;&nbsp;
									<input type="button" value="<?php echo $lang['txt_check_spelling'];?>" onClick="openSpellChecker();" class="button_light" /><br />
								</td>
							</tr>
							<?php }?>

							<?php
							if (!empty($profile['profile_summary_preview'])) {
							?>

							<tr>
								<td>
									<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="6" alt="" /><br />
								</td>
							</tr>
							<tr>
								<td>
									<?php echo $lang['form_label_preview'];?><br />
								</td>
							</tr>
							<tr>
								<td class="picture_light">
									<?php echo $profile['profile_summary_preview'];?><br />
								</td>
							</tr>
							<?php }?>
						</table>
						</fieldset>

					</td>
					<td>
						<img src="<?php echo $templatePath;?>img/pixel.png" width="10" height="1" alt="" /><br />
					</td>
					<td valign="top" width="200">
						<fieldset>
						<legend><?php echo $lang['txt_header_3'];?></legend>
						<p>
						<?php echo $lang['txt_image_intro'];?><br />
						</p>

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

						<?php
						if (isset($images)) {
						?>
						<p>
						<?php echo $lang['form_label_file'];?></label><br />
						</p>

						<div>
						<p>
						<select id="id_file_id" size=4 name="file_id" onChange='javascript:setimg(this)'>
						<option value="0" selected="selected"><?php echo $lang['txt_img_none'];?></option>
						<?php
						$img_divs = "";
						foreach($images as $key => $i):
						$display_state = "none";
						$selected = "";
						if (isset($profile['file_id']) && $profile['file_id'] == $i['file_id']) {
							$selected = "selected=\"selected\"";
							$display_state = "block";
						}
						?>
						<option value="<?php echo $i['file_id'];?>" <?php echo $selected;?>><?php echo $i['file_name'];?></option>
						<?php
						$img_divs .= "<div style=\"display:" . $display_state . ";\" id=img" . $i['file_id'] . "><img src=\"get_file.php?file=" . $i['file'] . "\" border=\"0\" class=\"picture\" /><br />" . $i['file_title'] . "</div>";
						endforeach;
						?>
						</select>
						</p>
						</div>
						<?php echo $img_divs;?>
						<?php }?>
						</fieldset>

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

						<fieldset>
						<legend><?php echo $lang['txt_header_5'];?></legend>
						<p>
						<?php echo $lang['txt_save_intro'];?><br />
						</p>

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

						<input type="submit" name="save" class="button_urgent" value="<?php echo $lang['form_submit_save'];?>" />&nbsp;
						<input type="submit" name="save_go" class="button_urgent" value="<?php echo $lang['form_submit_save_go'];?>" /><br />

						</fieldset>
						</td>
					</tr>
			</table>
			</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>
<?php
}
else if (isset($display) && $display == "view_profile") {
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td width="180" valign="top">
			<div id="box_side2">
				<?php echo $profile['profile_nic'];?><br />
			</div>

			<div id="box_side1">
				<table border="0" cellspacing="0" cellpadding="2" width="100%">
					<tr>
						<td colspan="2">
							<img src="get_file.php?file=<?php echo $profile['image']['file'];?>" border="0" alt="<?php echo $profile['image']['file_title'];?>" class="picture_light" /><br />
						</td>
					</tr>
					<tr>
						<td>
							<?php echo $lang['txt_profile_hometown'];?><br />
						</td>
						<td>
							<?php echo $profile['profile_hometown'];?><br />
						</td>
					</tr>
					<tr>
						<td valign="top">
							<?php echo $lang['txt_profile_create_datetime'];?><br />
						</td>
						<td>
							<?php echo $profile['display_profile_create_datetime'];?><br />
						</td>
					</tr>
				</table>
				<br />

				<?php
				if (isset($profile_statistic)) {
				?>
				<hr />
				<table border="0" width="100%" cellspacing="0" cellpadding="2">
					<?php
					foreach($profile_statistic as $key => $i):
					?>
					<tr>
						<td>
							<?php echo $lang['arr_user_statistic_type_id'][$i['statistic_type_id']];?><br />
						</td>
						<td align="right">
							<?php echo $i['total'];?><br />
						</td>
					</tr>
					<?php
					endforeach;
					?>
				</table>
				<?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>

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


		<td width="560" valign="top">
			<div class="box_top">
				<?php echo $lang['hdr_summary'];?><br />
			</div>

			<div class="box_mid" style="padding: 9px;">
			<table width="100%" cellpadding="4" cellspacing="0" border="0">
				<tr>
					<td valign="top">
						<?php echo $profile['profile_summary_display'];?><br />
					</td>
				</tr>
			</table>

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

			<table width="100%" cellpadding="4" cellspacing="0" border="0">
				<tr>
					<td>
						<b><?php echo $lang['hdr_contact'];?></b><br />
					</td>
				</tr>
				<?php
				if (!empty($lang['txt_profile_text1'])) {
				?>
				<tr>
					<td>
						<?php echo $lang['txt_profile_text1'];?><br />
					</td>
					<td>
						<?php echo $profile['profile_text1'];?><br />
					</td>
				</tr>
				<?php }?>

				<?php
				if (!empty($lang['txt_profile_text2'])) {
				?>
				<tr>
					<td>
						<?php echo $lang['txt_profile_text2'];?><br />
					</td>
					<td>
						<?php echo $profile['profile_text2'];?><br />
					</td>
				</tr>
				<?php }?>

				<?php
				if (!empty($lang['txt_profile_text3'])) {
				?>
				<tr>
					<td>
						<?php echo $lang['txt_profile_text3'];?><br />
					</td>
					<td>
						<?php echo $profile['profile_text3'];?><br />
					</td>
				</tr>
				<?php }?>

				<?php
				if (!empty($lang['txt_profile_text4'])) {
				?>
				<tr>
					<td>
						<?php echo $lang['txt_profile_text4'];?><br />
					</td>
					<td>
						<?php echo $profile['profile_text4'];?><br />
					</td>
				</tr>
				<?php }?>

				<?php
				if (!empty($lang['txt_profile_text5'])) {
				?>
				<tr>
					<td>
						<?php echo $lang['txt_profile_text5'];?><br />
					</td>
					<td>
						<?php echo $profile['profile_text5'];?><br />
					</td>
				</tr>
				<?php }?>

				<?php
				if (!empty($lang['txt_profile_text6'])) {
				?>
				<tr>
					<td>
						<?php echo $lang['txt_profile_text6'];?><br />
					</td>
					<td>
						<?php echo $profile['profile_text6'];?><br />
					</td>
				</tr>
				<?php }?>

				<?php
				if (!empty($lang['txt_profile_text7'])) {
				?>
				<tr>
					<td>
						<?php echo $lang['txt_profile_text7'];?><br />
					</td>
					<td>
						<?php echo $profile['profile_text7'];?><br />
					</td>
				</tr>
				<?php }?>

				<?php
				if (!empty($lang['txt_profile_text8'])) {
				?>
				<tr>
					<td>
						<?php echo $lang['txt_profile_text8'];?><br />
					</td>
					<td>
						<?php echo $profile['profile_text8'];?><br />
					</td>
				</tr>
				<?php }?>

				<?php
				if (!empty($lang['txt_profile_text9'])) {
				?>
				<tr>
					<td>
						<?php echo $lang['txt_profile_text9'];?><br />
					</td>
					<td>
						<?php echo $profile['profile_text9'];?><br />
					</td>
				</tr>
				<?php }?>

				<?php
				if (!empty($lang['txt_profile_text10'])) {
				?>
				<tr>
					<td>
						<?php echo $lang['txt_profile_text10'];?><br />
					</td>
					<td>
						<?php echo $profile['profile_text10'];?><br />
					</td>
				</tr>
				<?php 
				}
				if (isset($profile['profile_id'])) {
				?>
				<tr>
					<td colspan="2">
						<div class="box_edit">
							<table width="100%" cellpadding="2" cellspacing="0" border="0">
								<tr>
									<td valign="top">
										<?php
										if (empty($group_profiles) && empty($profile['profile_default'])) {
										?>
										<input type="submit" name="delete_profile" class="button" value="<?php echo $lang['sub_delete'];?>" /><br />
										<?php
										}
										else {
											echo $lang['txt_no_delete'] . "<br />";
										}
										?>
									</td>
									<td nowrap="nowrap" valign="top" align="right">
										<a href="my_profile.php?edit_profile=1&amp;profile_id=<?php echo $profile['profile_id'];?>" class="link_stnd"><?php echo $lang['href_edit_profile'];?></a>
										&nbsp;&nbsp;
										<a href="my_profile.php" class="link_stnd"><?php echo $lang['href_list_profiles'];?></a><br />
									</td>
								</tr>
							</table>
						</div>
					</td>
				</tr>
				<?php }?>
			</table>

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

			<table width="100%" cellpadding="4" cellspacing="0" border="0">
				<tr>
					<td colspan="2">
						<b><?php echo $lang['hdr_privacy'];?></b><br />
					</td>
				</tr>
				<tr>
					<td>
						<?php
						if (isset($profile['profile_allow_msg']) && $profile['profile_allow_msg'] == 1) {
							echo $lang['txt_msg_allow'];
						}
						else {
							echo $lang['txt_msg_deny'];
						}
						?>
						<br />
					</td>
				</tr>
			</table>
			</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>

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

			<div class="box_top">
				<?php echo $lang['hdr_group_usage'];?><br />
			</div>

			<div class="box_mid" style="padding: 9px;">
			<table border="0" cellspacing="0" cellpadding="4" width="100%">
				<?php
				if (isset($group_profiles)) {
				foreach($group_profiles as $key => $i):
				?>
				<tr>
					<td valign="top">
						<a href="g_group.php?group_id=<?php echo $i['group_id'];?>"><?php echo $i['group_title'];?></a><br />
					</td>
					<td valign="top">
						<a href="my_profile.php?profile_id=<?php echo $i['profile_id'];?>"><?php echo $i['profile_name'];?></a><br />
					</td>
					<td valign="top" align="right">
						<?php echo $i['profile_nic'];?><br />
					</td>
				</tr>
				<?php
				endforeach;
				}
				else {
				?>
				<tr>
					<td colspan="4">
						<?php echo $lang['err_no_profile_usage'];?><br />
					</td>
				</tr>
				<?php }?>
			</table>
			</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>
<?php
}
else {
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td width="370" valign="top">
			<div class="box_top">
				<?php echo $lang['hdr_profiles'];?><br />
			</div>

			<div class="box_mid" style="padding: 9px;">
			<table border="0" cellspacing="0" cellpadding="4" width="100%">
				<tr>
					<td colspan="4">
						<?php echo $lang['txt_profiles_intro'];?><br />
					</td>
				</tr>
				<tr>
					<td colspan="4">
						<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />
					</td>
				</tr>
				<?php
				if (isset($profiles)) {
				foreach($profiles as $key => $i):
				?>
				<tr>
					<td valign="top">
						<a href="my_profile.php?profile_id=<?php echo $i['profile_id'];?>"><img src="get_file.php?file=<?php echo $i['image']['file'];?>" align="left" border="0" class="picture" alt="<?php echo $i['image']['file_title'];?>" /></a><br />
					</td>
					<td valign="top">
						<a href="my_profile.php?profile_id=<?php echo $i['profile_id'];?>"><?php echo $i['profile_name'];?></a><br />
					</td>
					<td valign="top">
						<?php echo $i['profile_nic'];?><br />
					</td>
					<td valign = "top" align="right">
						<?php
						$selected = "";
						if ($i['profile_default'] == 1) {
						    $selected = "checked=\nchecked\n";
						}
						?>
						<input type="radio" name="data[default_profile_default]" value="<?php echo $i['profile_id'];?>" <?php echo $selected;?> /><br />
					</td>
				</tr>
				<?php
				endforeach;
				?>
				<tr>
					<td align="right" colspan="4">
							<a href="my_profile.php?add_profile=1" class="link_urgent"><?php echo $lang['href_add_profile'];?></a>
						&nbsp;
						<input type="submit" name="set_default" value="<?php echo $lang['sub_update_default_profile'];?>" class="button_urgent" /><br />
					</td>
				</tr>
				<?php
				}
				else {
				?>
				<tr>
					<td colspan="4">
						<?php echo $lang['err_no_profiles'];?><br />
					</td>
				</tr>
				<?php
				}
				?>
			</table>

			<br />
			<hr />
			<table border="0" width="100%" cellspacing="0" cellpadding="2">
				<tr>
					<td>
						<?php echo $lang['txt_profile_view_hint'];?><br />
					</td>
				</tr>
			</table>
			</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>

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

		<td width="370" valign="top">
			<div class="box_top">
				<?php echo $lang['hdr_group_usage'];?><br />
			</div>

			<div class="box_mid" style="padding: 9px;">
			<table border="0" cellspacing="0" cellpadding="4" width="100%">
				<?php
				if (isset($group_profiles)) {
				foreach($group_profiles as $key => $i):
				?>
				<tr>
					<td valign="top">
						<a href="g_group.php?group_id=<?php echo $i['group_id'];?>"><?php echo $i['group_title'];?></a><br />
					</td>
					<td valign="top">
						<a href="my_profile.php?profile_id=<?php echo $i['profile_id'];?>"><?php echo $i['profile_name'];?></a><br />
					</td>
					<td valign="top" align="right">
						<?php echo $i['profile_nic'];?><br />
					</td>
				</tr>
				<?php
				endforeach;
				}
				else {
				?>
				<tr>
					<td colspan="4">
						<?php echo $lang['err_no_profile_usage'];?><br />
					</td>
				</tr>
				<?php }?>
			</table>
			</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>
		<?php }?>





			<?php
			if (!isset($profile) && (isset($display) &&$display != "edit_profile")) {
			?>
			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="25" alt="" /><br />

			<table border="1" cellspacing="0" cellpadding="4" width="100%" class="table_stnd">
				<tr>
					<td colspan="2" class="txt_title" align="right">
						<?php echo $lang['hdr_degree_usage'];?><br />
						<hr />
					</td>
				</tr>
				<?php
				foreach($lang['sn']['degree'] as $key => $i):
				?>
				<tr>
					<td valign="top">
						<?php echo $i;?><br />
					</td>
					<td align="right">
						<select name="data[set_degree_profile_ids][<?php echo $key;?>]" class="formInput">
							<?php
							foreach($profiles as $key1 => $r):

								if (isset($degree_profiles)) {
									$selected1="";
								    foreach($degree_profiles as $keydp => $dp):
										if ($key == $dp['degree_id'] && $r['profile_id'] == $dp['profile_id']) {
											$selected1=" selected=\"selected\"";
											break;
										}
									endforeach;
								}

								print "<option value='" . $r['profile_id'] . "' " . $selected1  . ">" . $r['profile_name'] . "</option>";
							endforeach;
							?>
						</select>
						<br />
					</td>
				</tr>
				<?php
				endforeach;
				?><tr>
					<td align="right" colspan="4">
						<input type="submit" name="set_degree" value="<?php echo $lang['sub_update_degree_profile'];?>" class="formInput" /><br />
					</td>
				</tr>
			</table>
			<?php }?>
		</td>
	</tr>
</table>
</form>
