
function sprawdz_email(email)
{
 if (!/^[a-zA-Z0-9\-_\.]+?@[a-zA-Z0-9\-_\.]+?\.[a-zA-Z]{2,5}$/.test(email)) return false;
 else return true;

}




function peper(url, width, height, scba) 

{ 
 var czas  = new Date();
 rok   = czas.getYear();
 mies  = ( ( czas.getMonth() < 10 ) ? "0": "" ) + ( czas.getMonth() + 1 );
 dzien = ( ( czas.getDate()  < 10 ) ? "0": "" ) + ( czas.getDate() );
 godz  = ( ( czas.getHours() < 10 ) ? "0": "" ) + ( czas.getHours() );
 min   = ( ( czas.getMinutes() < 10 ) ? "0": "" ) + ( czas.getMinutes() );
 sek   = ( ( czas.getSeconds() < 10 ) ? "0": "" ) + ( czas.getSeconds() );
 
 maxszer=window.screen.width;
 maxwys=window.screen.height;
 polx=Math.round( (maxszer-width)/2);
 poly=Math.round( (maxwys-height)/2)-20;

 if (scba=='') scba='yes';
 
 aktdata=dzien+"_"+mies+"_"+rok+"_"+godz+"_"+min+"_"+sek;

 window.open(url,aktdata,"toolbar=no,scrollbars="+scba+",directories=no,top=0,left=0,menubar=no,top="+poly+",left="+polx+",width="+ width +",height="+ height +",resizable=no")
}



function dnth()
{
}




function newsletter_akcja(form, zm)
{
 var t;
 t='';

 if (!sprawdz_email(form.email.value) || form.email.value=='twoj@email.pl') t='Podaj poprawny adres e-mail.';

 if (t!='')
   {
    window.alert(t);
   }
 else
   {
    peper('newsletter.php?g='+zm+'&mail='+form.email.value, '230', '195', 'no');
   }
}




function nlp_sprawdz(form, zm)
{
 var t;
 t='';

 if (!sprawdz_email(form.email.value)) t="Podaj poprawny adres e-mail.\n";
 if (form.pd.checked==false) t=t+"Musisz wyrazić zgodę na użycie adresu e-mail.";

 if (t!='')
   {
    window.alert(t);
    return false;
   }
 else
   {
    form.g.value=zm;
    return true;
   }
}




function nlp_usun_sprawdz(form, zm)
{
 var t;
 t='';

 if (!sprawdz_email(form.email.value)) t="Podaj poprawny adres e-mail.\n";
 if (form.pd.checked==false) t=t+"Musisz wyrazić zgodę na wykreślenie adresu e-mail.";

 if (t!='')
   {
    window.alert(t);
    return false;
   }
 else
   {
    form.g.value=zm;
    return true;
   }
}



function pof_wyslij(form)
{
 var t;
 t='';

 if (!sprawdz_email(form.f_email_nadawcy.value)) t="Twój adres e-mail jest nieprawidłowy.\n\n";
 if (!sprawdz_email(form.f_email_adresata.value)) t=t+"E-mail adresata jest nieprawidłowy.\n\n";

 if (t!="") t="Proszę uzupełnić informacje\ni ponownie nacisnąć przycisk \"Wyślij\"\n\n"+t;


 if (t!='')
   {
    window.alert(t);
    return false;
   }
 else
   {
    return true;
   }
}
