function otworzOkno(url,szerokosc,wysokosc) {
  var okno = window.open(url,"okno2",'width=' + szerokosc + ',height='+ wysokosc +',left=20,top=20,resizable=1,scrollbars=1,menubar=no'); 
  okno.focus();
}
function displayWindowIMG(url) {
        var Win = window.open(url,"okno",'width=300,height=300,left=100,top=20,resizable=1,scrollbars=0,menubar=no');
        Win.focus();
  }
function Trim (tekst) {
   var p=0;
   while ((p < tekst.length) && (tekst.charAt(p)==' '))   { p++; }
   if (p==tekst.length)   return "";
   var k = tekst.length -1;
   while ((k>=0) && (tekst.charAt(k)==' '))   {k--; }
   return tekst.substring (p, k+1);
}

function dlugosc(pole,len) { return (pole.length>=len); }

function test_email(pole)
 {
  pole.value=Trim(pole.value);
  if ((pole.value.indexOf('@',0)==-1) || (pole.value.indexOf('.',0)==-1))
   {
	  pole.select();pole.focus();return true;
   }
  else
   return false;
 }

function test_mail(poczta)
 { 
 var text="";
 if(test_email(poczta.email))
  {
   text = text+"Podaj prawidłowy email!!\n"
   poczta.email.select();
   poczta.email.focus();
   alert(text);
   return false;
  }
 else
  {
   return true;
  }
}

function sprawdzForm(form)
 {
 	var text="";
 	
 	if(form.termin.options[form.termin.selectedIndex].value == 0)
   {
    text = text+"Wybierz termin, który cię interesuje!!\n"
   }
  if(form.imie_naz.value=="")
   {
    text = text+"Podaj imię i nazwisko!!\n"
   }
  if(test_email(form.email))
   {
    text = text+"Podaj prawidłowy email!!\n"
   }
	if(form.tel.value=="")
   {
    text = text+"Podaj telefon kontaktowy!!\n"
   }
	if(text != "")
	 {
	 	alert(text);
	 	return false;
	 }
	else
		return true;
 }
