$(document).ready(function(){
	//Default Action
	$(".tab_c").hide();
	$("ul.tabs li:first a").addClass("active").show(); 
	$(".tab_c:first").show();
	
	
    var a = window.location.hash;
    // Jeżeli jest w użyciu formularz kontaktowy to aktywujemy ostatnią zakładkę
    if(a) {
        if(a == '#module_form') {
            $("ul.tabs li a").removeClass("active");
        	$("ul.tabs li:last a").addClass("active");
        	$(".tab_c").hide(); 
        	var activeTab = $("ul.tabs li:last a").attr("rel");
        	$(activeTab).show();
        }
    }	
	
	$("ul.tabs li a").click(function() {    
		$("ul.tabs li a").removeClass("active");
    	$(this).addClass("active");
    	$(".tab_c").hide(); 
    	var activeTab = $(this).attr("rel");
    	$(activeTab).show();//fadeIn();
    	return false;
	});
	
	$('.f_img').fancybox({
        'hideOnContentClick': true
    });
    
    $('#zoommap').fancybox({
        'titleShow': false
    });
    
	$("a[rel=group]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
		    return '<span id="fancybox-title-over">Zdjęcie ' +  (currentIndex + 1) + ' / ' + currentArray.length + ' ' + title + '</span>';
		}
	});                        
    
	// ajax form submit
    $('#tabs_content .cmxform').submit(function() {
       // alert('Handler for .submit() called.');
        // $(this).hide();
       //  return false;
    });
    
    $('#mycarousel').jcarousel({
        vertical: true,
        scroll: 2
    });
    
    
});

$(function(){
    $('#ciekawostki-show span:gt(0)').hide();
    setInterval(function(){
      $('#ciekawostki-show span:first-child').fadeOut('slow')
         .next('span').fadeIn('slow')
         .end().appendTo('#ciekawostki-show');}, 
      5000);
});

