$(function() { 
	$(".ludzie_wiecej a").click(function() {
		var e = $(this).parent().parent().find(".ludzie_opislong");
		if( e.is(":visible")) {
			e.slideUp();
			$(this).html("czytaj więcej...");	
		} else {
			e.slideDown();
			$(this).html("schowaj opis");
		}
		return false;
	});
	var h = window.location.hash;
	if(h.substr(0,7) == '#osoba_') {
		$(h).find(".ludzie_wiecej a").click();
	}
	
});



var c_el;
var c_cur = -1;

$(function() {
	c_el = $("div.top_cytaty_el");
	if(c_el.length>0) {
		if(c_el.length==1) c_el.show();
		else {
			CytatNext();
		}
	}
});

function CytatNext() {
	if(c_cur>=0) {
		$(c_el[c_cur]).fadeOut(1100);
	}
	c_cur = (c_cur+1) % (c_el.length);
	$(c_el[c_cur]).fadeIn(1100, function() {
		setTimeout("CytatNext()",5000);
	
	});
}



$(function() {
	$("div#do_gory a").click(function() {
		$(window)._scrollable().scrollTo(0,"slow");
		return false;
	
	});
});

	var menu_timeouts = new Object();
	var menu_timeout = 50;
	$(function() {
		$("#menu_glowne li,.submenu li").hover(
			function() {
				var m = $(this).attr("id");
				if(m.length) {
					clearTimeout(menu_timeouts[m]);
					m = $("#sub"+$(this).attr("id"));
					if(m.length) {
						var o = $(this).offset();
						if($(this).parent().hasClass("submenu")) {
							m.css("left",o.left+158).css("top",o.top).show();
						} else {
							m.css("left",o.left).css("top",o.top+50).show();
						}
					}
				}
			},function() {
				var m = $(this).attr("id");
				if(m.length) {
					menu_timeouts[m] = setTimeout("SchowajMenu('"+m+"')",menu_timeout);
					
				}
			}
		);
		
		
		$(".submenu,.submenu2").hover(
			function() {
				var m = $(this).attr("id").substr(3);
				clearTimeout(menu_timeouts[m]);
				if($(this).hasClass("submenu2")) {
					m = $("#"+m).parent("ul").attr("id").substr(3);
					clearTimeout(menu_timeouts[m]);
				}
			},function() {
				var m = $(this).attr("id").substr(3);
				menu_timeouts[m] = setTimeout("SchowajMenu('"+m+"')",menu_timeout);
				if($(this).hasClass("submenu2")) {
					m = $("#"+m).parent("ul").attr("id").substr(3);
					menu_timeouts[m] = setTimeout("SchowajMenu('"+m+"')",menu_timeout);
				}
			}
		);
	});
	
	
	function SchowajMenu(id) {
		var m = $("#sub"+id);
		m.hide();
	
	}
