function toggleEvent(node) {
	
	node = $(node).children('.item');
	
	if(!$(node).hasClass('itemOpen')) {
		
		$('.events .calendarTable .weekBlock .day .item').each(function() {
			
			$(this).parent().css({
				zIndex: 1
			});
			
			$(this).parent().parent().css({
				zIndex: 1
			});
				
			$(this).removeClass('showContent');
			
			$(this).stop().animate({
				width: '108px',
				height: '72px'
			}, 250, function() {
				$(this).removeClass('itemOpen');
			});
		
		});
		
		$(node).addClass('itemOpen');
		
		/* alert($(node).parent().prop('class')); */
		$(node).parent().css({
			zIndex: 10
		});
		
		$(node).parent().parent().css({
			zIndex: 10
		});
		
		$(node).stop().animate({
			width: '217px',
			height: '218px'
		}, 250, function() {
			
			$(node).addClass('showContent');
			
		});
		
	} else {
		
		$(node).removeClass('showContent');
		
		$(node).stop().animate({
			width: '108px',
			height: '72px'
		}, 250, function() {
			$(node).removeClass('itemOpen');
		});
	
	}
	
}

function changeCalendarPage(month, year) {
	
	$.ajax({
		type: "POST",
		url: "_ajax/calendar.php",
		cache: false,
		data: "m=" + month + '&y=' + year,
		success: function(data) {
			
			$('.calendarTable').html(data);
			
			$('.calendarTable span').css({
				display: 'block'
			});
			
			$('.calendarTable a').css({
				display: 'inline'
			});
		
		}
	});
	
}

function switchEventView(node, page) {

	$('.events .subtitle .item span').removeClass('active');
	$(node).addClass('active');
	
	if(page == 'list') {
		
		$('.events .calendarTable').removeClass('activeTable');
		$('.events .listTable').addClass('activeTable');
		
	} else {
	
		$('.events .listTable').removeClass('activeTable');
		$('.events .calendarTable').addClass('activeTable');
	
	}

}
