/////////////////////////////////////////////////
//
// Javascripts by Stereo2software, 2006
//
/////////////////////////////////////////////////
//
// Please refer to http://www.stereo2software.com
// for more informations about use and permission
// of this file.
//
/////////////////////////////////////////////////

function toggle(elemento) {
	v = document.getElementById(elemento).style.display;
	if (v=="") v="none"; // IE
	document.getElementById(elemento).style.display = (v == "none") ? "block" : "none";
}

function getHTTPObject(){
	if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP");
	else if (window.XMLHttpRequest) return new XMLHttpRequest();
	else {
		alert("Your browser does not support AJAX.");
	return null;
	}
}
 
// Change the value of the outputText field
function setOutput(){
	if(httpObject.readyState == 4){
	document.getElementById('show_cal').innerHTML = httpObject.responseText;
	}
}
 

// Implement business logic

function showCalendario(mm,yyyy){
	//alert(mm+'+'+yyyy);
	if ( mm=='0' && yyyy=='0' ) {
		var now = new Date();
		var mm = now.getMonth()+1;
		var yyyy = now.getFullYear();
	}
	//alert(mm+'+'+yyyy);
	//alert('mese'+mm+'anno'+yyyy);
	httpObject = getHTTPObject();
	if (httpObject != null) {
		httpObject.open("GET", "ajax/calendario.php?mese="+mm+"&anno="+yyyy, true);
		httpObject.send(null);
		httpObject.onreadystatechange = setOutput;
	}
}


function toggleCalendario(mm,yyyy) {
	if (document.getElementById('show_cal').innerHTML=='') {
		//alert(1)
		showCalendario(mm,yyyy)
	}
	else {
		//alert(0)
		document.getElementById('show_cal').innerHTML='';
	}
}

window.onload=showCalendario(0,0);