var DisplayNum = 0;
var nMaxHeight =0;

$(document).ready( function() {
	$("#wp-calendar table").each(function(){
   	if(nMaxHeight < $(this).height())
		{
			nMaxHeight = $(this).height();
		}
	$("#wp-calendar").height(nMaxHeight);
	});
	
	$("#wp-calendar table:not(:eq(0))").hide();
});

jQuery(function($){
	$("#bt_next").click(function () {
		$('#wp-calendar table:eq(' + DisplayNum + ')').fadeOut(
			"slow",
			function(){
				if( DisplayNum < ($("#wp-calendar table").length -1))
				{
					DisplayNum++;
				} else {
//					DisplayNum = 0;
				}
				$('#wp-calendar table:eq(' + DisplayNum + ')').fadeIn(1000);
			}
		);
	})

	$("#bt_back").click(function () {
		$('#wp-calendar table:eq(' + DisplayNum + ')').fadeOut(
			"slow",
			function(){
				if( DisplayNum > 0)
				{
					DisplayNum--;
				} else {
//					DisplayNum = 0;
				}
				$('#wp-calendar table:eq(' + DisplayNum + ')').fadeIn(1000);
			}
		);
	})

});

