var req;

function navigate(month,year,day) {
	
		//var teacher_id=document.getElementById('teacher_id').value;
		
        var url = "calendar_eve1.php?month="+month+"&year="+year+"&day="+day;
		//callmonth(month,year);
		//callday(month,year,day);
		if(window.XMLHttpRequest) {
                req = new XMLHttpRequest();
        } else if(window.ActiveXObject) {
                req = new ActiveXObject("Microsoft.XMLHTTP");
        }
        req.open("GET", url, true);
        req.onreadystatechange = callback;
        req.send(null);
}

function callback() {        
        obj = document.getElementById("calendar");
        setFade(0);
        
		if(req.readyState == 4) {
                if(req.status == 200) 
				{
					
                        response = req.responseText;
					//	alert(response);
                        obj.innerHTML = response;
                        fade(0);
                } else {
                        alert("There was a problem retrieving the data:\n" + req.statusText);
                }
        }
}

function fade(amt) {
	if(amt <= 100) {
		setFade(amt);
		amt += 10;
		setTimeout("fade("+amt+")", 5);
    }
}

function setFade(amt) {
	obj = document.getElementById("calendar");
	
	amt = (amt == 100)?99.999:amt;
  
	// IE
	obj.style.filter = "alpha(opacity:"+amt+")";
  
	// Safari<1.2, Konqueror
	obj.style.KHTMLOpacity = amt/100;
  
	// Mozilla and Firefox
	obj.style.MozOpacity = amt/100;
  
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	obj.style.opacity = amt/100;
}
var monthreq;
function callmonth(month,year)
{
	
	var url = "ajax_event_month.php?month="+month+"&year="+year;
		if(window.XMLHttpRequest) {
                monthreq = new XMLHttpRequest();
        } else if(window.ActiveXObject) {
                monthreq = new ActiveXObject("Microsoft.XMLHTTP");
        }
        monthreq.open("GET", url, true);
        monthreq.onreadystatechange = monthback;
        monthreq.send(null);
}
function monthback() {        
        obj = document.getElementById("div_month");
        if(monthreq.readyState == 4) {
                if(monthreq.status == 200) 
				{
					
                        response = monthreq.responseText;
					//	alert(response);
                        obj.innerHTML = response;
                       
                } else {
                        alert("There was a problem retrieving the data:\n" + monthreq.statusText);
                }
        }
}

var dayreq;
function callday(month,year,day)
{
	var url = "ajax_event_day.php?month="+month+"&year="+year+"&day="+day;
		if(window.XMLHttpRequest) {
                dayreq = new XMLHttpRequest();
        } else if(window.ActiveXObject) {
                dayreq = new ActiveXObject("Microsoft.XMLHTTP");
        }
        dayreq.open("GET", url, true);
        dayreq.onreadystatechange = dayback;
        dayreq.send(null);
}
function dayback() {        
        obj = document.getElementById("div_day");
        if(dayreq.readyState == 4) {
                if(dayreq.status == 200) 
				{
					
                        response = dayreq.responseText;
					//	alert(response);
                        obj.innerHTML = response;
                       
                } else {
                        alert("There was a problem retrieving the data:\n" + dayreq.statusText);
                }
        }
}