function text_speed(area_name, txt1, txt2){
	jQuery.noConflict();
	(function($){ 
		$('#'+area_name).toggle('slow');
		if ((document.getElementById('txt_'+area_name).innerHTML == txt1)){
			document.getElementById('txt_'+area_name).innerHTML = txt2;
			$.cookie(area_name, '1');
		}else{
			document.getElementById('txt_'+area_name).innerHTML = txt1;
			$.cookie(area_name, null);
		}
	})(jQuery);
}

jQuery.noConflict();
jQuery(document).ready(function($){
	//Zmienne
	var arch = "Archiwum wydarzeń"; 
	var s1 = "[Rozwiń]";
	var s2 = "[Zwiń]";
	
	/*Dynamiczna zmiana*/
	$(".tab1").mouseover(function(){
		$(this).removeAttr("class").addClass("tab0");
	}).mouseout(function(){
		$(this).removeAttr("class").addClass("tab1");
	});

	$(".tab2").mouseover(function(){
		$(this).removeAttr("class").addClass("tab0");
	}).mouseout(function(){
		$(this).removeAttr("class").addClass("tab2");
	});
	/*End dynamiczna zmiana*/
	
	$("#txt_archive").click(function(){
		if($.cookie("archive_events") == 1){
			$.cookie("archive_events", '0');
			$("#archive").toggle('slow');
			$("#txt_archive").html(arch+" "+s1);
		}else{
			$.cookie("archive_events", '1');
			$("#archive").toggle('slow');
			$("#txt_archive").html(arch+" "+s2);
		}
	});

	if($.cookie("archive_events") == 1){
		$("#txt_archive").html(arch+" "+s2);
		$("#archive").show();
	}

	$(".ajax_page_archive").click(function(){
		var id = $(this).attr("href").match(/#([0-9]+)/)[1];
		$.post("./ajax_page_archive.php", {page:id}, function(returned_data){$("#archive_table").html(returned_data);}, "html");
		$.cookie("archive_page", id);
	});

	if($.cookie("archive_page")){
		var id = $.cookie("archive_page");
		$.post("./ajax_page_archive.php", {page:id}, function(returned_data){$("#archive_table").html(returned_data);}, "html");
	}
});
