<?php
    include('object.php');
?>
<!doctype html>

<html class="no-js" lang="en"> <!--<![endif]-->
<head>
	<meta charset="utf-8">

	<link rel="dns-prefetch" href="http://fonts.googleapis.com" />
	<link rel="dns-prefetch" href="http://themes.googleusercontent.com" />
	
	<link rel="dns-prefetch" href="http://ajax.googleapis.com" />
	<link rel="dns-prefetch" href="http://cdnjs.cloudflare.com" />
	<link rel="dns-prefetch" href="http://agorbatchev.typepad.com" />
	
	<!-- Use the .htaccess and remove these lines to avoid edge case issues.
	   More info: h5bp.com/b/378 -->
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	
	<title>Profile - Student Portal</title>
	
	<?php include('meta.php'); ?>

	<!-- Mobile viewport optimized: h5bp.com/viewport -->
	<meta name="viewport" content="width=device-width,initial-scale=1">
	<!-- iPhone: Don't render numbers as call links -->
	<meta name="format-detection" content="telephone=no">
	
	<?php include('ico.php'); ?>
	
	<!-- Layout Styles -->
	<link rel="stylesheet" href="css/style.css">
	<link rel="stylesheet" href="css/grid.css">
	<link rel="stylesheet" href="css/layout.css">
	
	<!-- Icon Styles -->
	<link rel="stylesheet" href="css/icons.css">
	<link rel="stylesheet" href="css/fonts/font-awesome.css">
	<!--[if IE 8]><link rel="stylesheet" href="css/fonts/font-awesome-ie7.css"><![endif]-->
	
	<!-- External Styles -->
	<link rel="stylesheet" href="css/external/jquery-ui-1.8.21.custom.css">
	<link rel="stylesheet" href="css/external/jquery.chosen.css">
	<link rel="stylesheet" href="css/external/jquery.cleditor.css">
	<link rel="stylesheet" href="css/external/jquery.colorpicker.css">
	<link rel="stylesheet" href="css/external/jquery.elfinder.css">
	<link rel="stylesheet" href="css/external/jquery.fancybox.css">
	<link rel="stylesheet" href="css/external/jquery.jgrowl.css">
	<link rel="stylesheet" href="css/external/jquery.plupload.queue.css">
	<link rel="stylesheet" href="css/external/syntaxhighlighter/shCore.css" />
	<link rel="stylesheet" href="css/external/syntaxhighlighter/shThemeDefault.css" />
	
	<!-- Elements -->
	<link rel="stylesheet" href="css/elements.css">
	<link rel="stylesheet" href="css/forms.css">
	
	<!-- OPTIONAL: Print Stylesheet for Invoice -->
	<link rel="stylesheet" href="css/print-invoice.css">
	
	<!-- Typographics -->
	<link rel="stylesheet" href="css/typographics.css">
	
	<!-- Responsive Design -->
	<link rel="stylesheet" href="css/media-queries.css">
	
	<!-- Bad IE Styles -->
	<link rel="stylesheet" href="css/ie-fixes.css">
	
	<!-- Load Webfont loader -->
	<script type="text/javascript">
		window.WebFontConfig = {
			google: { families: [ 'PT Sans:400,700' ] },
			active: function(){ $(window).trigger('fontsloaded') }
		};
	</script>
	<script defer async src="https://ajax.googleapis.com/ajax/libs/webfont/1.0.28/webfont.js"></script>
	
	<!-- Essential polyfills -->
	<script src="js/mylibs/polyfills/modernizr-2.6.1.min.js"></script>
	<script src="js/mylibs/polyfills/respond.js"></script>
	<script src="js/mylibs/polyfills/matchmedia.js"></script>
	<!--[if lt IE 9]><script src="js/mylibs/polyfills/selectivizr.js"></script><![endif]-->
	<!--[if lt IE 10]><script src="js/mylibs/polyfills/excanvas.js"></script><![endif]-->
	<!--[if lt IE 10]><script src="js/mylibs/polyfills/classlist.js"></script><![endif]-->
	
	
	
	<!-- Grab frameworks from CDNs -->
		<!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline -->
	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js"></script>
	<script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.2.js"><\/script>')</script>
	
		<!-- Do the same with jQuery UI -->
	<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.js"></script>
	<script>window.jQuery.ui || document.write('<script src="js/libs/jquery-ui-1.8.21.js"><\/script>')</script>
	
		<!-- Do the same with Lo-Dash.js -->
	<!--[if gt IE 8]><!-->
	<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/0.4.2/lodash.js"></script>
	<script>window._ || document.write('<script src="js/libs/lo-dash.js"><\/script>')</script>
	<!--<![endif]-->
	<!-- IE8 doesn't like lodash -->
	<!--[if lt IE 9]><script src="http://documentcloud.github.com/underscore/underscore.js"></script><![endif]-->
	
	<!-- General Scripts -->
	<script src="js/mylibs/jquery.hashchange.js"></script>
	<script src="js/mylibs/jquery.idle-timer.js"></script>
	<script src="js/mylibs/jquery.plusplus.js"></script>
	<script src="js/mylibs/jquery.jgrowl.js"></script>
	<script src="js/mylibs/jquery.scrollTo.js"></script>
	<script src="js/mylibs/jquery.ui.touch-punch.js"></script>
	<script src="js/mylibs/jquery.ui.multiaccordion.js"></script>
	<script src="js/mylibs/number-functions.js"></script>
	
	<!-- Forms -->
	<script src="js/mylibs/forms/jquery.autosize.js"></script>
	<script src="js/mylibs/forms/jquery.checkbox.js"></script>
	<script src="js/mylibs/forms/jquery.chosen.js"></script>
	<script src="js/mylibs/forms/jquery.cleditor.js"></script>
	<script src="js/mylibs/forms/jquery.colorpicker.js"></script>
	<script src="js/mylibs/forms/jquery.ellipsis.js"></script>
	<script src="js/mylibs/forms/jquery.fileinput.js"></script>
	<script src="js/mylibs/forms/jquery.fullcalendar.js"></script>
	<script src="js/mylibs/forms/jquery.maskedinput.js"></script>
	<script src="js/mylibs/forms/jquery.mousewheel.js"></script>
	<script src="js/mylibs/forms/jquery.placeholder.js"></script>
	<script src="js/mylibs/forms/jquery.pwdmeter.js"></script>
	<script src="js/mylibs/forms/jquery.ui.datetimepicker.js"></script>
	<script src="js/mylibs/forms/jquery.ui.spinner.js"></script>
	<script src="js/mylibs/forms/jquery.validate.js"></script>
	<script src="js/mylibs/forms/uploader/plupload.js"></script>
	<script src="js/mylibs/forms/uploader/plupload.html5.js"></script>
	<script src="js/mylibs/forms/uploader/plupload.html4.js"></script>
	<script src="js/mylibs/forms/uploader/plupload.flash.js"></script>
	<script src="js/mylibs/forms/uploader/jquery.plupload.queue/jquery.plupload.queue.js"></script>
		
	<!-- Charts -->
	<script src="js/mylibs/charts/jquery.flot.js"></script>
	<script src="js/mylibs/charts/jquery.flot.orderBars.js"></script>
	<script src="js/mylibs/charts/jquery.flot.pie.js"></script>
	<script src="js/mylibs/charts/jquery.flot.resize.js"></script>
	
	<!-- Explorer -->
	<script src="js/mylibs/explorer/jquery.elfinder.js"></script>
	
	<!-- Fullstats -->
	<script src="js/mylibs/fullstats/jquery.css-transform.js"></script>
	<script src="js/mylibs/fullstats/jquery.animate-css-rotate-scale.js"></script>
	<script src="js/mylibs/fullstats/jquery.sparkline.js"></script>
	
	<!-- Syntax Highlighter -->
	<script src="js/mylibs/syntaxhighlighter/shCore.js"></script>
	<script src="js/mylibs/syntaxhighlighter/shAutoloader.js"></script>
	
	<!-- Dynamic Tables -->
	<script src="js/mylibs/dynamic-tables/jquery.dataTables.js"></script>
	<script src="js/mylibs/dynamic-tables/jquery.dataTables.tableTools.zeroClipboard.js"></script>
	<script src="js/mylibs/dynamic-tables/jquery.dataTables.tableTools.js"></script>
	
	<!-- Gallery -->
	<script src="js/mylibs/gallery/jquery.fancybox.js"></script>
	
	<!-- Tooltips -->
	<script src="js/mylibs/tooltips/jquery.tipsy.js"></script>
	
	<!-- Do not touch! -->
	<script src="js/mango.js"></script>
	<script src="js/plugins.js"></script>
	<script src="js/script.js"></script>
	
	<!-- Your custom JS goes here -->
	<script src="js/app.js"></script>
	
</head>

<body>

	<?php
      include('connect.php');
	  
	  $page = "Profile";
      
      include('session.php');

      $time = time();
      $year = date('Y',$time);

  ?>

	<!----------------------->
	<!-- Some dialogs etc. -->

	<!-- The loading box -->
	<div id="loading-overlay"></div>
	<div id="loading">
		<span>Loading...</span>
	</div>
	<!-- End of loading box -->
	
	<script>
	$$.ready(function() {
		$( "#dialog_add_client" ).dialog({
			autoOpen: false,
			modal: true,
			width: 600,
			open: function(){ $(this).parent().css('overflow', 'visible'); $$.utils.forms.resize() }
		}).find('button.submit').click(function(){
			var $el = $(this).parents('.ui-dialog-content');
			if ($el.validate().form()) {
				$el.find('form')[0].reset();
				$el.dialog('close');
			}
		}).end().find('button.cancel').click(function(){
			var $el = $(this).parents('.ui-dialog-content');
			$el.find('form')[0].reset();
			$el.dialog('close');;
		});
		
		$( ".open-add-client-dialog" ).click(function() {
			$( "#dialog_add_client" ).dialog( "open" );
			return false;
		});
	});
	</script>
	<!--  End of Add Client Example Dialog -->
	
	<script>
	$$.ready(function() {
		$( "#dialog_message" ).dialog({
			autoOpen: false,
			width: 600,
			modal: true
		}).find('button').click(function(){
			$(this).parents('.ui-dialog-content').dialog('close');
		});
		
		$( ".open-message-dialog" ).click(function() {
			$( "#dialog_message" ).dialog( "open" );
			return false;
		});
	});
	</script>
	<!-- End of Message Dialog -->
	
	<!--------------------------------->
	<!-- Now, the page itself begins -->
	<!--------------------------------->
	
	<!-- The toolbar at the top -->
	<?php include('topmenu.php'); ?>
	<!-- End of #toolbar -->
	
	<!-- The header containing the logo -->
	<?php include('middlemenu.php'); ?>
	<!-- End of header -->
	
	<!-- The container of the sidebar and content box -->
	<div role="main" id="main" class="container_12 clearfix">
	
		<!-- The blue toolbar stripe -->
		<?php include('menu_profile.php'); ?>
		<!-- End of .toolbar-->
		
		<!-- The sidebar -->
		<aside>
			<div class="top">
			
				<!-- Navigation -->
					<?php include('nav.php'); ?>
				<!-- End of nav -->				
			</div><!-- End of .top -->
		</aside><!-- End of sidebar -->

		<!-- Here goes the content. -->
		<section id="content" class="container_12 clearfix" data-sort=true>
			<div class="grid_12 profile">
			
				<div class="header">
				
					<div class="title">
						<h2><?php echo $surname.' '.$first_name; ?></h2>
						<h3><?php echo $user; ?></h3>
					</div>
				</div><!-- End of .header -->
				
				<?php
						$citizenship = mysql_real_escape_string(isset($_POST['citizenship'])?  $_POST['citizenship']:'');
						$residential = mysql_real_escape_string(isset($_POST['residential'])?  $_POST['residential']:'');
						$postal = mysql_real_escape_string(isset($_POST['postal'])?  $_POST['postal']:'');

						if(isset($_POST['save_address']))
						{
							$query = "UPDATE student_info SET citizenship='$citizenship',postal_address='$postal',physical_address='$residential' WHERE st_id='$user'";
							  if(mysqli_query($connection,$query))
							  {?>
								<div class="alert success">
									<span class="icon"></span>
									<strong>Success!</strong> Successfully updated your address.
								</div>
							  <?php 
							  }
							  else
							  {?>
									<div class="alert error no-margin-top">
										<span class="icon"></span>
										<strong>Error!</strong> Could not update your address!
									</div>
							  <?php 
							  }
						}
						
						$other_names = mysql_real_escape_string(isset($_POST['other_names'])? $_POST['other_names']:'');
						$email = mysql_real_escape_string(isset($_POST['email'])? $_POST['email']:'');
						$dob = mysql_real_escape_string(isset($_POST['dob'])? $_POST['dob']:'');
						$gender = mysql_real_escape_string(isset($_POST['gender'])? $_POST['gender']:'');
						$language = mysql_real_escape_string(isset($_POST['language'])? $_POST['language']:'');
						$cellno = mysql_real_escape_string(isset($_POST['cellno'])? $_POST['cellno']:'');
						
						if(substr($dob,2,1) == '/')
						{
							$tokens = explode("/",$dob);
							
							$dob = $tokens['2'].'-'.$tokens['0'].'-'.$tokens['1'];
						}
						
						if(isset($_POST['save_info']))
						{
							$query = "UPDATE student_info SET email='$email',dob='$dob',gender='$gender',
											home_language='$language',cellno='$cellno',other_names='$other_names' WHERE st_id='$user'";
							  if(mysqli_query($connection,$query))
							  {?>
								<div class="alert success">
									<span class="icon"></span>
									<strong>Success!</strong> Successfully updated your personal information.
								</div>
							  <?php 
							  }
							  else
							  {?>
									<div class="alert error no-margin-top">
										<span class="icon"></span>
										<strong>Error!</strong> Could not update your personal information.
									</div>
							  <?php 
							  }
						}
						
						$know_about_us = mysql_real_escape_string(isset($_POST['know_about_us'])?  $_POST['know_about_us']:'');
						$recieve_info_by = mysql_real_escape_string(isset($_POST['recieve_info_by'])?  $_POST['recieve_info_by']:'');
						$share_your_details = mysql_real_escape_string(isset($_POST['share_your_details'])?  $_POST['share_your_details']:'');
						$disabled = mysql_real_escape_string(isset($_POST['disabled'])?  $_POST['disabled']:'');
						$disability = mysql_real_escape_string(isset($_POST['disability'])?  $_POST['disability']:'');
						
						if(isset($_POST['save_office']))
						{
							$query = "UPDATE student_info SET disabled='$disabled',disability='$disability',know_about_us='$know_about_us',
											recieve_info_by='$recieve_info_by',share_your_details='$share_your_details'
											 WHERE st_id='$user'";
							  if(mysqli_query($connection,$query))
							  {?>
								<div class="alert success">
									<span class="icon"></span>
									<strong>Success!</strong> Successfully updated your personal information.
								</div>
							  <?php 
							  }
							  else
							  {?>
									<div class="alert error no-margin-top">
										<span class="icon"></span>
										<strong>Error!</strong> Could not update your personal information.
									</div>
							  <?php 
							  }
						}
						
					require_once('fetch_student_info.php');
					
					$fill = isset($_GET['fill'])? ($_GET['fill']):'';
					
					if($fill == 2)
					{
						?>
							<div class="alert warning sticky no-margin-top">
								<span class="icon"></span>
								<strong>You haven't fully specified your profile information. Please do so to activate access to other pages. 
								Other Pages will not be accessible until you have filled all the fields in your profile. </strong>
							</div>
						<?php
					}
					
					if($fill == 1)
					{
						?>
							<div class="alert warning sticky no-margin-top">
								<span class="icon"></span>
								<strong>We do not have your profile information in our database. Please fill all the fields below to be able to 
								have access to all other pages. Otherwise you will not be able to browse other pages.</strong>
							</div>
						<?php
					}
				?>
				
				<div class="grid_12">
				<form action="profile.php" class="box validate" method="POST">
				
					<div class="header">
						<h2>Administrative Information</h2>
					</div>
					
					<div class="content">
						
						<div class="row">
							
							<div>
								<label for="v2_select">
									<strong>How did you know about Tswane College?</strong>
								</label>
								<select name="know_about_us" id="know_about_us" class="required" data-placeholder="Options">
									<option ></option>
									<option <?php if($know_about_us == 'Poster') echo 'selected'; ?> >Poster</option> 
									<option <?php if($know_about_us == 'Friend') echo 'selected'; ?> >Friend</option> 
									<option <?php if($know_about_us == 'Exhibition') echo 'selected'; ?> >Exhibition</option> 
									<option <?php if($know_about_us == 'Newspaper') echo 'selected'; ?> >Newspaper</option>
								</select>
							</div>
						</div>
						
						<div class="row">
							
							<div>
								<label for="v2_select">
									<strong>We may send you important info by</strong>
								</label>
								<select name="recieve_info_by" id="recieve_info_by" class="required" data-placeholder="Options">
									<option ></option>
									<option <?php if($recieve_info_by == 'Email') echo 'selected'; ?> >Email</option> 
									<option <?php if($recieve_info_by == 'SMS') echo 'selected'; ?> >SMS</option>
								</select>
							</div>
						</div>
						
						<div class="row">
							
							<div>
								<label>
								<strong>May we share your contact details with recruitment agencies?</strong>
							</label>
								<select name="share_your_details" id="share_your_details" class="required" data-placeholder="Options">
									<option></option>
									<option <?php if($share_your_details == 'Yes') echo 'selected'; ?> >Yes</option> 
									<option <?php if($share_your_details == 'No') echo 'selected'; ?> >No</option>
								</select>
							</div>
						</div>
						
						<div class="row">
							
							<div>
								<label for="v2_select">
								<strong>Disabled</strong>
							</label>
								<select name="disabled" id="disabled" class="required" data-placeholder="Options">
									<option></option>
									<option <?php if($disabled == 'Yes') echo 'selected'; ?> >Yes</option> 
									<option <?php if($disabled == 'No') echo 'selected'; ?> >No</option>
								</select>
							</div>
						</div>
						
						<div class="row">
							
							<div>
								<label for="v1_minchars">
								<strong>Disability</strong>
							</label>
								<input type="text" name="disability" id=v1_minchars value="<?php echo $disability; ?>" />
							</div>
						</div>
						
					</div><!-- End of .content -->
					
					<div class="actions">
						<div class="left">
							<input type="reset" value="Cancel" />
						</div>
						<div class="right">
							<input type="submit" value="Submit" name="save_office" />
						</div>
					</div><!-- End of .actions -->
					
				</form><!-- End of .box -->
			</div><!-- End of .grid_4 -->
				
				<div class="details grid_12">
					<h2>Academic Information</h2>
					<section>
							<table class="styled borders" style="width:95%; padding: 4px; ">
								<thead>
									<tr>
										<th>Course Code</th>
										<th>Course</th>
										<th>Academic Year</th>
										<th>Level</th>
										<th>Department</th>
									</tr>
								</thead>
								<tbody>
									<?php
										  $query2 = "SELECT es.CourseCode,c.course_name,es.AcaID,c.courselevel,c.department_name FROM enrolstudent es,courses c WHERE es.StuNo='$user' AND es.CourseCode=c.course_code";
										  $subject_set2 = mysqli_query($connection,$query2); 
											  //4. Use return data

										  while($row2 = mysqli_fetch_array($subject_set2)) 
										  {
											echo $output=
											  '<tr>
											  <td>'.$row2["CourseCode"].'</td>
											  <td>'.$row2["course_name"].'</td>
											  <td>'.$row2["AcaID"].'</td>
											  <td>'.$row2["courselevel"].'</td>
											  <td>'.$row2["department_name"].'</td>
											  </tr>';
										  }
									?>
								</tbody>
							</table>
					</section>
				</div><!-- End of .details -->
				
				<div class="details grid_12">
					<h2>Personal Details</h2>
					<a href="javascript:void(0);" class="button grey open-add-client-dialog"><span class="icon icon-pencil"></span>Update Details</a>
					<section>
						<table>
							<tr>
								<th>ID No:</th><td><?php echo $id_no; ?></td>
							</tr>
							<tr>
								<th>Names:</th><td><?php echo $surname.' '.$first_name.' '.$other_names; ?></td>
							</tr>
							<tr>
								<th>Email:</th><td><i><?php echo $email; ?></i></td>
							</tr>
							<tr>
								<th>DOB:</th><td><?php echo $dob; ?></td>
							</tr>
							<tr>
								<th>Gender:</th><td><?php echo $gender; ?></td>
							</tr>
							<tr>
								<th>Language:</th><td><?php echo $home_language; ?></td>
							</tr>
							<tr>
								<th>Cell:</th><td><?php echo $cellno; ?></td>
							</tr>
						</table>
					</section>
					<section>
						<table>
							
						</table>
					</section>
				</div><!-- End of .details -->
				
				<div class="details grid_12">
					<h2>Address</h2>
					<a href="javascript:void(0);" class="button grey open-profile-dialog"><span class="icon icon-pencil"></span>Update Address</a>
					<section>
						<table id="address">
							<tr>
								<th>Citizenship:</th><td><?php echo $citizenship; ?></td>
							</tr>
							<tr>
								<th>Residential:</th><td><?php echo $physical_address; ?></td>
							</tr>
							<tr>
								<th>Postal:</th><td><?php echo $postal_address; ?></td>
							</tr>
						</table>
					</section>
				</div><!-- End of .details -->
				
				<div class="divider">
				</div>
				
				<!--Adress -->							
				<div style="display: none;" id="profile-dialog" title="Your Address">
				
					<form action="" class="full validate" method="POST" action="profile.php?#address">
						<div class="row">
							<label for="d1_textfield">
								<strong>Citizenship</strong>
							</label>
							<div>
								<input class="required" type=text name="citizenship" id="citizenship" value="<?php echo $citizenship; ?>" />
							</div>
						</div>
						<div class="row">
							<label for="d1_spinner">
								<strong>Residential Address</strong>
							</label>
							<div>
								<input class="required" type=text name="residential" id="residential" value="<?php echo $physical_address; ?>" />
							</div>
						</div>
						<div class="row">
							<label for="d1_spinner">
								<strong>Postal Address</strong>
							</label>
							<div>
								<input class="required" type=text name="postal" id="postal"  value="<?php echo $postal_address; ?>" />
							</div>
						</div>
						<div class="row">
							<div class="right">
								<button class="submit" name="save_address">Save</button>
							</div>
						</div>
					</form>
				</div>
				<!-- End adress -->
				
					<!-- Administrative Information -->
					
					<!-- End of Administrative dialog -->
	
	
					<!-- Add Personal Details -->
					<div style="display: none;" id="dialog_add_client" title="Your Personal Details">
						<form action="profile.php" class="full validate" method="POST">
							<div class="row">
								<label for="d2_username">
									<strong>Other Names</strong>
								</label>
								<div>
									<input class="required" type=text name="other_names" id="d2_username" value="<?php echo $other_names; ?>" />
								</div>
							</div>
							<div class="row">
								<label for="d2_email">
									<strong>Email Address</strong>
								</label>
								<div>
									<input class="required" email=true type="text" name="email"  value="<?php echo $email; ?>" />
								</div>
							</div>
							<div class="row">
								<label for="dob">
									<strong>DOB</strong>
								</label>
								<div>
									<input class="required" type="date" name="dob" value="<?php echo $dob; ?>" />
								</div>
							</div>
							<div class="row">
								<label for="d2_role">
									<strong>Gender</strong>
								</label>
								<div>
									<select style="padding-bottom: 10px" name="gender" class="search required" data-placeholder="Gender">
										<option value=""></option>
										<option <?php if($gender == 'M') echo 'selected'; ?> >M</option> 
										<option <?php if($gender == 'F') echo 'selected'; ?> >F</option>
									</select>
								</div>
							</div>
							<div class="row">
								<label for="d2_username">
									<strong>Languages</strong>
								</label>
								<div>
									<input class="required" type=text name="language" value="<?php echo $home_language; ?>" />
								</div>
							</div>
							<div class="row">
								<label for="d2_username">
									<strong>Cell No</strong>
								</label>
								<div>
									<input class="required" type=text name="cellno" value="<?php echo $cellno; ?>" />
								</div>
							</div>
							<div class="row">
								<div class="right">
									<button type="submit" name="save_info">Save Information</button>
								</div>
							</div>
						</form>
					</div><!-- End Add Personal Details -->
				
			</div>
				
			<script>
				$$.ready(function() {				
				// Profile Dialog
				
				$( "#profile-dialog" ).dialog({
					autoOpen: false,
					modal: true,
					width: 400,
					open: function(){ $(this).parent().css('overflow', 'visible'); $$.utils.forms.resize() }
				}).find('button.submit').click(function(){
					var $el = $(this).parents('.ui-dialog-content');
					if ($el.validate().form()) {
						$el.dialog('close');
					}
				}).end().find('button.cancel').click(function(){
					var $el = $(this).parents('.ui-dialog-content');
					$el.find('form')[0].reset();
					$el.dialog('close');;
				});
				
				$( ".open-profile-dialog" ).click(function() {
					$( "#profile-dialog" ).dialog( "open" );
					return false;
				});
			});
			</script>
		</section><!-- End of #content -->
		
	</div><!-- End of #main -->
	
	<!-- The footer -->
		<?php include('footer.php'); ?>
	<!-- End of footer -->
	
	<?php include('expire.php'); ?>
	
	<!-- Spawn $$.loaded -->
	<script>
		$$.loaded();
	</script>

</body>
</html>