function mycarousel_initCallback(carousel) {
    $('#gallery-next').bind('click', function() {
        carousel.next();
        return false;
    });

    $('#gallery-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

$(document).ready(function(){
    
	$('a[href="?d=news"]').click(function(){
		$('#new').hide("fast");
		$('#news').show("fast");
		
		$('#tab_news').addClass("active");
		$('#tab_new').removeClass("active");

		return false;
	});
	$('a[href="?d=new"]').click(function(){		
		$('#news').hide("fast");
		$('#new').show("fast");
		
		$('#tab_new').addClass("active");
		$('#tab_news').removeClass("active");
		
		return false;
	});
	
	$('ul.page-list li a.cat').click(function(){		
		var tid = $(this).attr('id');
		
		if( $('#category_'+tid).is(':visible') ) { $('.arrow_'+tid).attr('src', '/IMAGES/_web/arrow_down.gif');}
		else { $('.arrow_'+tid).attr('src', '/IMAGES/_web/arrow_up.gif'); }
		
		$('#category_'+tid).toggle("fast");
		
		return false;
	});
	
	$('#searchForm a').click(function(){
		$('#searchForm').submit();					  
	});
	
	/*
	$('p.gallery-picker a').click(function(){		
		var id = $(this).attr('id');
		id = id.replace('pic_','');

		src = $('#pic_'+id+' img').attr('src').replace('/th_','/');
		$('p.gallery-picture a img').attr('src', src);
		
		return false;
	});
	*/
	
	/* stary shit - poczatek */
	/*
	$('#gal-img').jcarousel({
        vertical: true,
        scroll: 1,
		initCallback: mycarousel_initCallback,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
	
	$('a[href="?results"]').click(function(){
		$('#vote').hide("slow");
		$('#results').show("slow");
		
		return false;
	});
	
	$('a[href="?vote"]').click(function(){
		$('#results').hide("slow");
		$('#vote').show("slow");

		return false;
	});
	*/
	/* stary shit - koniec */
});
