
	String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };

	function basename(path) { return path.replace( /.*\//, "" ); } 

	function popup(url, x, y, nazwa) {
		var szer = x;
		var wys = y;
		
		if (nazwa == "") { nazwa = "okno"; }
		nazwa = nazwa.replace(/[^a-zA-Z0-9]/g, '_');

		var okno = window.open(url, nazwa, 'toolbar=0,location=0,directories=0,scrollbars=1,status=0,menubar=0,resizable=yes,width='+szer+',height='+wys);
		okno.moveTo(parseInt((screen.width - szer) / 2),parseInt((screen.height - wys) / 2));
		okno.focus();
	}

	function toggle(id) {
		$("#" + id).toggle();
		return false;
	}

	$(function() {

		// znajdź elementy menu i przypisz im podświetlanie
		$("#menu>ul>li").hover(
			function() { $(this).addClass('hl'); },
			function() { $(this).removeClass('hl'); }
		);

		// utwórz animacje linków do poprzedniej i kolejnej strony
		$("#page-prev").hover(
			function() { $(this).attr('src', '/img/page_prev_on.gif'); },
			function() { $(this).attr('src', '/img/page_prev_off.gif'); }
		);
		$("#page-next").hover(
			function() { $(this).attr('src', '/img/page_next_on.gif'); },
			function() { $(this).attr('src', '/img/page_next_off.gif'); }
		);
		
		// poskracaj bloczki
		$("div.bloczek>div.cut")
			.append('<a href="#" onclick="$(this).parent().find(\'li\').removeClass(\'hidden\').end().find(\'p\').removeClass(\'hidden\'); $(this).hide();return false;">Więcej...</a>')
				.find("p:gt(0)").addClass('hidden').end()
				.find("li:gt(2)").addClass('hidden').end()
				.find("p ~ ol").find("li").addClass('hidden').end().end()
				.find("p ~ ul").find("li").addClass('hidden');

		/* na razie wyłączone....
		var def_query = "Szukany tekst...";
		$("#search input[type=text]").val(def_query).addClass('faded').blur(
			function() { if ($(this).val() == "") $(this).val(def_query).addClass('faded'); }
		).focus(
			function() { if ($(this).val() == def_query) $(this).val("").removeClass('faded'); }
		);
		*/

	});
