function getCookie(name) {
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1) {
begin = dc.indexOf(prefix);
if (begin != 0) return null;
} else {
begin += 2;
}
var end = document.cookie.indexOf(";", begin);
if (end == -1) {
end = dc.length;
}
return unescape(dc.substring(begin + prefix.length, end));
}

function SelectDistrict(val,id,stutype)
{
	//alert(stutype);
	postRequest_dist('./getdistrict.php','v='+val+'&id='+id+'&stutype='+stutype,id);
	return false;	
}

function postRequest_dist(url,data,id)
{
	//alert(data+id);
var xmlhttpObj = new ConnectToServer();
xmlhttpObj.objectActivex.open('POST', url, true);
	xmlhttpObj.objectActivex.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttpObj.objectActivex.onreadystatechange = function() 
	{if(xmlhttpObj.objectActivex.readyState != 4) { document.getElementById('get_district_'+id).innerHTML="<span style='color:#1FA8B7; font-size:12px;'>Loading........</span>"; 
        }else if (xmlhttpObj.objectActivex.readyState == 4) 
		{
            if(xmlhttpObj.objectActivex.status == 200)
			{ 
				var response=xmlhttpObj.objectActivex.responseText;
				//alert(response);
					document.getElementById('get_district_'+id).innerHTML=response;
			}
        }
    }
	xmlhttpObj.objectActivex.send(data);
}
function SelectUniversity1(){ var stval=document.getElementById('lststate_stu').value; SelectUniversity(stval,'stu');}
function SelectUniversity2(){ var stval=document.getElementById('lststate_gra').value; SelectUniversity(stval,'gra');}
function SelectUniversity3(){ var stval=document.getElementById('lststate_stum').value; SelectUniversity(stval,'stum');}
function SelectUniversity4(){ var stval=document.getElementById('lststate_stub').value; SelectUniversity(stval,'stub');}
function SelectUniversity5(){ var stval=document.getElementById('lststate_stuc').value; SelectUniversity(stval,'stuc');}
function SelectUniversity(val,id)
{   
	//alert(val+id);
	postRequest_uni('./getuniversity.php','v='+val+'&id='+id,id);
	return false;	
}

function postRequest_uni(url,data,id)
{
	//alert(data);
var xmlhttpObj = new ConnectToServer();
xmlhttpObj.objectActivex.open('POST', url, true);
	xmlhttpObj.objectActivex.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttpObj.objectActivex.onreadystatechange = function() 
	{if(xmlhttpObj.objectActivex.readyState != 4) { document.getElementById('get_university_'+id).innerHTML="<span style='color:#1FA8B7; font-size:12px;'>Loading........</span>"; 
        }else if (xmlhttpObj.objectActivex.readyState == 4) 
		{
            if(xmlhttpObj.objectActivex.status == 200)
			{ 
				var response=xmlhttpObj.objectActivex.responseText;
				//alert(response);
					document.getElementById('get_university_'+id).innerHTML=response;
			}
        }
    }
	xmlhttpObj.objectActivex.send(data);
}
function SelectCollege(val,id1,stutype)
{
	//alert(stutype);
	postRequest_col('./getcollege.php','d='+val+'&id1='+id1+'&stutype='+stutype,id1);
	return false;	
}

function postRequest_col(url,data,id1)
{
	//alert(data);
var xmlhttpObj = new ConnectToServer();
xmlhttpObj.objectActivex.open('POST', url, true);
	xmlhttpObj.objectActivex.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttpObj.objectActivex.onreadystatechange = function() 
	{if(xmlhttpObj.objectActivex.readyState != 4) { document.getElementById('get_college_'+id1).innerHTML="<span style='color:#1FA8B7; font-size:12px;'>Loading........</span>"; 
        }else if (xmlhttpObj.objectActivex.readyState == 4) 
		{
            if(xmlhttpObj.objectActivex.status == 200)
			{ 
				var response=xmlhttpObj.objectActivex.responseText;
				//alert(response);
				//alert(id1);
					document.getElementById('get_college_'+id1).innerHTML=response;
			}
        }
    }
	xmlhttpObj.objectActivex.send(data);
}

function ConnectToServer()
{
	try {
		  this.objectActivex = new ActiveXObject("Msxml2.XMLHTTP");
		}
		 catch (e) 
		{
			try {
				this.objectActivex = new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e2) 
				{
				this.objectActivex = false;
				}	
		}
	if(!this.objectActivex && typeof XMLHttpRequest != 'undefined')
	{
	  this.objectActivex = new XMLHttpRequest();
	}
}





 