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

	function popup(url, x, y) {
		var szer = x;
		var wys = y;
		okno = window.open(url, 'Okno', 'toolbar=0,location=0,directories=0,scrollbars=0,status=0,menubar=0,resizable=no,width='+szer+',height='+wys);
		okno.moveTo(parseInt((screen.width - szer) / 2),parseInt((screen.height - wys) / 2));
		okno.focus();
	}

	function checkPersonalForm() {
		var f = document.forms['personal'];

		if (!f.elements['name'].value.length) {
			alert("Proszę podać imię");
			return false;
		}

		if (!f.elements['surname'].value.length) {
			alert("Proszę podać nazwisko");
			return false;
		}

		if (!f.elements['postal_code'].value.match(/^\d{2}-\d{3}$/)) {
			alert("Nieprawidłowy format kodu pocztowego");
			return false;
		}

		if (!f.elements['city'].value.length) {
			alert("Proszę podać miasto");
			return false;
		}

		return true;
	}

	function checkRegisterForm() {
		var f = document.forms['personal'];

		if (!checkPersonalForm()) return false;

		if (!f.elements['email'].value.length) {
			alert("Proszę podać e-mail");
			return false;
		}

		if (!f.elements['email'].value.match(/^[a-zA-Z0-9-.+]+\@[a-zA-Z0-9-.]+\.[a-zA-Z]+$/)) {
			alert("Nieprawidłowy format adresu e-mail");
			return false;
		}

		return true;
	}

	$(function(){

		$("#search input.in").example("Szukaj...");

		$('a.lightbox').lightBox({
        	imageLoading: '/img/lightbox-ico-loading.gif',
			imageBtnClose: '/img/lightbox-btn-close.gif',
			imageBtnPrev: '/img/lightbox-btn-prev.gif',
			imageBtnNext: '/img/lightbox-btn-next.gif',
			txtImage: 'Obraz',
			txtOf: 'z'
		});

	});
