var $$$ = jQuery.noConflict();
$$$(document).ready(function(){
	var base = 'library/calendar/';
	$$$('.ott-calendar a.prev-year').live('click' , function(){
		var body = $$$.ajax({
			url: base + 'ott.calendar.php' + $$$(this).attr('href')+ "&analisis=" + $$$('#tipo_test option:selected').val(),
			cache: false,
			async: false
		}).responseText;
		$$$(this).parents('table').replaceWith(body);
		return false;
	});
	
	$$$('.ott-calendar a.prev-month').live('click' , function(){
		var body = $$$.ajax({
			url: base + 'ott.calendar.php' + $$$(this).attr('href')+ "&analisis=" + $$$('#tipo_test option:selected').val(),
			cache: false,
			async: false
		}).responseText;
		$$$(this).parents('table').replaceWith(body);
		return false;
	});
	
	$$$('.ott-calendar a.next-month').live('click' , function(){
		var body = $$$.ajax({
			url: base + 'ott.calendar.php' + $$$(this).attr('href')+ "&analisis=" + $$$('#tipo_test option:selected').val(),
			cache: false,
			async: false
		}).responseText;
		$$$(this).parents('table').replaceWith(body);
		return false;
	});
	
	$$$('.ott-calendar a.next-year').live('click' , function(){
		var body = $$$.ajax({
			url: base + 'ott.calendar.php' + $$$(this).attr('href')+ "&analisis=" + $$$('#tipo_test option:selected').val(),
			cache: false,
			async: false
		}).responseText;
		$$$(this).parents('table').replaceWith(body);
		return false;
	});
	
	$$$('.ott-calendar.popup').hide();
});

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