	function otworz(url){
		var wys=450;
		var szer=555;
		var odl=(window.screen.width/2)-(szer/2);
		var odt=(window.screen.height/2)-(wys/2);
		noweOkno=window.open(url, "tinyWindow", 'menubar=no, toolbar=no, location=no, scrollbars=no, resizable=no, status=no, width='+szer+',height='+wys+',left='+odl+', top='+odt) ;
		noweOkno.focus();
		return false;
	}
	
	function agree(co){
		buton=document.getElementById(co);
		if(buton.disabled)buton.disabled = false;
		else buton.disabled = true;
	}
	
	function validate_mail(email){
				
		var error="";
		var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
		var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ ;
			   
		if(!emailFilter.test(email)){
			error = true;
		}else if(email.match(illegalChars)){
			error = true;
		}else{	
			error=false;
		}
				
		return error;
	}

	function check_cat_news(categories){
			
			var cat='';
			var id_cat='';

			if(categories)cat=3;
			else cat=2;
			
			email=document.getElementById("email").value;
			div_alert=document.getElementById("div_alert_cat");
			buton=document.getElementById("send");
			
			if(!validate_mail(email)){
				//TABLICA KATEGORII NEWSLETTERA
				for(var i = 0; i < document.forms["agreeform"].length; i++){ 
					if(document.forms["agreeform"].elements[i].checked==true){
						id_cat+=document.forms["agreeform"].elements[i].value + "^";
					}
				}
				
				//polityka na on oraz ^ 3 z kategoriami 2 bez
				if(cat==3){
					if(id_cat.length<=3){

						div_alert.className="view";
						div_alert.innerHTML= zaznacz_rodzaj_news;
						
					}else{

						div_alert.className="hidden";
						document.agreeform.submit();
					}

				}else{
					
					div_alert.className="hidden";
					document.agreeform.submit();
				}
				
			}else{

				div_alert.className="view";
				div_alert.innerHTML= adres_nieprawidlowy;
			}
		}