$('a[@rel*=lightbox]').lightBox();

function zmien_miniaturke () {
	var nzdj = $(this).css("background-image");
	var lewya = $('.duze a img').get(0);
	lewya = lewya.parentNode;
	var szdj = $(lewya).css("background-image");
	var snzdj = nzdj.match(/130x93\/(.*)\)/);snzdj = snzdj[1];
	var a = $('.duze a[href*='+snzdj+']').get(0);
	$('.duze a img').prependTo(a);
	return false;
}

$('.male a').click(zmien_miniaturke);

/*$(".date").datepicker({ 
    dateFormat: "dd-mm-yy"
});*/

x = 20;
y = 70;
function klik_regulamin() {
	var vis = $('#regulamin').css('display');
	vis = vis == 'none'?'':'none'
	$('#regulamin').css('display',vis);
	sw_gs();
}
function sw_gs() {
	if (!$('#regulamin') || $('#regulamin').css('display') == 'none') {
		$('#wojewodztwo').css('visibility','visible');
		$('#panstwo').css('visibility','visible');
	} else {
		$('#wojewodztwo').css('visibility','hidden');
		$('#panstwo').css('visibility','hidden');
	}
}
$('#akceptuje').click(function () {
	$('#akceptacja').attr('checked',true);
	$('#regulamin').css('display','none');
	sw_gs();
});
$('#zamknij').click(function () {
	$('#regulamin').css('display','none');
	sw_gs();
});
function sw_vis(id) {
	sw = document.getElementById(id);
	sw.style.display = (sw.style.display == 'none') ? '' : 'none';
}
function placeIt()
{
	obj = document.getElementById('regulamin');
	if (!obj) return;
	if (document.documentElement)
	{
		theLeft = document.documentElement.scrollLeft;
		theTop = document.documentElement.scrollTop;
	}
	else if (document.body)
	{
		theLeft = document.body.scrollLeft;
		theTop = document.body.scrollTop;
	}
	theLeft += x;
	theTop += y;
	obj.style.top = theTop + 'px' ;
	setTimeout("placeIt()",20);
}
$("#potwdost").click(function(){
	if ($("input:checked[name='dostawa']").length) return true;
	else {
		alert('Prosz� wybra� metode wysy�ki oraz spos�b p�atno�ci.');
		return false;
	}
});

/*$(document).ready(function() {

	if (parseInt($.cookie('popup_new')) != 1)
	{
		window.setTimeout(function() {
			$('div#reklama').fadeIn(500);
			$('div#reklama span').click(function() {
				$('div#reklama').fadeOut(200);
				var date = new Date();
				date.setTime(date.getTime() + (60 * 60 * 1000));
				$.cookie('popup_new', '1', { path: '/', expires: date});

			});
		}, 2000);
	}

});*/
