function prevMonth(month, year){

	if(parseInt(month) == 1){
		
		month = 12;
		year = parseInt(year) - 1;
	}else{
		month -= 1;
	}
	
	showMonth(month, year);
}

function nextMonth(month, year){
	
	if(parseInt(month) == 12){
		
		month = 1;
		year = parseInt(year) + 1;
	}else{
		month += 1;
	}
	
	showMonth(month, year);
}

function showMonth(month, year){
	
	jQuery('.eventcalendar tbody').css({'opacity':'0'});
	
	jQuery.ajax({
		url:'index.php?option=com_one&scheme=event&task=calendarMonth&view=month&month=' + month + '&year=' + year + '&query=published&tmpl=blank',
		type: 'GET',
		dataType: 'html',
		success: function(data){
			jQuery('.calendarContainer').html(data);
			jQuery('.eventcalendar tbody, .eventcalendar .curmonth').css({'display':'none'});
			jQuery('.eventcalendar tbody, .eventcalendar .curmonth').fadeIn(300, function(){
				codaPopup();
			});
		},
		error: function(jqXHR, textStatus, errorThrown){
			alert(textStatus);
		}
	});
}
