<script type="text/javascript" src="js/responsive-tables.js"></script>
<?php
    require_once('connection/db.php');
	require_once('convert_marathi.php');
//**************************************
//     Page load dropdown results     //
//**************************************
function getTierOne()
{
	$usertype=$_GET['usertype'];
}
//**************************************
//     First selection results     //
//**************************************
if($_GET['func'] == "usertype" && isset($_GET['func'])) { 
  usertype($_GET['drop_var']); 
  $r= $_GET['drop_var'];
}
function usertype($drop_var)
{  if($drop_var=='Department') 
	{
		convert_marathi();
		$result = mysql_query("SELECT * FROM department_master") or die(mysql_error());
		echo '<td><label style="float:left;">विभाग निवडा : </label></td><td><select style="float:right;margin-right:150px;" name="deptid" id="deptid">
	    <option value="" disabled="disabled" selected="selected">विभाग निवडा </option>';
		while($deptnm = mysql_fetch_array( $result )) 
			{
			  echo '<option value="'.$deptnm['dept_id'].'">'.$deptnm['dept_nm'].'</option>';
			}
		echo '</select></td>';
	}
	if($drop_var=='Desk') 
	{
		convert_marathi();
		$result = mysql_query("SELECT * FROM department_master") or die(mysql_error());
		echo '<td><label style="float:left;">विभाग निवडा: </label></td><td><select style="float:right;margin-right:150px;" class="deptid" name="deptid" id="deptid"><option value="" disabled="disabled" selected="selected">विभाग निवडा </option>';
		while($deptnm = mysql_fetch_array( $result )) 
			{
			  echo '<option value="'.$deptnm['dept_id'].'">'.$deptnm['dept_nm'].'</option>';
			}
		echo '</select></td>';
		echo "<script type=\"text/javascript\">
			$('#wait_2').hide();
			$('#deptid').change(function(){
			$('#wait_2').show();
			$('#result_2').hide();
			$.get(\"func12.php\", {
			func: \"deptid\",
			drop_var: $('#deptid').val()
			}, function(response){
			$('#result_2').fadeOut();
			setTimeout(\"finishAjax_tier_three('result_2', '\"+escape(response)+\"')\", 800);
			});
			return false;
			});
		</script>";
	}
}
//     Second selection results     //
if($_GET['func'] == "deptid" && isset($_GET['func'])) { 
   deptid($_GET['drop_var']); 
}
function deptid($drop_var)
{   
	convert_marathi();
	$result = mysql_query("SELECT * FROM desk_master WHERE dept_id='$drop_var'") or die("".mysql_error());
	echo '<td colspan="2"><label style="float:left;">डेस्क  निवडा : </label></td><td><select style="float:right;margin-right:135px;" class="deskid" name="deskid" id="deskid" onchange="showUser(usertype,deptid,deskid)">
	<option value="" disabled="disabled" selected="selected" >डेस्क निवडा</option>';
	while($desk = mysql_fetch_array($result)) 
		{
			echo '<option value="'.$desk['desk_id'].'">'.$desk['desk_nm'].'</option>';//$row1['student_name']
		}
	echo '</select> </td>';
	}  
?>