d=eval("document"); // I'm lazy;
var req = (window.XMLHttpRequest)? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
var err = "There was a problem loading the calendar:\n";
var eVerr = "There was a problem loading this days event:\n";

function gotoCal(month,year, public) {
	var url = "/modules/ajax/w_calendar_list.php?month="+month+"&year="+year+"&public="+public;
	req.open("GET", url, true);
	req.onreadystatechange = getCal;
	req.send(null);
}
function gotoEv(month,day,year, public) {
	
	var url = "/modules/ajax/w_calendar_list.php?events='yes'&month="+month+"&day="+day+"&year="+year+"&public="+public;
	req.open("GET", url, true);
	req.onreadystatechange = getEvt;
	req.send(null);
	return true;
}

function gotoList(month,day,year, public, lg) {

	window.location.href = "?module=calendar&action=list-events&month="+month+"&day="+day+"&year="+year+"&public="+public+"&lg="+lg;
}

function getCal(){
	try {
			
		if(req.status == 200){
			d.getElementById("calendar").innerHTML = req.responseText;
		}else{
			alert(err + req.statusText);
		}
	} catch (e) {
	}
}
function getEvt(){
	try {
		if(req.status == 200){
			t = req.responseText;
		}else{
			t = eVerr + req.statusText;
		}
	} catch (e) {
	}
	//overlib(t);
	
	document.getElementById('div_event_info').innerHTML = t;
	document.getElementById('div_event_info').style.display = '';
}
