var req;

function navigate1(month,year,day) {
        var url = "http://"+window.location.hostname+"/include/calendar1.php?month="+month+"&year="+year+"&day="+day;
        if(window.XMLHttpRequest) {
                req = new XMLHttpRequest();
        } else if(window.ActiveXObject) {
                req = new ActiveXObject("Microsoft.XMLHTTP");
        }
        req.open("GET", url, true);
        req.onreadystatechange = callback1;
        req.send(null);
}

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

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

function setFade1(amt) {
	obj = document.getElementById("calendar1");
	
	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;
}

function navigate2(month,year,day,nextdate) {
        var url2 = "http://"+window.location.hostname+"/include/calendar2.php?month="+month+"&year="+year+"&day="+day+"&nextdate="+nextdate;
        if(window.XMLHttpRequest) {
                req2 = new XMLHttpRequest();
        } else if(window.ActiveXObject) {
                req2 = new ActiveXObject("Microsoft.XMLHTTP");
        }
        req2.open("GET", url2, true);
        req2.onreadystatechange = callback2;
        req2.send(null);
}

function callback2() {   
        obj2 = document.getElementById("calendar2");
       // setFade2(0);
        
		if(req2.readyState == 4) {
                        response2 = req2.responseText;
                        obj2.innerHTML = response2;
                /*if(req2.status == 200) {
                        response2 = req2.responseText;
                        obj2.innerHTML = response2;
                       // fade2(0);
                } else {
                        alert("There was a problem retrieving the data:\n" + req2.statusText);
                }*/
        }
}

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

function setFade2(amt) {
	obj = document.getElementById("calendar2");
	
	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;
}
