jQuery.ajaxSetup({contentType: "application/x-www-form-urlencoded; charset=utf-8"});

$(document).ready(function(){
	/* png transparent for IE6 */
	//$.ifixpng('data/img/pixel.gif');
	//$('#headerLogo img, img#Dot360').ifixpng();
	
	// galeria
	$("div.gallery .photo a").fancybox({ 'hideOnContentClick': true, 'overlayShow': false });
	
	// tooltip
	get_calendar();
});

jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}

function showMonth(el) {
	var date = $(el).attr("title");
	var calendar = $('#calendar');
	calendar.fadeOut('slow', function() {
		calendar.html('<p>trwa wczytywanie...</p>');
		
		
		$.ajax({
			type: "GET",
			url: "/inc/calendar.inc.php",
			data: "date="+date,
			success: function(msg){
				calendar.hide();
				calendar.html( msg );
				calendar.fadeIn("slow", function() {
					get_calendar();
				});
			}
		});
	});
}

function get_calendar(){
	jQuery("#calendar div.days span").tooltip({ 
    	track: true, 
    	delay: 0, 
    	showURL: false, 
    	showBody: " - ", 
    	fade: 250 
	});
	
	$("#calendar span.left, #calendar span.right").click(function(){ showMonth(this); })
}
