// JavaScript Document
function clearcomment(){
	document.getElementById('returncomment').innerHTML='';
}
function printForm() { print(document.getElementById("appform")); }

function valcont(){
	if(document.cont.username.value=="" && document.cont.stno.valu==""){
		window.alert("Please enter a valid username");
		return false;
	}
	if(document.cont.password.value=="" && document.cont.stno.value==""){
		window.alert("Please enter a valid password");
		return false;
	}
	
	if(((document.cont.username.value!="" && document.cont.password.value=="") || (document.cont.username.value=="" && document.cont.password.value!="")) && document.cont.stno.value!=""){
		window.alert("Please enter a valid username and password.");
		return false;
	}
	if((document.cont.username.value!="" || document.cont.password.value!="") && document.cont.stno.value==""){
		window.alert("Please enter a valid staff No. ");
		return false;
	}
	return true;
}

function getXMLHTTPRequest(){
	
	try{
		req = new XMLHttpRequest();
	} catch(err1){
		
		try{
			req = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(err2) {
			
			try {
				req = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(err3) {
				reg = false;
			}
		}
	}
	return req;
	
}

var httpen = getXMLHTTPRequest();
//enqueries call
function enquiries(){	
		clearcomment();
		var myurl = "enquiries.php";
		httpen.open("GET", myurl, true);
		httpen.onreadystatechange = useHttpResponseenquiries;
		httpen.send(null);
	
}
function useHttpResponseenquiries(){
	if(httpen.readyState == 4){
		if(httpen.status==200){
			try{
			var mytext=httpen.responseText;
				document.getElementById('billboard').innerHTML=mytext;
			}
	catch(err4){alert(err4.description);}
		}
	}
	
	else{
		document.getElementById('billboard').innerHTML='<image src="image/bsyrnd.gif" title="Please wait....." alt="Please wait...">';
		setTimeout('enquiries', 1000);
		
	}
}
//end equiries call


var httpco = getXMLHTTPRequest();
//corriculum call
function corri(){
		clearcomment();
		var myurl = "curriculums.php";
		httpco.open("GET", myurl, true);
		httpco.onreadystatechange = useHttpResponseco;
		httpco.send(null);
	
}
function useHttpResponseco(){
	if(httpco.readyState == 4){
		if(httpco.status==200){
			try{
			var mytext=httpco.responseText;
				document.getElementById('billboard').innerHTML=mytext;
			}
	catch(err4){alert(err4.description);}
		}
	}
	
	else{
		document.getElementById('billboard').innerHTML='<image src="image/bsyrnd.gif" title="Please wait....." alt="Please wait...">';
		setTimeout('enquiries', 1000);
		
	}
}
//end equiries call

var httpcon = getXMLHTTPRequest();
//contact call
function contact(){	
		clearcomment();
		var myurl = "contact.html";
		httpcon.open("GET", myurl, true);
		httpcon.onreadystatechange = useHttpResponsecon;
		httpcon.send(null);
	
}
function useHttpResponsecon(){
	if(httpcon.readyState == 4){
		if(httpcon.status==200){
			try{
			var mytext=httpcon.responseText;
				document.getElementById('bdy').innerHTML=mytext;
			}
	catch(err4){alert(err4.description);}
		}
	}
	
	else{
		document.getElementById('bdy').innerHTML='<image src="image/bsyrnd.gif" title="Please wait....." alt="Please wait...">';
		setTimeout('enquiries', 1000);
		
	}
}
//end contact call

var httpconst = getXMLHTTPRequest();
//stafflogin call
function stafflogin(){
		clearcomment();
		var myurl = "stafflogin.php";
		httpconst.open("GET", myurl, true);
		httpconst.onreadystatechange = useHttpResponseconst;
		httpconst.send(null);
	
}
function useHttpResponseconst(){
	if(httpconst.readyState == 4){
		if(httpconst.status==200){
			try{
			var mytext=httpconst.responseText;
				document.getElementById('billboard').innerHTML=mytext;
			}
	catch(err4){alert(err4.description);}
		}
	}
	
	else{
		document.getElementById('billboard').innerHTML='<image src="image/bsyrnd.gif" title="Please wait....." alt="Please wait...">';
		setTimeout('enquiries', 1000);
		
	}
}
//end stafflogin call

var httpconstu = getXMLHTTPRequest();
//studentslogin call
function studentslogin(){
	clearcomment();
		var myurl = "logpanel.htm";
		httpconstu.open("GET", myurl, true);
		httpconstu.onreadystatechange = useHttpResponseconstu;
		httpconstu.send(null);
	
}
function useHttpResponseconstu(){
	if(httpconstu.readyState == 4){
		if(httpconstu.status==200){
			try{
			var mytext=httpconstu.responseText;
				document.getElementById('billboard').innerHTML=mytext;
			}
	catch(err4){alert(err4.description);}
		}
	}
	
	else{
		document.getElementById('billboard').innerHTML='<image src="image/bsyrnd.gif" title="Please wait....." alt="Please wait...">';
		setTimeout('enquiries', 1000);
		
	}
}
//end studentslogin call
var httpnewadd = getXMLHTTPRequest();
//admission call
function addmission(){
	clearcomment();
		var myurl = "newadmission.php";
		httpnewadd.open("GET", myurl, true);
		httpnewadd.onreadystatechange = useHttpResponsenewadd;
		httpnewadd.send(null);
	
}
function useHttpResponsenewadd(){
	if(httpnewadd.readyState == 4){
		if(httpnewadd.status==200){
			try{
			var mytext=httpnewadd.responseText;
				document.getElementById('bdy').innerHTML=mytext;
			}
	catch(err4){alert(err4.description);}
		}
	}
	
	else{
		document.getElementById('bdy').innerHTML='<image src="image/bsyrnd.gif" title="Please wait....." alt="Please wait...">';
		setTimeout('enquiries', 1000);
		
	}
}
//end admission call

var httpstprofile = getXMLHTTPRequest();
//students profile call
function studentsprofile(){
	clearcomment();
		document.getElementById('returncomment').innerHTML='';
		var dob1 = document.stulog.dob1.value;
		var dob2 = document.stulog.dob2.value;
		var adno = document.stulog.adno.value;
		if(dob1!="" && dob2!="" && dob1!="Day" && dob2!="Month" && adno!=""){
			var myurl = "studentsprofile.php?dob1="+dob1+"&dob2="+dob2+"&adno="+adno;
			httpstprofile.open("GET", myurl, true);
			httpstprofile.onreadystatechange = useHttpResponsestprofile;
			httpstprofile.send(null);
		}
		else{
			document.getElementById('returncomment').innerHTML='<span style="border-style:double; border-color:red; width:500px; color:red; background-color:#ffffff">Please make sure you complete the form before proceeding</span>';
		}
	
}
function useHttpResponsestprofile(){
	if(httpstprofile.readyState == 4){
		if(httpstprofile.status==200){
			try{
			var mytext=httpstprofile.responseText;
				document.getElementById('bdy').innerHTML=mytext;
			}
	catch(err4){alert(err4.description);}
		}
	}
	
	else{
		document.getElementById('bdy').innerHTML='<image src="image/bsyrnd.gif" title="Please wait....." alt="Please wait...">';
		setTimeout('enquiries', 1000);
		
	}
}
//end students profile call

//modify old admission
function madmission(){
	clearcomment();
	document.getElementById('bdy').innerHTML='<table align="center" bgcolor="#ffffff" border="0" cellpadding="2" cellspacing="0" width="304"><tbody><tr><td colspan="2" align="center" background="miscimages/navbar1.png" bgcolor="#ffffff" height="10" width="304"><p class="MsoNormal" style="margin: 0pt 0pt 0pt 5px; line-height: 100%;" align="center"><span style="font-size: 10pt; font-family: Tahoma,Verdana; color: rgb(255, 255, 255);" lang="EN-GB"><b>MODIFY PERSONAL DATA</b></span></p></td></tr>  <tr>    <td align="left" valign="top" bgcolor="#E3E8EE"><div id="returncomment"></div><form id="eapp" name="eapp" method="post" action="admission.php" onSubmit="return valvid();">      Virtual ID:	  <input type="hidden" name="ves" value="ves" />          <input name="vadno" type="text" id="vadno" />          <input type="submit" name="Submit" value="Continue" />    </form></td>  </tr>  <tr>  <td width="304" height="50" align="left" valign="top" bgcolor="#E3E8EE">For questions and suggestions, please <a href="javascript:" onClick="contact(); return false;">click here</a></td></tr></tbody></table>';
}
//end modify old admission

