function popupChat() {
	var newWindow;
	newWindow = window.open('/_chat/client.php','ChatWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=no,copyhistory=no,width=545,height=650,screenX=150,screenY=150,top=150,left=150');
	if(newWindow!=null && window.focus) newWindow.focus();
}

function checkEmail(address){
	wzorEmail  =/^[0-9a-zA-Z._-]+\@([0-9a-zA-Z-]+\.)+[0-9a-zA-Z]{2,4}$/;
	if(!wzorEmail.test(address)){
		alert('Podaj poprawny adres e-mail.');
		return false;
	}
return true;
}
$(document).ready(function(){
	$('#nowosc-checkbox').click(function(){
		if($('#nowosc-checkbox').attr('checked')) {
			$("#nowosc-row").css('display', 'block');
		}
		else {
			$("#nowosc-row").css('display', 'none');
			$("#nowosc-main").attr('checked', false);
		}
	})
	$('#polecane-checkbox').click(function(){
		if($('#polecane-checkbox').attr('checked')) {
			$("#polecane-row").css('display', 'block');
		}
		else {
			$("#polecane-row").css('display', 'none');
			$("#polecane-main").attr('checked', false);
		}
	})
	
	$('#wyslij').click(function(){
		if($('#wyslij').attr('checked')==true) {
			$('#adresy').css('display', 'block');
			$.getJSON('/_ajax/mailing_list.php', {}, function(json){
			if(json.ok == true){
				$('#adresy-lista').html(json.html);
			}
			})
		}
		else {
			$('#adresy').css('display', 'none');
			$("input[name^='euser']").attr("checked", false);
		}
	})
	$('#select-all').click(function(){
		$("input[name^='euser']").attr("checked", true);
	})
	$('#select-none').click(function(){
		$("input[name^='euser']").attr("checked", false);
	})
});
