function getXmlHttpObject()
{
    var xmlHttp=null;
    try
    {
        // Firefox, Opera 8.0+, Safari
        xmlHttp=new XMLHttpRequest();
    }
    catch(e)
    {
        //Internet Explorer
        try
        {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch(e)
        {
            xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
    }
    return xmlHttp;
}
function check_id(afno,afno_id)
{
    xmlHttp=getXmlHttpObject();
    if(xmlHttp==null)
    {
        alert('Browser Does Not Suport This Mthod');
    }
    else
    {        
        var url ="./includes/check.php";
        
        url=url+"?afno="+afno+'&afno_id='+afno_id;
        url=url+"&sid="+Math.random()
        xmlHttp.onreadystatechange=mname1;        
        xmlHttp.open("GET",url,true);
        xmlHttp.send(null);
    }
}
function check_emp_id(emp_id,birth_date)
{
	xmlHttp=getXmlHttpObject();
	if(xmlHttp==null)
	{
	alert('Browser Does Not Suport This Mthod');
	}
	else
	{        
	
	var url ="./includes/check_emp_id.php";
	url=url+"?empid="+emp_id+"&birthdate="+birth_date;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=cheque_stage;        
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	}
}
function get_hons(iid,sub)
{
	xmlHttp=getXmlHttpObject();
	if(xmlHttp==null)
	{
	alert('Browser Does Not Suport This Mthod');
	}
	else
	{        
	var url ="./includes/check.php";
	url=url+"?iid="+iid+"&sub="+sub;
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=hons;        
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	}
}
function mname1()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
         
         document.getElementById('mnameid').innerHTML=xmlHttp.responseText
         if(xmlHttp.responseText>0)
         {
         	var a=document.getElementById('yes').style;
         	a.display='block';
         }
         else
         {
         	var a=document.getElementById('yes').style;
         	a.display='none';
         	alert('Invalid Application Form No & Form Id');
         }
      
    }
}
function hons()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
       document.getElementById('hons').innerHTML=xmlHttp.responseText
    }
}
function cheque_stage()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
     
        document.getElementById('name_of_app').innerHTML=xmlHttp.responseText
        
    }
}
function check_number_input(a,b)
{
	//alert(a);
	// alert(b);
	var key,keychar;
	if(window.event)
		key=window.event.keyCode;
	else if (event)
		key=event.which;
	else
		return true;
	keyChar=String.fromCharCode(key);
	if(/\d/.test(keyChar))
	{
		return true
	}
	else
	{
		window.status='Field Except Number Only';
		return false;
	}
}

function get_unversity_bord(opt)
{
	var table='';
	var td1='';
	var td2='';
	
	if(opt=='19' || opt=='20' || opt=='28' || opt=='29')
	{
		td1=td1+"<td class=orange9>Board*</td>";
		td2=td2+"<td class=orange9>:</td>";	
		table=table+"<td><select name='board' style='width: 100px;'>";
		table=table+"<option value='1'>B.S.E.B</option><option value='2'>Other</option>";
		table=table+"</select></td>";
	}
	else
	{
		td1=td1+"<td class=orange9>University*</td>";
		td2=td2+"<td class=orange9>:</td>";	
		table=table+"<td><select name='university' style='width: 100px;'>";
		table=table+"<option value='1'>M.U</option><option value='2'>Other</option>";
		table=table+"</select></td>";
	}
		
	document.getElementById('univ1').innerHTML=td1;
	document.getElementById('univ2').innerHTML=td2;
	document.getElementById('univ').innerHTML=table;
}

function getAppendixNextData(getGroupsAndId)
{
	xmlHttp=getXmlHttpObject();
	if(xmlHttp==null)
	{
		alert('Browser Does Not Suport This Mthod');
	}
	else
	{        		
		var url ="./includes/appendixajax.php";
		url=url+"?getGroupsAndId="+getGroupsAndId;
		url=url+"&sid="+Math.random()
		xmlHttp.onreadystatechange=getAppendixNextDataTrueFalse;        
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}    
}
function getAppendixNextDataTrueFalse()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
        //alert(xmlHttp.responseText);     
        var getData=xmlHttp.responseText;
        var myArray=getData.split("Rr//rR");        
        document.getElementById(myArray[1]).innerHTML=myArray[0];
    }
}

function getAppendixPreData(getGroupsAndId)
{
	xmlHttp=getXmlHttpObject();
	if(xmlHttp==null)
	{
		alert('Browser Does Not Suport This Mthod');
	}
	else
	{        		
		var url ="./includes/appendixajax.php";
		url=url+"?pregetGroupsAndId="+getGroupsAndId;
		url=url+"&sid="+Math.random()
		xmlHttp.onreadystatechange=getAppendixPreDataTrueFalse;        
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}    
}
function getAppendixPreDataTrueFalse()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
        //alert(xmlHttp.responseText);     
        var getData=xmlHttp.responseText;
        var myArray=getData.split("Rr//rR");         
        document.getElementById(myArray[1]).innerHTML=myArray[0];
    }
}
function check_valid_date(opt)
{
	xmlHttp=getXmlHttpObject();
	if(xmlHttp==null)
	{
		alert('Browser Does Not Suport This Mthod');
	}
	else
	{        		
		var url ="./includes/check_date.php";
		url=url+"?course_id="+opt;
		url=url+"&sid="+Math.random()
		xmlHttp.onreadystatechange=valid_date;        
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}    
}
function valid_date()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
        if(xmlHttp.responseText=='0')     
        {
        	document.getElementById('iid1').style.display='none';
        	document.getElementById('iid2').style.display='none';
        }
        else
        {
        	document.getElementById('iid1').style.display='block';
        	document.getElementById('iid2').style.display='block';
        }
        
    }	
}
