<?php session_start();
//  Developed by Anoop Sreenivasan
//  Visit http://mobalive.mobi for this script and more.
//  This notice MUST stay intact for legal use
// if session is not set redirect the user
if(empty($_SESSION['u_name']))
	header("Location:index.php");
//if logout then destroy the session and redirect the user
if(isset($_GET['logout']))
{
	session_destroy();
	header("Location:index.php");
}

?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<link rel="stylesheet" type="text/css" href="css/grid_default.css"/>
	<script type="text/javascript" src="js/ajax.js"></script>
	<script type="text/javascript" src="js/ajax-dynamic-list.js"></script>
		<link rel="stylesheet" href="css/form-field-tooltip.css" media="screen" type="text/css">
	<script type="text/javascript" src="js/rounded-corners.js"></script>
	<script type="text/javascript" src="js/form-field-tooltip.js"></script>
	

	<script type="text/javascript" src="js/ajax.js"></script>
	
<SCRIPT language="javascript">
var ajax = new Array();
/////////////////////////////////Get Bus Stop Starts/////////////////////////////////////////
function getBusStop(BusNo)
{
	var BusNo = BusNo.options[BusNo.selectedIndex].value;
	document.getElementById('BusStop').options.length = 0;	// Empty city select box
	if(BusNo.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = 'getPrintData.php?BusNo='+BusNo;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createStop(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}

function createStop(index)
{
	var obj = document.getElementById('BusStop');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}
/////////////////////////////////Get Bus Stop Ends/////////////////////////////////////////
/////////////////////////////////Get Semester/////////////////////////////////////////////
		function ShowSemester(Course)		
		{  
		   var Course = Course.options[Course.selectedIndex].value;
		                    
		 	if(Course=="B-Tech"||Course=="MCA"||Course=="M-Tech")
		    {
					
					document.getElementById('Semester').options.length = 0;	// Empty city select box
					if(Course.length>0){
						var index = ajax.length;
						ajax[index] = new sack();
						
						ajax[index].requestFile = 'getPrintData.php?Course='+Course;	// Specifying which file to get
						ajax[index].onCompletion = function(){ createSem(index) };	// Specify function that will be executed after file has been found
						ajax[index].runAJAX();		// Execute AJAX function
					}
          }
		  else if(Course=="0")
		  {
		    document.getElementById('Semester').style.visibility="hidden";
		    //alert("Please Select A Course");
		  }
		  else
		  {
		     document.getElementById('Semester').style.visibility="hidden";
		  }

function createSem(index)
{   
    document.getElementById('Semester').style.visibility="visible";
	var obj = document.getElementById('Semester');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}
}
/////////////////////////////////Get Semester Ends////////////////////////////////////////

function ShowCategories()
{
	 if(document.getElementById('category').value=="Staff")
	 { 
	    document.getElementById('Course').style.visibility="hidden";
		document.getElementById('Semester').style.visibility="hidden";
		document.getElementById('dept').style.visibility="visible";
	    document.getElementById('Department').style.visibility="visible";
		
	 }
	 else if(document.getElementById('category').value=="Student")
	 {  
	    document.getElementById('Department').style.visibility="hidden";
		document.getElementById('dept').style.visibility="hidden";
	    document.getElementById('Course').style.visibility="visible";
		document.getElementById('Semester').style.visibility="visible";
	 }
	 else
	 {
	    document.getElementById('Course').style.visibility="hidden";
		document.getElementById('Semester').style.visibility="hidden";
	    document.getElementById('Department').style.visibility="hidden";
		document.getElementById('dept').style.visibility="hidden";
	 }
}
function popUp()
{
 window.open("http://www.google.com/");
}



 </SCRIPT>


<style type="text/css">
<!--
#Layer3 {
	position:absolute;
	width:738px;
	height:115px;
	z-index:1;
	top: 186px;
}
-->
</style>

<style type="text/css">

	/* START CSS NEEDED ONLY IN DEMO */
	html{
		height:100%;
	}
	body{
		font-family: Trebuchet MS, Lucida Sans Unicode, Arial, sans-serif;
		width:100%;
		height:100%;
		margin:0px;
		text-align:left;
	}

	#mainContainer{
		width:660px;
		margin:0 auto;
		text-align:left;
		height:100%;
		background-color:#FFF;
		border-left:3px double #000;
		border-right:3px double #000;
	}
	#formContent{
		padding:5px;
	}
	/* END CSS ONLY NEEDED IN DEMO */


	/* Big box with list of options */
	#ajax_listOfOptions{
		position:absolute;	/* Never change this one */
		width:175px;	/* Width of box */
		height:250px;	/* Height of box */
		overflow:auto;	/* Scrolling features */
		border:1px solid #317082;	/* Dark green border */
		background-color:#FFF;	/* White background color */
		text-align:left;
		font-size:0.9em;
		z-index:100;
	}
	#ajax_listOfOptions div{	/* General rule for both .optionDiv and .optionDivSelected */
		margin:1px;
		padding:1px;
		cursor:pointer;
		font-size:0.9em;
	}
	#ajax_listOfOptions .optionDiv{	/* Div for each item in list */

	}
	#ajax_listOfOptions .optionDivSelected{ /* Selected item in the list */
		background-color:#317082;
		color:#FFF;
	}
	#ajax_listOfOptions_iframe{
		background-color:#F00;
		position:absolute;
		z-index:5;
	}

	form{
		display:inline;
	}

	.style3 {color: #FF0000}
#Layer4 {
	position:absolute;
	width:283px;
	height:20px;
	z-index:1;
	left: 685px;
	top: 181px;
}
</style>
<head>
<!-- Copyright 2005 Macromedia, Inc. All rights reserved. -->
<title>Edit Student Details</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="css/mm_health_nutr.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/grid_default.css"/>
<script language="JavaScript" type="text/javascript">
//--------------- LOCALIZEABLE GLOBALS ---------------
var d=new Date();
var monthname=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
//Ensure correct for language. English is "January 1, 2004"
var TODAY = monthname[d.getMonth()] + " " + d.getDate() + ", " + d.getFullYear();
//---------------   END LOCALIZEABLE   ---------------
</script>
<link href="css/ddsmoothmenu.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/form.js"></script>
<script type="text/javascript" src="js/ddsmoothmenu.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">

//end the form details through ajax call
$(document).ready(function(){
	$("form#submit").submit(function() {
	// we want to store the values from the form input box, then send via ajax below
var Admission_No = $('#AdmissionNo').attr('value');
var Name = $('#Name').attr('value');
	var HadmnNo = $('#HadmnNo').attr('value');
	var Gender =$('#Gender').attr('value'); 
	var Boarding_Point  =$('#BoardingPoint').attr('value');
	var Telephone_No =$('#TelephoneNo').attr('value'); 
	var Course  =$('#Course').attr('value');
	var Semester = $('#Semester').attr('value');
	var Boarding_Point= $('#country').attr('value');
	var Bus_No= $('#country_hidden').attr('value');
		$.ajax({
			type: "POST",
			url: "Student_Edit_Ajax.php",
			
				data: "&HadmnNo="+ HadmnNo+"&AdmissionNo="+ Admission_No+ "&Name=" + Name+ "&Gender=" + Gender+ "&country=" + Boarding_Point+ "&country_ID=" + Bus_No+ "&TelephoneNo=" + Telephone_No+ "&Course=" + Course+ "&Semester=" + Semester,
			success: function(data){
			if(data=='yes') //if Admision number allready exists
		  {alert("Admission Number allready Exist");}
		  else
		  {alert("Update Completed Successfully");}
				//$('form#submit').hide();
				//$('form#submit :input').val("");
				//$('div.success').fadeIn();
				clearForm();
			}
		});
	return false;
	});
});
</script>
<style type="text/css">
.style2 {color: '#FFFFF'}
#Layer1 {
	position:absolute;
	width:166px;
	height:34px;
	z-index:1;
	left: 329px;
	top: 368px;
}
#Layer2 {
	position:absolute;
	width:499px;
	height:227px;
	z-index:2;
	top: 28px;
}
</style>
</head>

<body>
<table width="922" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr bgcolor="#FFFFFF">
    <td colspan="3" rowspan="2" bgcolor="#FFFFFF">&nbsp;</td>
    <td height="50" colspan="2" align="center" valign="bottom" nowrap="nowrap" bgcolor="#FFFFFF" id="logo">Bus Information Management System</td>
    <td width="5" bgcolor="#FFFFFF">&nbsp;</td>
  </tr>

  <tr bgcolor="#FFFFFF">
    <td height="22" colspan="2" align="center" valign="top" bgcolor="#FFFFFF" id="tagline">MOHANDAS COLLEGE OF ENGINEERING AND TECHNOLOGY</td>
	<td width="5" bgcolor="#FFFFFF">&nbsp;</td>
  </tr>

  <tr>
    <td colspan="6" bgcolor="#FFFFFF"><img src="images/mm_spacer.gif" alt="" width="1" height="2" border="0" /></td>
  </tr>
  <tr>
    <td height="19" colspan="6"> <div id="smoothmenu1" class="ddsmoothmenu">

  <!--################Start Main Menu #####################-->

<ul>
	<li><a href="MainMenu.php">Home</a> </li>
	
	<!--############NEW SUBMENU#############-->
	<li><a href="#">New</a>
 	  <ul>
 		 <li><a href="NewStudent.php">Student</a></li>
		 <li><a href="NewStaff.php">Staff</a></li>
 		 <li><a href="NewBus.php">Bus</a></li>
 		 <li><a href="NewRoute.php">Bus Stop</a></li>
 		 <li><a href="NewUser.php">User</a></li>
  		 <li><a href="EditNews.php">Information</a></li>
      </ul>
    </li>
  
	<!--############EDIT SUBMENU#############-->	<li><a href="#">Edit</a>
 	  <ul>
	    
		  <li><a href="EditStudent.php">Student</a></li>
  		  <li><a href="Editstaff.php">Staff</a></li>
 		  <li><a href="Editbus.php">Bus</a></li>
		  <li><a href="#">Status</a>
		    <ul>
		      <li><a href="quickeditstudent.php">Student</a></li>
  		      <li><a href="quickeditstaff.php">Staff</a></li>
			  <li><a href="quickeditbus.php">Bus</a></li>
		    </ul>
		  </li>
      </ul>
	</li>

		<!--############Start Print Submenu#############-->
	<li><a href="print.php">Print</a></li><!--############End Print Submenu#############-->
		
<li><a href="changepass.php">Change Password</a></li>
  </li>
  <li><a href="MainMenu.php?logout">Logout</a></li>
    	
	
  <li><a href="contactus.php">Contact Us</a></li>
    </ul>
	
  </li>
  
  </ul>
  
  <!--################End Main Menu#####################-->

<br style="clear: left" />
</div></td>
  </tr>

  <tr>
    <td colspan="6" bgcolor="#FFFFFF"><img src="images/mm_spacer.gif" alt="" width="1" height="2" border="0" /></td>
  </tr>

  <tr>
    <td height="42" valign="top" bgcolor="#79CAFF">&nbsp;</td>
    <td>&nbsp;</td>
    <td colspan="2" valign="top">&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td width="172" height="320" valign="top" bgcolor="#79CAFF"><table border="0" cellspacing="0" cellpadding="0" width="172" id="navigation" bgcolor="79CAFF">
      <tr>
        <td width="172" bgcolor="#79CAFF">&nbsp;<br />
          &nbsp;<a href="MainMenu.php" class="navText">Home</a></td>
      </tr> <tr>
        <td width="172" bordercolor="#666666" ><a href="changepass.php"  class="navText">Change Password</a></td>
      </tr>   
     <tr>
        <td width="172" height="23" bordercolor="#666666" ><a href="upgrade.php" class="navText">Upgrade </a></td>
      </tr>   
    
      <tr>
        <td width="172" bordercolor="#666666" ><a href="MainMenu.php?logout" class="navText">Log Out</a></td>
      </tr> 
	   <tr>
        <td width="172" bordercolor="#666666" ></td>
      </tr>
	     <tr>
        <td width="172" height="23" bordercolor="#666666" ><a href="contactus.php" class="navText">Contact Us </a></td>
      </tr>
    </table>
      <br />
  	&nbsp;<br />
  	&nbsp;<br />
  	&nbsp;<br /> 	</td>
    <td width="5">&nbsp;</td>
    <td colspan="2" bgcolor="#FFFFFF"><!--##############Begin printform ###############-->
	<form name="printform" action="getprint.php" id="printform"  method="post" target="_blank">
	<fieldset>
				<legend><span  style="color:#FF0000">Get Passenger Details</span> </legend>
  <table width="96%" border="0" align="center">
  <tr>
    <td width="10%" height="72">Category:</td>
    <td width="84%" valign="middle"><div align="left">
      <select name="category" id="category"  onchange="ShowCategories()">
        <option value="Staff">Staff</option>
        <option value="Student">Student</option>
      </select>&nbsp;&nbsp;&nbsp;&nbsp;
      <select name="Course" id="Course" style="visibility:hidden" onchange="ShowSemester(this)">
        <option value="All" selected="selected">All Courses</option>
        <option value="B-Tech">B-Tech</option>
        <option value="M-Tech">M-Tech</option>
        <option value="MCA">MCA</option>
            </select>&nbsp;&nbsp;&nbsp;&nbsp;
      <select name="Semester" id="Semester" style="visibility:hidden">
        <option value="0">Semester</option>
        <option value="All" selected="selected">All</option>
            </select>
    </div></td>
    </tr>
  <tr>
    <td valign="top">Bus No: </td>
    <td valign="middle"><div align="left">
      <select name="BusNo" onchange="getBusStop(this)"  id="BusNo" >
           <option value="All" selected="selected">All</option>
        <?php
					include ("config.php");
					$query_disp="select * from bus";
					$result_disp = mysql_query($query_disp,$link);
					while($query_data = mysql_fetch_array($result_disp))
					{
					   echo'<option value="'.$query_data['BusNumber'].'">'.$query_data['BusNumber'].'</option>';
					}	
				?>
      </select>
    </div></td>
    </tr>
  <tr>
    <td>Gender:</td>
    <td valign="middle"><div align="left">
      <select name="Gender" id="Gender" >
        <option value="All" selected="selected">All</option>
        <option value="Male">Male</option>
        <option value="Female">Female</option>
      </select>
    </div><br></td>
    </tr>
  <tr>
    <td>Stop:</td>
    <td valign="middle"><div align="left">
      <select name="BusStop" id="BusStop" >
        <option value="All" selected="selected">All</option>
      </select>
    </div><br></td>
    </tr>
  <tr>
    <td id="dept"> Department:</td>
    <td valign="middle"><div align="left">
      <select name="Department" id="Department" >
        <option value="All" selected="selected">All</option>
		 <option value="MCA">MCA</option>
		<option value="EC">EC</option>
		<option value="BT">BT</option>
		<option value="IT">IT</option>
		<option value="CS">CS</option>
		<option value="EEE">EEE</option>
		<option value="ME">ME</option>
		<option value="Other">Other</option>
      </select>
    </div></td>
    </tr>
  <tr>
    <td>&nbsp;</td>
    <td valign="middle"><div align="left"></div></td>
    </tr>
  <tr>
    <td></td>
    <td valign="middle"><div align="left"><input type="submit" value="Print Data" target= "_self"/>
    </div></td>
    </tr>
  <tr>
    <td>&nbsp;</td>
    <td valign="middle"><div align="left"></div></td>
    </tr>
  <tr>
    <td>&nbsp;</td>
    <td valign="middle"><div align="left"></div></td>
    </tr>
  <tr>
    <td>&nbsp;</td>
    <td valign="middle">&nbsp;</td>
  </tr>
</table>
</fieldset>
</form>
<!--##############End printform ###############-->	</td>
    <td width="435">&nbsp;</td>
    <td width="5">&nbsp;</td>
  </tr>
  <tr>
   <td colspan="7" bgcolor="#79CAFF"><div align="center"><strong>Copyright 2009. businfo.info All rights reserved.&nbsp;</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="style1">Powered by <a href="http://mobalive.mobi/" style="text-decoration:none">mobalive.mobi</a></span></div>  </td>
  </tr>
</table>

</body>
</html>
