// Mes actual
var $fecha=new Date();	
var $dia=01;
var $mes=$fecha.getMonth()+1;
var $ano=$fecha.getFullYear();
// Muestra calendario
function showcalendar($date) {
	$.post("calendar.php", { fecha: $date }, function(data){
	$("#calendarWrapper").html(data);
	});				
}
function previousdate() {
	if ($mes<=1) {
		$mes=12;
		$ano=$ano-1;
	} else {
		$mes=$mes-1;
	}
	$fechaactual=String($dia)+'-'+String($mes)+'-'+String($ano);	
	showcalendar($fechaactual);
}
function nextdate() {
	if ($mes>=12) {
		$mes=1;
		$ano=$ano+1;
	} else {
		$mes=$mes+1;
	}	
	$fechaactual=String($dia)+'-'+String($mes)+'-'+String($ano);	
	showcalendar($fechaactual);
}
function today() {
	$fecha=new Date();	
	$dia=$fecha.getDate();
	$mes=$fecha.getMonth()+1;
	$ano=$fecha.getFullYear();
	$fechaactual=String($dia)+'-'+String($mes)+'-'+String($ano);	
	showcalendar($fechaactual);
	//alert($fechaactual);
}
function mostrarevento($fecha) { 
	$("#eventsWrapper").slideDown("slow");
	$.post("show_event.php", { fecha: $fecha }, function(data){
	$("#eventsWrapper2").html(data);
	});	
	//alert("funka");
}
function hideitem($cual) {
	$($cual).slideUp("slow");
}
function printevents($month, $year) {
	window.open("print-calendar.php?month="+$month+"&year="+$year, "Print Events", "toolbar=0, scrollbars=1, location=0, statusbar=0, menubar=0, resizable=0, width=600, height=400");
}