// JavaScript Document
var xmlHttp
function GetXmlHttpObject()
{ 
var objXMLHttp=null
if (window.XMLHttpRequest)
{
objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject)
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
}

function identy()
{
var verification=document.getElementById('verification').value;
	 xmlHttp=GetXmlHttpObject()
			if (xmlHttp==null)
			{
			alert ("Browser does not support HTTP Request")
			return
			} 
			var url="student.php?identity="+verification;
			window.location=url;
			xmlHttp.onreadystatechange=function()
			{
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
			{ 

					mearray=xmlHttp.responseText.split("[]");
		
				}
			}
			xmlHttp.open("GET",url,true)
			xmlHttp.send(null)	
}


function result()
{
var stage=document.getElementById('stage').value;
var course=document.getElementById('course').value;
var mrmid=document.getElementById('mrmid').value;
	 xmlHttp=GetXmlHttpObject()
			if (xmlHttp==null)
			{
			alert ("Browser does not support HTTP Request")
			return
			} 
			var url="result.php?stage="+stage+"&course="+course+"&mrmid="+mrmid;
			//window.location=url;
			xmlHttp.onreadystatechange=function()
			{
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
			{ 			
			mearray=xmlHttp.responseText;			
			document.getElementById('grade').innerHTML="<font size=2px color=#CC6600><strong>"+mearray+"</strong></font>";					
				}
			}
			xmlHttp.open("GET",url,true)
			xmlHttp.send(null)	
}


function cityf()
{	

var memid=document.getElementById('state').value;
	 xmlHttp=GetXmlHttpObject()
			if (xmlHttp==null)
			{
			alert ("Browser does not support HTTP Request")
			return
			} 
			var url="show_ajax.php?mem="+memid+"&m="+3;
			//window.location=url;
			xmlHttp.onreadystatechange=function()
			{
			document.getElementById('city').length=1;
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
			{ 
				 		mearray=xmlHttp.responseText.split("[]");	
			for (i=0;i<mearray.length-1;i++)
				{
					if(mearray[i]!="")
					{	valcat=mearray[i].split("{}");
							oOption = document.createElement("Option");
							oOption.text = valcat[1];
							oOption.value = valcat[1];
							document.getElementById('city').options.add(oOption);
						}
					}	
			
				}
			}

			xmlHttp.open("GET",url,true)
			xmlHttp.send(null)
			
}

function nsub()
	{
		 xmlHttp=GetXmlHttpObject()
			if (xmlHttp==null)
			{
			alert ("Browser does not support HTTP Request")
			return
			} 
	oRegXEmail = new RegExp(/^[\w_-]+(\.[\w_-]+)*@[\w_-]+(\.[\w_-]+)*\.\w{2,4}$/gi);

	
	if(document.getElementById('emm').value=="")
	{
	alert("Enter email");
	document.getElementById('emm').focus();
	return false;
	}
		if(!oRegXEmail.test(document.getElementById('emm').value))
		{
			alert("Incorrect email address format. Please type a valid email address.");
			document.getElementById('emm').focus();
			return false;
		}

	em=document.getElementById('emm').value;
	var url="newlet.php?emai="+em;		
	//window.location=url;
	alert("Thank you added successfully");
    xmlHttp.open("GET",url,true)
	xmlHttp.send(null)	
	document.getElementById('emm').value="";
	}
