// JavaScript Document
function pokaz(id) {
var d = document.getElementById(id);
if (d) {d.style.display='block';}
}

function ukryj(id){
var d = document.getElementById(id);
if (d) {d.style.display='none';}
}

function isDigit (c)
{
var re = new RegExp("[0-9]","gi");
return (numer=c.replace(re,""))
}

function checkPhone(t){
switch(t.length) 
{
 case 10: 
 	  	   var c1 = t.charAt(0)+t.charAt(1);
		   var c2 = t.charAt(2)+t.charAt(3)
		   var c = c1 +c2;
		   if ((c=='0700')||(c=='0800')||(c1=='00')){
		   alert('Błędnie podałeś/aś numeru telefonu\n---------------------------------------------------------\nPodaj numer telefonu wpisując numer kierunkowy oraz numer telefonu w jednym ciągu.\nNie używaj znaków - + ( )\nPrzykład 0226521367.');
		   return false;
		   }
 	  	  break; 
 case 9:  var c1 = t.charAt(0);
 	      var c2 = t.charAt(1)+t.charAt(2);
		  var c = c1 +c2;
		  if ((c=='700')||(c=='800')||(c1=='0')){
 	  	  alert('Błędnie podałeś/aś numeru telefonu\n---------------------------------------------------------\nPodaj numer telefonu wpisując numer kierunkowy oraz numer telefonu w jednym ciągu.\nNie używaj znaków - + ( )\nPrzykład 226521367.');
    	  return false;
		  }
		  numer= '0'+t;
		  return numer;
 	  	  break; 
 case 7:  var c1 = t.charAt(0);
		  if (c1=='0'){
 	  	  alert('Błędnie podałeś/aś numeru telefonu\n---------------------------------------------------------\nPodaj numer telefonu wpisując numer kierunkowy oraz numer telefonu w jednym ciągu.\nNie używaj znaków - + ( )\nPrzykład 6521367.');
    	  return false;
		  }
 	  	  break;
 default: alert('Za krótki  numeru telefonu\n---------------------------------------------------------\nPodaj numer telefonu wpisując numer kierunkowy oraz numer telefonu w jednym ciągu.\nNie używaj znaków - + ( )\nPrzykład 0226521367.') 
 return false; //gdyby żaden warunek nie został spełniony
}
return true;
}

function sprawdz(f){
var blad=false;
var tekst='';

if (f.imie_nazwisko.value=='') {
	tekst= tekst + "Nie podałeś/aś swojego imienia, nazwiska lub nazwy firmy\n";
	blad=true;	
}
if (f.telefon1.value+f.telefon2.value==''){
	tekst= tekst + "Nie podałeś/aś numeru telefonu\n";
	blad=true;	
}
else{
	if (isDigit(f.telefon1.value+f.telefon2.value)!='') {
	tekst= tekst + "Błędnie podałeś/aś numer telefonu. \n";
	blad=true;
}
if (checkPhone(f.telefon1.value+f.telefon2.value)==false){
	tekst= tekst + "Błędnie podałeś/aś numer telefonu. \n";
	blad=true;	
	}
}
if ( ((f.email.value.indexOf('@',1))==-1)||(f.email.value.indexOf('.',1))==-1 ){
	tekst= tekst + "Nie podałeś/aś lub źle wpisałeś adres email\n";
	blad=true;
}

 if (f.zgoda.checked==false) {
	tekst= tekst + "Nie wyraziłeś/aś zgody na przetwarzanie swoich danych osobowych\n";
	blad=true;
}

if(blad){
alert('Wystąpiły błędy podczas wypełniania formularza:\n---------------------------------------------------------\n\n'+tekst);
return false;
}
else {return true;}
}


var karton = '';

function kartony(nazwa) {
	var url='popup.php?img='+nazwa+'&rodzaj=kartony';
	if (!karton.closed && karton.location) {
		karton.location.href = url;
	}
 karton=window.open(url,'kartony','height=307,width=295,left=300,top=100,scrollbars=no,resizable=yes,toolbar=no,userbar=no,location=no,status=no,menubar=no');
 if (!karton.opener) karton.opener = self;
if (window.focus) {karton.focus()}
}


var profil = '';

function profile(nazwa) {
	var url='popup.php?img='+nazwa+'&rodzaj=profile';
	if (!profil.closed && profil.location) {
		profil.location.href = url;
	}
 profil=window.open(url,'profile','height=300,width=300,left=300,top=100,scrollbars=no,resizable=yes,toolbar=no,userbar=no,location=no,status=no,menubar=no');
 if (!profil.opener) profil.opener = self;
if (window.focus) {profil.focus()}
}

var profild = '';

function profile_drewn(nazwa) {
	var url='popup.php?img='+nazwa+'&rodzaj=profiled';
	if (!profild.closed && profild.location) {
		profild.location.href = url;
	}
 profild=window.open(url,'profile_drewn','height=640,width=436,left=300,top=10,scrollbars=no,resizable=yes,toolbar=no,userbar=no,location=no,status=no,menubar=no');
 if (!profild.opener) profild.opener = self;
if (window.focus) {profild.focus()}
}

var profild2 = '';

function profile_drewn2(nazwa) {
	var url='popup.php?img='+nazwa+'&rodzaj=profiled';
	if (!profild2.closed && profild2.location) {
		profild2.location.href = url;
	}
 profild2=window.open(url,'profile_drewn','height=300,width=300,left=300,top=10,scrollbars=no,resizable=yes,toolbar=no,userbar=no,location=no,status=no,menubar=no');
 if (!profild2.opener) profild2.opener = self;
if (window.focus) {profild2.focus()}
}


var akces = '';

function akcesoria(nazwa) {
	var url='popup.php?img='+nazwa+'&rodzaj=akcesoria';
	if (!akces.closed && akces.location) {
		akces.location.href = url;
	}
 akces=window.open(url,'akcesoria','height=300,width=300,left=300,top=50,scrollbars=no,resizable=yes,toolbar=no,userbar=no,location=no,status=no,menubar=no');
 if (!akces.opener) akces.opener = self;
if (window.focus) {akces.focus()}
}

var stoj = '';

function stojak(nazwa) {
	var url='popup.php?img='+nazwa+'&rodzaj=stojaki';
	
	if (!stoj.closed && stoj.location) {
		stoj.close();
	}
	if (nazwa!='sto_1.jpg'){ stoj=window.open(url,'stojaki','height=300,width=300,left=300,top=50,scrollbars=no,resizable=yes,toolbar=no,userbar=no,location=no,status=no,menubar=no');	}
	else  {stoj=window.open(url,'stojaki','height=650,width=300,left=300,top=50,scrollbars=no,resizable=yes,toolbar=no,userbar=no,location=no,status=no,menubar=no');}
 if (!stoj.opener) stoj.opener = self;
if (window.focus) {stoj.focus()}
}

var wiez = '';

function wieza(nazwa) {
	var url='popup.php?img='+nazwa+'&rodzaj=wieze';
	if (!wiez.closed && wiez.location) {
		wiez.location.href = url;
	}
 wiez=window.open(url,'akcesoria','height=650,width=300,left=300,top=50,scrollbars=no,resizable=yes,toolbar=no,userbar=no,location=no,status=no,menubar=no');
 if (!wiez.opener) wiez.opener = self;
if (window.focus) {wiez.focus()}
}

var stoj2 = '';

function stojak_ramy(nazwa) {
	var url='popup.php?img='+nazwa+'&rodzaj=stojaki';
	
	if (!stoj2.closed && stoj2.location) {
		stoj2.close();
	}
	stoj2=window.open(url,'stojaki','height=500,width=600,left=300,top=50,scrollbars=no,resizable=yes,toolbar=no,userbar=no,location=no,status=no,menubar=no');
 if (!stoj2.opener) stoj2.opener = self;
if (window.focus) {stoj2.focus()}
}



function mapadojazdu() {
win=window.open('','mapa','height=335,width=513,left=300,top=100,scrollbars=no,resizable=yes,toolbar=no,userbar=no,location=no,status=no,menubar=no');
with (win.document) {
  open('text/html', 'replace');
  write('<html><head><title>NielsenBainbridge - Mapa dojazdu</title>');
  write('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />');
  write('<style type="text/css">body{padding:0px;margin:0px;background:#FFFFFF;}</style>');
  write('</head>');
  write('<body><img src=\"grafika/plan_dojazdu-big.jpg\"  border=\"0\" class=\"ramka\" /></body></html>');
  close();
}
}

function news(mypage){
var w = 410;
var h = 280;
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no,resizable=yes'
win = window.open(mypage,"popup",settings);
return void(null);
}

var stoj2 = '';

function powieksz(nazwa,w,h) {
	var url='popup.php?img='+nazwa+'&rodzaj=ramy';
	
	if (!stoj2.closed && stoj2.location) {
		stoj2.close();
	}
	stoj2=window.open(url,'ramy','height='+h+',width='+w+',left=300,top=50,scrollbars=no,resizable=yes,toolbar=no,userbar=no,location=no,status=no,menubar=no');
if (window.focus) {stoj2.focus()}
}

var stoj2 = '';

function zoom(nazwa,w,h) {
	var url='popup.php?img='+nazwa+'';
	
	if (!stoj2.closed && stoj2.location) {
		stoj2.close();
	}
	stoj2=window.open(url,'ramy','height='+h+',width='+w+',left=300,top=50,scrollbars=no,resizable=yes,toolbar=no,userbar=no,location=no,status=no,menubar=no');
if (window.focus) {stoj2.focus()}
}