<?php
include('main.php');
include_once('header.php');
$student = new ManageStudents();
$scode = $_SESSION[$user_session_name];
$studentProp = $student->GetStudentInfoBySCode($scode);
$sid = $studentProp[0]['sid'];
$termList = $student->GetStudentTermList($sid);
if ($termList==0)
{
	echo '<div class="alert alert-error">
			  '._STUDENT_YOU_HAVE_NOT_REGISTERED_IN_ANY_COURSE.'!
		  </div>';

}
else
	{
		if(isset($_GET['op']) && $_GET['op']=="card")
		{
			echo '<script type="text/javascript">
				window.print();
			</script>';		
			echo '
			<div class="hero-unit"style="width:90%;  padding:20px; margin-right:5%; margin-left:5%; margin-top:0px;">
			<center style="font-family:Times New Roman; font-size:17px; font-weight:bold;">'.$institute_name.'</center>
			<br /><center style="font-family:Times New Roman; font-size:22px; font-weight:bold;">'._EXAM_CARD.' '._IN_TERM.' '.$termList[0]['tname'].' ('._TCODE.': '.$termList[0]['tcode'].')</center><br />
			<img src="img/institute_logo.png" style="height:80px; float:'.$align1.'; margin-'.$align2.':10px;" />
			';
			if(file_exists('img/students/'.$pic_prefix.$studentProp[0]['sid'].$studentProp[0]['spic'].''))
				echo '<img src="img/students/'.$pic_prefix.$studentProp[0]['sid'].$studentProp[0]['spic'].'" align="'.$align2.'" style="height:70px; float:'.$align2.';" />';
			else
				echo '<img src="img/student.png" align="'.$align2.'" style="height:70px; float:'.$align2.'" />';
			echo '
			<div style="width:300px; float:'.$align1.'">
			'._MAJOR.': <b>'.$studentProp[0]['smajor'].'</b><br />
			'._FULLNAME.': <b>'.$studentProp[0]['sfname'].' '.$studentProp[0]['slname'].'</b><br />'._SCODE.': <b>'.$studentProp[0]['scode'].'</b><br />
			'._DEGREE.': <b>'.$studentProp[0]['sdegree'].'</b><br />
			</div>
			<div style="width:150px; float:'.$align1.'">
			'._FANAME.': <b>'.$studentProp[0]['sfaname'].'</b><br />
			'._CARDID.': <b>'.$studentProp[0]['scardid'].'</b><br />
			</div>
			<div style="width:150px; float:'.$align1.'">
			'._PRINT_DATE.': <b>'.$today.'</b><br />
			
			</div>
			';
				echo '<div style="'.$table_width.'"><br clear="both" /><br />
						<table style="border:2px black solid; width:100%;">
										<tr class="default_font ">';
								echo '<td style="width:40px;" class="table_print_header">
									'._CCODE.'
									</td>';
								echo '<td style="width:50px;" class="table_print_header">
									'._LCODE.'
									</td>';
								echo '<td style="width:150px;" class="table_print_header">
									'._LESSON_NAME.'
									</td>';
								echo '<td style="width:50px;" class="table_print_header">
									'._FACTOR.'
									</td>';
								echo '<td style="width:100px;" class="table_print_header">
									'._TEACHER.'
									</td>';
								echo '<td style="width:150px" class="table_print_header">
									'._COURSE_EXAM_DATE_HEADER.'
									</td>';
								echo '<td style="width:80px" class="table_print_header">
									'._COURSE_EXAM_PLACE_HEADER.'
									</td>';
								echo '<td style="width:50px" class="table_print_header">
									'._CHAIR_NUMBER.'
									</td>';							
								echo '<td style="width:auto;" class="table_print_header">
									'._COURSE_COMMENTS.'
									</td>';
								echo '</tr>';
				$courseList = $student->GetStudentCourseList($sid,$termList[0]['tid']);
				$i=0;
				foreach ($courseList as $course_studentInfo)
				{
					if($i%2==0)
						$bgCourse = "tr_hover_class";
					else
						$bgCourse = "";
					echo '<tr style="height:30px; border-bottom:silver;" class="table_rows default_font '.$bgCourse.' table_rows_border">';
					echo '<td style="text-align:center;">
						'.$course_studentInfo['ccode'].'
						</td>';	
					echo '<td style="text-align:center;">
						'.$course_studentInfo['lcode'].'
						</td>';
					
					echo '<td style="text-align:'.$align1.';">
						'.$course_studentInfo['lname'].'
						</td>';
					
					echo '<td style="text-align:center;">
						'.$course_studentInfo['factor'].'
						</td>';
						
					echo '<td style="text-align:'.$align1.';">
						'.$course_studentInfo['pfname'].' '.$course_studentInfo['plname'].'
						</td>';

					echo '<td style="text-align:'.$align1.';">
						'.$course_studentInfo['exam_date'].'
						</td>';
					echo '<td style="text-align:'.$align1.';">
						'.$course_studentInfo['exam_place'].'
						</td>';
					echo '<td style="text-align:center;">
						'.$course_studentInfo['chair_number'].'
						</td>';
					echo '<td style="text-align:'.$align1.';">
						'.$course_studentInfo['cscomment'].' '.$course_studentInfo['ccomment'].'
						</td>';
		
					
					echo '</tr>';	
					$i++;
				}
				echo '</table><br /><br />';
				
			
	
		
			
		}
		else if(isset($_GET['op']) && $_GET['op']=="schedule")
		{
				
			
			echo '
			<script type="text/javascript">
				window.print();
			</script>
			
			<div class="hero-unit"style="width:90%;  padding:20px; margin-right:5%; margin-left:5%; margin-top:0px;">
			<center style="font-family:Times New Roman; font-size:22px; font-weight:bold;">'._SCHEDULE_CARD.' '._IN_TERM.' '.$termList[0]['tname'].' ('._TCODE.': '.$termList[0]['tcode'].')</center><br /><br />
			<img src="img/institute_logo.png" style="height:80px; float:'.$align1.'; margin-'.$align2.':10px;" />
			';
			if(file_exists('img/students/'.$pic_prefix.$studentProp[0]['sid'].$studentProp[0]['spic'].''))
				echo '<img src="img/students/'.$pic_prefix.$studentProp[0]['sid'].$studentProp[0]['spic'].'" align="'.$align2.'" style="height:70px; float:'.$align2.';" />';
			else
				echo '<img src="img/student.png" align="'.$align2.'" style="height:70px; float:'.$align2.'" />';
			echo '
			
			'._FULLNAME.': <b>'.$studentProp[0]['sfname'].' '.$studentProp[0]['slname'].'</b><br />'._SCODE.': <b>'.$studentProp[0]['scode'].'</b><br />
			'._MAJOR.': <b>'.$studentProp[0]['smajor'].'</b><br />
			'._DEGREE.': <b>'.$studentProp[0]['sdegree'].'</b><br />
			';
				echo '<div style="'.$table_width.'"><br clear="both" /><br />
						<table style="border:2px black solid; width:100%;">
										<tr class="default_font ">';
								echo '<td style="width:40px;" class="table_print_header">
									'._CCODE.'
									</td>';
								echo '<td style="width:50px;" class="table_print_header">
									'._LCODE.'
									</td>';
								echo '<td style="width:150px;" class="table_print_header">
									'._LESSON_NAME.'
									</td>';
								echo '<td style="width:30px;" class="table_print_header">
									'._FACTOR.'
									</td>';
								echo '<td style="width:100px;" class="table_print_header">
									'._TEACHER.'
									</td>';
								echo '<td style="width:150px" class="table_print_header">
									'._COURSE_DAYS.'
									</td>';
								echo '<td style="width:80px" class="table_print_header">
									'._CLNAME.'
									</td>';
								echo '<td style="width:80px" class="table_print_header">
									'._CLCODE.'
									</td>';
								echo '<td style="width:100px" class="table_print_header">
									'._CLADDRESS.'
									</td>';
								echo '<td style="width:150px;" class="table_print_header">
									'._COURSE_EXAM_DATE_HEADER.'
									</td>';								
								echo '<td style="width:auto;" class="table_print_header">
									'._COURSE_COMMENTS.'
									</td>';
								echo '</tr>';
				$courseList = $student->GetStudentCourseList($sid,$termList[0]['tid']);
				$i=0;
				foreach ($courseList as $course_studentInfo)
				{
					if($i%2==0)
						$bgCourse = "tr_hover_class";
					else
						$bgCourse = "";
					echo '<tr style="height:30px; border-bottom:silver;" class="table_rows default_font '.$bgCourse.' table_rows_border">';
					echo '<td style="text-align:center;">
						'.$course_studentInfo['ccode'].'
						</td>';	
					echo '<td style="text-align:center;">
						'.$course_studentInfo['lcode'].'
						</td>';
					
					echo '<td style="text-align:'.$align1.';">
						'.$course_studentInfo['lname'].'
						</td>';
					
					echo '<td style="text-align:center;">
						'.$course_studentInfo['factor'].'
						</td>';
						
					echo '<td style="text-align:'.$align1.';">
						'.$course_studentInfo['pfname'].' '.$course_studentInfo['plname'].'
						</td>';

					echo '<td style="text-align:'.$align1.';">
						'.$course_studentInfo['days_times'].'
						</td>';
					echo '<td style="text-align:center;">
						'.$course_studentInfo['clname'].'
						</td>';
					echo '<td style="text-align:center;">
						'.$course_studentInfo['clcode'].'
						</td>';
					echo '<td style="text-align:'.$align1.';">
						'.$course_studentInfo['claddress'].'
						</td>';					
					echo '<td style="text-align:'.$align1.';">
						'.$course_studentInfo['exam_date'].'
						</td>';
					echo '<td style="text-align:'.$align1.';">
						'.$course_studentInfo['cscomment'].' '.$course_studentInfo['clcomment'].' '.$course_studentInfo['ccomment'].'
						</td>';
		
					
					echo '</tr>';	
					$i++;
				}
				echo '</table><br /><br />';
				
				
			
	
		}
		else if(isset($_GET['op']) && $_GET['op']=="scores")
		{
			echo '<div style="position:absolute; width:200px; top:0px; '.$align1.':10px;">';
			echo $day_name . ' '. $day_number . ' / ' . $month_number . ' / ' . $year_number . '';
			echo '<br />&nbsp;&nbsp;&nbsp;<a href="index.php"><img src="themes/'.$theme.'/img/home.png" border="0" /></a>
				&nbsp;&nbsp;&nbsp;&nbsp;<a href="logout.php" onMouseover="ShowTooltip(\''._EXIT_ACCOUNT.'\', \'white\', 150)" onMouseout="HideTooltip()"><img border="0" src="themes/'.$theme.'/img/logout.png" /></a>
				</div>';
			echo '<div class="hero-unit shadow" style="position:absolute; width:300px; height:60px; '.$align2.':10px; top:10px; padding:5px;">';
			if(file_exists('img/students/'.$pic_prefix.$studentProp[0]['sid'].$studentProp[0]['spic'].''))
				echo '<img src="img/students/'.$pic_prefix.$studentProp[0]['sid'].$studentProp[0]['spic'].'" align="'.$align1.'" style="height:50px;" />';
			else
				echo '<img src="img/student.png" align="'.$align1.'" style="height:50px;" />';
			
			echo '<b>'.$studentProp[0]['sfname'].' '.$studentProp[0]['slname'].'<br />'._SCODE.': '.$studentProp[0]['scode'].'</b>';
			if($allow_user_modify_profile==1)
				echo '<br />&nbsp;&nbsp;&nbsp;<a href="profile.php" onMouseover="ShowTooltip(\''._EDIT_YOUR_PROFILE.'\', \'white\', 150)" onMouseout="HideTooltip()"><img src="themes/'.$theme.'/img/edit_user.png" /></a> &nbsp;&nbsp;<a href="javascript:change_pass();" onMouseover="ShowTooltip(\''._CHANGE_PASSWORD.'\', \'white\', 100)" onMouseout="HideTooltip()"><img src="themes/'.$theme.'/img/reset_pass.png" /></a>';
			echo '</div>';
			echo '
			<div class="hero-unit" style="width:90%; padding:20px; margin-right:5%; margin-left:5%; margin-top:100px;">
			<h3>'._COURSES_PROPERTIES.'</h3>
			';
			
			$total_factor = 0;
			$obj = new ManageObjections();

			foreach ($termList as $termInfo)
			{
				echo '<div class="label" style="font-size:10pt; background-color:#00157f;">'.$termInfo['tname'].' ('._TCODE.': '.$termInfo['tcode'].')</div>';
				echo '<div style="'.$table_width.'">
						<table style="border:2px black solid; width:100%;">
										<tr class="default_font ">';
								echo '<td style="width:40px;" class="table_print_header">
									'._CCODE.'
									</td>';
								echo '<td style="width:50px;" class="table_print_header">
									'._LCODE.'
									</td>';
								echo '<td style="width:150px;" class="table_print_header">
									'._LESSON_NAME.'
									</td>';
								echo '<td style="width:30px;" class="table_print_header">
									'._FACTOR.'
									</td>';
								echo '<td style="width:80px;" class="table_print_header small">
									'._EFFECT_ON_TERM_AVE.'
									</td>';
								echo '<td style="width:80px;" class="table_print_header small">
									'._EFFECT_ON_TOTAL_AVE.'
									</td>';
								echo '<td style="width:100px;" class="table_print_header">
									'._TEACHER.'
									</td>';
								echo '<td style="width:150px" class="table_print_header">
									'._COURSE_DAYS.'
									</td>';
								echo '<td style="width:150px;" class="table_print_header">
									'._COURSE_EXAM_DATE_HEADER.'
									</td>';
								echo '<td style="width:50px;" class="table_print_header">
									'._SCORE.'
									</td>';
								echo '<td style="width:50px;" class="table_print_header">
									'._SCORE_STATUS.'
									</td>';
								echo '<td style="width:50px;" class="table_print_header">
									'._EXAM_STATUS.'
									</td>';
								
								echo '<td style="width:auto;" class="table_print_header">
									'._SCORE_COMMENTS.'
									</td>';
								echo '<td style="width:150px;" class="table_print_header">
										'._TOOLS.'
									</td>';
								echo '</tr>';
				$courseList = $student->GetStudentCourseList($sid,$termInfo['tid']);
				$ave = $student->CalculateAve($termInfo['tid'],$sid);
				$i=1;
				$factorSum = 0;
				foreach ($courseList as $course_studentInfo)
				{
					if($i%2==0)
						$bgCourse = "tr_hover_class";
					else
						$bgCourse = "";
					echo '<tr style="height:30px; border-bottom:silver;" class="table_rows default_font '.$bgCourse.' table_rows_border">';
					
					echo '<td style="text-align:center;">
						'.$course_studentInfo['ccode'].'
						</td>';
						
					echo '<td style="text-align:center;">
						'.$course_studentInfo['lcode'].'
						</td>';
					
					echo '<td style="text-align:'.$align1.';">
						'.$course_studentInfo['lname'].'
						</td>';
					
					echo '<td style="text-align:center;">
						'.$course_studentInfo['factor'].'
						</td>';
						
					echo '<td style="text-align:center;">
						'.($course_studentInfo['eff_on_term_avg']==1?_YES:_NO).'
						</td>';
					
					echo '<td style="text-align:center;">
						'.($course_studentInfo['eff_on_total_avg']==1?_YES:_NO).'
						</td>';
						
					$factorSum+=$course_studentInfo['factor'];
					echo '<td style="text-align:'.$align1.';">
						'.$course_studentInfo['pfname'].' '.$course_studentInfo['plname'].'
						</td>';
					
					echo '<td style="text-align:'.$align1.';">
						'.$course_studentInfo['days_times'].'
						</td>';
						
					echo '<td style="text-align:'.$align1.';">
						'.$course_studentInfo['exam_date'].'
						</td>';

					echo '<td style="text-align:center;">
						'.$course_studentInfo['grade'].'
						</td>';
					$grade_status = "";
					if($termInfo['grade_active']==0 && $course_studentInfo['grade']!="")
						$grade_status = _SCORE_STATUS_2;
					else
						switch($course_studentInfo['grade_status'])
						{
							case 1:
								$grade_status = _SCORE_STATUS_1;
							break;
							case 2:
								$grade_status = _SCORE_STATUS_2;
							break;
							case 3:
								$grade_status = _SCORE_STATUS_3;
							break;
							default:
								$grade_status = _SCORE_STATUS_4;
							break;
						}
					echo '<td style="text-align:center;">
						'.$grade_status.'
						</td>';
					$exam_status = "";
					switch($course_studentInfo['exam_status'])
					{
						case 1:
							$exam_status = _EXAM_STATUS_1;
						break;
						case 2:
							$exam_status = _EXAM_STATUS_2;
						break;
						case 3:
							$exam_status = _EXAM_STATUS_3;
						break;
						case 4:
							$exam_status = _EXAM_STATUS_4;
						break;
						default:
							$exam_status = _EXAM_STATUS_5;
						break;
					}
					echo '<td style="text-align:center;">
						'.$exam_status.'
						</td>';
					
					echo '<td style="text-align:'.$align1.';">
						'.$course_studentInfo['cscomment'].' '.$course_studentInfo['clcomment'].' '.$course_studentInfo['ccomment'].'
						</td>';
		
					
					echo '<td style="text-align:center;">';
					if($course_studentInfo['grade']!="")
					{
						
						$objProp = $obj->GetObjectionInfo($course_studentInfo['csid']);
						if($termInfo['grade_active']==0)
							echo '<span class="small">'._GRADE_CHANGE_TIME_FINISHED.'.</span>';
						else
						{
							if($objProp==0)
							{
								if($course_studentInfo['objection']==1)
								{
									echo '<a href="javascript:send_objection(\''.$course_studentInfo['csid'].'\')">'._OBJECTION.'</a>';
								}
								else
									echo '<a onMouseover="ShowTooltip(\''._OBJECTION_IS_DISABLED.'.\', \'white\', 170)" onMouseout="HideTooltip()">'._OBJECTION.'</a>';
							}
							else
							{
								switch($objProp[0]['ostatus'])
								{
									case 1:
										$ostaus = _OBJ_STATUS_1;
										break;
									case 2:
										$ostaus = _OBJ_STATUS_2;
										break;
									case 3:
										$ostaus = _OBJ_STATUS_3;
										break;
								}
								echo '<span class="small">'._OBJECTION_STATUS.'</span>: '.$ostaus;
							}
						}
					}
						echo '</td>';
					echo '</tr>';	
					$i++;
				}
				echo '</table><br />';
				$total_factor += $factorSum;
				echo '<center>'._TERM_FACTOR.': '.$factorSum.' &nbsp;&nbsp;&nbsp;&nbsp; '._TERM_AVE.': '.$ave.'</center>
				<br />';
				
					echo '
					<div id="send_objection" style="width:500px; position:fixed; '.$align1.':50%; margin-'.$align1.':-250px; display:none; height:300px;">
					<div class="lock"></div>
					<form action=\'javascript:xmlhttpPost("aj.php")\' method="post" name="send_objection_form"  class="popup_form" style="width:500px; '.$align1.':50%; margin-'.$align1.':-250px; height:300px;">
						<div style="height:25px;">
						<a href="javascript:send_objection_hide();"><img src="themes/'.$theme.'/img/close.png" /></a>
						</div>
						
						'._OBJECTION_MESSAGE.':<br />
						'._OBJECTION_MESSAGE_NOTE.'
						<center><textarea name="otext" class="input" id="otext" style="direction:'.$dir.'; width:400px; height:100px;" /></textarea><br />
						<input type="hidden" name="csid" id="csid" value="" />
						<input type="submit" value="'._ADD_OBJECTION.'" class="btn btn-primary btn-large" /></center>
						<div id="obj_result">
						</div>
					</form>
					</div>
					';
			}
			
			echo '<div class="label" style="text-align:center;">'._TOTAL_FACTOR.': '.$total_factor.' &nbsp;&nbsp;&nbsp;&nbsp; '._TOTAL_AVE.': '.$student->CalculateTotalAve($studentProp[0]['sid']).'</div>
				<br />';
			echo '
					<script type="text/javascript">
					function send_objection(id){
						document.getElementById(\'send_objection\').style.display = "block";
						document.forms[\'send_objection_form\'].csid.value = id;
						document.forms[\'send_objection_form\'].otext.value = "";
						document.getElementById("obj_result").innerHTML = "";
					}
					function send_objection_hide(){
						document.getElementById(\'send_objection\').style.display = "none";
					}';?>
					function xmlhttpPost(strURL) {
								var xmlHttpReq = false;
								var self = this;
								// Mozilla/Safari
								if (window.XMLHttpRequest) {
									self.xmlHttpReq = new XMLHttpRequest();
								}
								// IE
								else if (window.ActiveXObject) {
									self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
								}
								self.xmlHttpReq.open('POST', strURL, true);
								self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
								self.xmlHttpReq.onreadystatechange = function() {
								var obj = document.getElementById("obj_result");
								obj.innerHTML = "<img src='img/wait.gif' />";
									if (self.xmlHttpReq.readyState == 4) {
										updatepage(self.xmlHttpReq.responseText);
									}
								}
								self.xmlHttpReq.send(getquerystring());
							}
							
							
							function getquerystring() {
								var form     = document.forms['send_objection_form'];
								var csid = form.csid.value;
								var otext = form.otext.value;
								qstr = 'csid=' + csid + '&otext='+otext+'&op=add_objection'; 
								return qstr;
							}
							
							function updatepage(str){
								document.getElementById("obj_result").innerHTML = str;
							}
							<?php
							echo '</script>';
	}
	else
	{
		
			if (isset($_SESSION[$user_session_name]))
			{
				echo '<div style="position:absolute; width:200px; top:0px; '.$align1.':10px;">';
				echo $day_name . ' '. $day_number . ' / ' . $month_number . ' / ' . $year_number . '';
				echo '<br />&nbsp;&nbsp;&nbsp;<a href="index.php"><img src="themes/'.$theme.'/img/home.png" border="0" /></a>
					&nbsp;&nbsp;&nbsp;&nbsp;<a href="logout.php" onMouseover="ShowTooltip(\''._EXIT_ACCOUNT.'\', \'white\', 150)" onMouseout="HideTooltip()"><img border="0" src="themes/'.$theme.'/img/logout.png" /></a>
					</div>';
			}
			echo '<div class="hero-unit shadow" style="position:absolute; width:300px; height:60px; '.$align2.':10px; top:10px; padding:5px;">';
			if(file_exists('img/students/'.$pic_prefix.$studentProp[0]['sid'].$studentProp[0]['spic'].''))
				echo '<img src="img/students/'.$pic_prefix.$studentProp[0]['sid'].$studentProp[0]['spic'].'" align="'.$align1.'" style="height:50px;" />';
			else
				echo '<img src="img/student.png" align="'.$align1.'" style="height:50px;" />';
			
			echo '<b>'.$studentProp[0]['sfname'].' '.$studentProp[0]['slname'].'<br />'._SCODE.': '.$studentProp[0]['scode'].'</b>';
			if($allow_user_modify_profile==1)
				echo '<br />&nbsp;&nbsp;&nbsp;<a href="profile.php" onMouseover="ShowTooltip(\''._EDIT_YOUR_PROFILE.'\', \'white\', 150)" onMouseout="HideTooltip()"><img src="themes/'.$theme.'/img/edit_user.png" /></a> &nbsp;&nbsp;<a href="javascript:change_pass();" onMouseover="ShowTooltip(\''._CHANGE_PASSWORD.'\', \'white\', 100)" onMouseout="HideTooltip()"><img src="themes/'.$theme.'/img/reset_pass.png" /></a>';
			echo '</div>';
			echo '
	<div class="hero-unit main-container" style="margin-'.$align1.':-400px; '.$align1.':50%; padding-top:30px;" align="center">';
	echo '	<div style="width:90%; min-height:350px;" align="center">
	<img src="img/institute_logo.png" style="width:100px;" /><br />
	<b>'.$institute_name.'</b><br />
	<div style="height:170px;">
	';

	echo '<div style="float:'.$align1.'; width:160px"><a href="?op=schedule"><img class="img_hover" src="img/schedule.png" /><br />'._WEEKLY_SCHEDULE.'</a></div>
	<div style="float:'.$align1.'; width:150px"><a href="?op=card"><img class="img_hover" src="img/card.png" /><br />'._EXAM_CARD.'</a></div>
	<div style="float:'.$align1.'; width:160px"><a href="?op=scores"><img class="img_hover" src="img/scores.png" /><br />'._RESULTS.'</a></div>';
	if($jamaa_active==1)
		echo'<div style="float:'.$align1.'; width:150px"><a href="homework.php?op=list"><img class="img_hover" src="img/homework.png" /><br />'._STUDENT_HOMEWORK_MANAGEMENT.'</a></div>';
	else
		echo'<div style="float:'.$align1.'; width:150px"><a href="javascript:change_pass();"><img class="img_hover" src="img/settings.png" /><br />'._CHANGE_PASSWORD.'</a></div>';
	
	echo '
	</div>
	<br clear="all" />';
	if($users_message!="")
	{
		echo '<div style="text-align:'.$align1.'; height:100px; overflow-y:scroll;"><b class="label">'._SYSTEM_ADMIN_MESSAGES.'</b><br />
		'.nl2br($users_message).'
		</div>
	';
	}
	
	echo '
		</div>
	</div>
	';
	echo '
					<script type="text/javascript">
					function change_pass(){
						document.getElementById(\'change_pass\').style.display = "block";
						
					}
					function change_pass_hide(){
						document.getElementById(\'change_pass\').style.display = "none";
					}';?>
					function xmlhttpPost(strURL) {
								var xmlHttpReq = false;
								var self = this;
								// Mozilla/Safari
								if (window.XMLHttpRequest) {
									self.xmlHttpReq = new XMLHttpRequest();
								}
								// IE
								else if (window.ActiveXObject) {
									self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
								}
								self.xmlHttpReq.open('POST', strURL, true);
								self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
								self.xmlHttpReq.onreadystatechange = function() {
								var obj = document.getElementById("pass_result");
								obj.innerHTML = "<img src='img/wait.gif' />";
									if (self.xmlHttpReq.readyState == 4) {
										updatepage(self.xmlHttpReq.responseText);
									}
								}
								self.xmlHttpReq.send(getquerystring());
							}
							
							
							function getquerystring() {
								var form     = document.forms['change_pass_form'];
								var current_pass = form.current_pass.value;
								var new_pass = form.new_pass.value;
                                var confirm_pass = form.confirm_pass.value;
								qstr = 'current_pass=' + current_pass + '&new_pass='+new_pass+'&confirm_pass='+confirm_pass+'&sid=<?php echo $studentProp[0]['sid']; ?>&op=change_pass'; 
								return qstr;
							}
							
							function updatepage(str){
								document.getElementById("pass_result").innerHTML = str;
							}
							<?php
							echo '
					
					</script>
					<div id="change_pass" style="width:220px; position:fixed; '.$align1.':50%; margin-'.$align1.':-110px; display:none; min-height:300px;">
					<div class="lock"></div>
					<form action=\'javascript:xmlhttpPost("aj.php")\' method="post" name="change_pass_form"  class="popup_form" style="width:220px; '.$align1.':50%; margin-'.$align1.':-110px; min-height:300px;">
						<div style="height:25px;">
						<a href="javascript:change_pass_hide();"><img src="themes/'.$theme.'/img/close.png" /></a>
						</div>
						
						'._CURRENT_PASSWORD._REQUIRED.':<br /><input type="password" name="current_pass" class="input" id="current_pass" style="direction:ltr;" /><br />
						'._NEW_PASSWORD._REQUIRED.':<br /><input type="password" name="new_pass" class="input" id="new_pass" style="direction:ltr;" /><br />
						'._CONFIRM_PASSWORD._REQUIRED.':<br /><input type="password" name="confirm_pass" class="input" id="confirm_pass" style="direction:ltr;" /><br />
						
						
						
						<center><input type="submit" value="'._UPDATE.'" class="btn btn-primary btn-large" /></center>
						<div id="pass_result">
						</div>
					</form>
					</div>
					';
		
	}
}
echo '
</div>';

include_once('footer.php');
?>


