// JavaScript Document
var xmlHttpUC, xmlHttpOG , xmlHttp_notice

function ShowUCResList() {
	xmlHttpUC=GetXmlHttpObject()
	if (xmlHttpUC==null) {
		alert ("Browser does not support HTTP Request")
		return
	}
	document.getElementById("ucres").innerHTML = "<center>Searching database. Please wait....</center>"
	var url="getupcomingresults.php"
	url=url+"?sid="+Math.random()
	xmlHttpUC.onreadystatechange=function(){stateChanged("ucres",xmlHttpUC)};
	xmlHttpUC.open("GET",url,true)
	xmlHttpUC.send(null)
}

function ShowNextUCResList(ll_startat) {
	xmlHttpUC=GetXmlHttpObject()
	if (xmlHttpUC==null) {
		alert ("Browser does not support HTTP Request")
		return
	}
	document.getElementById("ucres").innerHTML = "<center>Searching database. Please wait....</center>"
	var url="getupcomingresults.php"
	url=url+"?startat="+ll_startat
	url=url+"&sid="+Math.random()
	xmlHttpUC.onreadystatechange=function(){stateChanged("ucres",xmlHttpUC)};
	xmlHttpUC.open("GET",url,true)
	xmlHttpUC.send(null)
}

function ShowOGResList() {
	xmlHttpOG=GetXmlHttpObject()
	if (xmlHttpOG==null) {
		alert ("Browser does not support HTTP Request")
		return
	}
	document.getElementById("ogres").innerHTML = "<center>Searching database. Please wait....</center>"
	var url="getongoingresults.php"
	url=url+"?sid="+Math.random()
	xmlHttpOG.onreadystatechange=function(){stateChanged("ogres", xmlHttpOG)};
	xmlHttpOG.open("GET",url,true)
	xmlHttpOG.send(null)
}

function ShowNextOGResList(ll_startat) {
	xmlHttpOG=GetXmlHttpObject()
	if (xmlHttpOG==null) {
		alert ("Browser does not support HTTP Request")
		return
	}
	document.getElementById("ogres").innerHTML = "<center>Searching database. Please wait....</center>"
	var url="getongoingresults.php"
	url=url+"?startat="+ll_startat
	url=url+"&sid="+Math.random()
	xmlHttpOG.onreadystatechange=function(){stateChanged("ogres",xmlHttpOG)};
	xmlHttpOG.open("GET",url,true)
	xmlHttpOG.send(null)
}

function ShowOGResUnivList() {
	xmlHttpOG=GetXmlHttpObject()
	if (xmlHttpOG==null) {
		alert ("Browser does not support HTTP Request")
		return
	}
	document.getElementById("ogres").innerHTML = "<center>Searching database. Please wait....</center>"
	var url="getongoingresults_univ.php"
	url=url+"?sid="+Math.random()
	xmlHttpOG.onreadystatechange=function(){stateChanged("ogres", xmlHttpOG)};
	xmlHttpOG.open("GET",url,true)
	xmlHttpOG.send(null)
}

function ShowNextOGResUnivList(ll_startat) {
	xmlHttpOG=GetXmlHttpObject()
	if (xmlHttpOG==null) {
		alert ("Browser does not support HTTP Request")
		return
	}
	document.getElementById("ogres").innerHTML = "<center>Searching database. Please wait....</center>"
	var url="getongoingresults_univ.php"
	url=url+"?startat="+ll_startat
	url=url+"&sid="+Math.random()
	xmlHttpOG.onreadystatechange=function(){stateChanged("ogres",xmlHttpOG)};
	xmlHttpOG.open("GET",url,true)
	xmlHttpOG.send(null)
}

//notice start//
function ShownoticeList(){
	xmlHttp_notice=GetXmlHttpObject()
	if (xmlHttp_notice==null) {
		alert ("Browser does not support HTTP Request")
		return
	}
	document.getElementById("ogres1").innerHTML = "<center>Searching database. Please wait....</center>"
	var url="getnotice.php"
	url=url+"?sid="+Math.random()
	xmlHttp_notice.onreadystatechange=function(){stateChanged("ogres1",xmlHttp_notice)};
	xmlHttp_notice.open("GET",url,true)
	xmlHttp_notice.send(null)
}

function ShowNextnoticeList(ll_startat) {
	xmlHttp_notice=GetXmlHttpObject()
	if (xmlHttp_notice==null) {
		alert ("Browser does not support HTTP Request")
		return
	}
	document.getElementById("ogres1").innerHTML = "<center>Searching database. Please wait....</center>"
	var url="getnotice.php"
	url=url+"?startat="+ll_startat
	url=url+"&sid="+Math.random()
	xmlHttp_notice.onreadystatechange=function(){stateChanged("ogres1",xmlHttp_notice)};
	xmlHttp_notice.open("GET",url,true)
	xmlHttp_notice.send(null)
}
//notice end//
	
function stateChanged(ls_divid, xmlHttp) { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
		document.getElementById(ls_divid).innerHTML=xmlHttp.responseText 
		
	} 
}
	
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 hidestatus(ls_msg){
	window.status=ls_msg
	return true
}

// use it as:  onKeyPress="return submitenter(this,event)"
function submitenter(myfield,e) {
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;

	if (keycode == 13) {
		myfield.form.submit();
		return false;
	} 
	else
		return true;
}