function slide(name) {
	$("div#viewer ."+name).animate({left:"200px"}, 1000, "linear", function() {
		$(this).css({left:"1200px"});
		slide(name);
	});
}
function calendar(month, year, day) {
	$(".aktualnosci").load("cal.php?m="+month+"&y="+year+"&day="+day+"&jx=1");
}
function changeRel() {
	$("a[rel=jx]").each(function(i) {
		href = $(this).attr('href').replace(/.html/g, '');
		$(this)
		.attr('href', '#'+href)
		.attr('rel', href)
		.removeAttr('rel');
	});
}
$(document).ready(function() {
	$("div#viewer div").each(function(i) {
		i = $(this).css('left');
		alert(i);
	});
	changeRel();
	var data = new Date();
	calendar(data.getMonth()+1, data.getFullYear(), data.getDate());
	$.address.change(function(event) {
		if(event.value != "/") {// { event.value = window.location.pathname.match(/([a-z]+).html/)[1]; }
//		else {
			if(event.value.substr(0, 1) == "/")
				event.value = event.value.substr(1);

			$("#center").load("gen.php?url="+event.value+"&jx=1");
			$("#menu a").each(function(i) {
				if($(this).attr("href") == "#"+event.value) {
					$("#menu a").each(function(i) {
						$(this).css({backgroundPosition: "left top"});
					});
					$(this).css({backgroundPosition: "left bottom"});
				}
			});
		}
	});
});

