$(document).ready(function(){
	$('a.prev').click(function(event){
		nav = navigator.appVersion;
		if(nav.indexOf('MSIE 7.0')!=-1){
			data = $(this).attr('href');
			ultimo = ($(this).attr('href').lastIndexOf('/'));
			data = $(this).attr('href').substring(ultimo+1,ultimo+8);
			data = data.split('-');
		}else{
			data = $(this).attr('href').split('-');
		}
		event.preventDefault();
		$.ajax({
			type: "GET",
			url: "consultas.php",
			cache: false,
			data: 'mes='+data[0]+'&ano='+data[1],
			success: function(html){
				$("#calendario").html(html);
			}
		});
	});
	$('a.next').click(function(event){
		nav = navigator.appVersion;
		if(nav.indexOf('MSIE 7.0')!=-1){
			data = $(this).attr('href');
			ultimo = ($(this).attr('href').lastIndexOf('/'));
			data = $(this).attr('href').substring(ultimo+1,ultimo+8);
			data = data.split('-');
		}else{
			data = $(this).attr('href').split('-');
		}
		event.preventDefault();
		$('#calendario').empty().html('<div class="loader"><img src="imagens/fundos/ajax-loader.gif" alt="Carregando" /></div>');
		$.ajax({
			type: "GET",
			url: "consultas.php",
			cache: false,
			data: 'mes='+data[0]+'&ano='+data[1],
			success: function(html){
				$("#calendario").html(html);
			}
		});
	});/*
	$('td.dia a').click(function(event){
		event.preventDefault();
		$('#evento').empty().html('<img src="imagens/fundos/ajax-loader.gif" alt="Carregando" />');
		$.ajax({
			type: "GET",
			url: "consultas.php",
			cache: false,
			data: 'data_evento='+$(this).attr('href'),
			error: function(XMLHttpRequest, textStatus, errorThrown){
				$('#evento').html(textStatus);
			},
			success: function(html){
				$('#evento').html(html);
			}
		});
	});*/
});
