var $$$ = jQuery.noConflict();
$$$(document).ready(function(){
	var base = 'library/calendar/';
	$$$('.calendar-guardias a.prev-year').live('click' , function(){
		var body = $$$.ajax({
			url: base + 'guardias.calendar.php' + $$$(this).attr('href'),
			cache: false,
			async: false
		}).responseText;
		$$$(this).parents('table').replaceWith(body);

		var list = $$$.ajax({
			url: 'modulos/ajax/guardias.php' + $$$(this).attr('href'),
			cache: false,
			async: false
		}).responseText;
		$$$('div.horarioR').html(list);
		return false;
	});
	
	$$$('.calendar-guardias a.prev-month').live('click' , function(){
		var body = $$$.ajax({
			url: base + 'guardias.calendar.php' + $$$(this).attr('href'),
			cache: false,
			async: false
		}).responseText;
		$$$(this).parents('table').replaceWith(body);

		var list = $$$.ajax({
			url: 'modulos/ajax/guardias.php' + $$$(this).attr('href'),
			cache: false,
			async: false
		}).responseText;
		$$$('div.horarioR').html(list);
		return false;
	});
	
	$$$('.calendar-guardias a.next-month').live('click' , function(){
		var body = $$$.ajax({
			url: base + 'guardias.calendar.php' + $$$(this).attr('href'),
			cache: false,
			async: false
		}).responseText;
		$$$(this).parents('table').replaceWith(body);

		var list = $$$.ajax({
			url: 'modulos/ajax/guardias.php' + $$$(this).attr('href'),
			cache: false,
			async: false
		}).responseText;
		$$$('div.horarioR').html(list);
		return false;
	});
	
	$$$('.calendar-guardias a.next-year').live('click' , function(){
		var body = $$$.ajax({
			url: base + 'guardias.calendar.php' + $$$(this).attr('href'),
			cache: false,
			async: false
		}).responseText;
		$$$(this).parents('table').replaceWith(body);

		var list = $$$.ajax({
			url: 'modulos/ajax/guardias.php' + $$$(this).attr('href'),
			cache: false,
			async: false
		}).responseText;
		$$$('div.horarioR').html(list);
		return false;
	});
	
	$$$('.calendar-guardias.popup').hide();
});

function toggleCalendar (id){
	if($$$(id).css('display') == 'none'){
		$$$(id).show();
	} else {
		$$$(id).hide();
	}
}