function fotka(adres,tytul)
{
foto1= new Image();
foto1.src=(adres);
wid=foto1.width+20;
hei=foto1.height+20;

if((foto1.width!=0)&&(foto1.height!=0)){
wid=foto1.width+20;
hei=foto1.height+20;
}else{
wid=1000;
hei=500;
}

var wid2 = wid +80;
var hei2 = hei +80;
tx=(screen.availWidth-wid2)/2;
ty=(screen.availHeight-hei2)/2;
var Win = window.open(adres,"",'width=' + wid2 + ',height=' + hei2 + ',resizable=1,top='+ty+',left='+tx+',scrollbars=yes,menubar=no,resizable=yes');
Win.focus();
Win.document.write('<html><head><meta http-equiv="content-type" content="text/html; charset=iso-8859-2"><title>',tytul,'</title></head><body>');
Win.document.write('<center>');
Win.document.write('<A href="#" onclick="javascript: window.close();return false;"><img src="',adres,'" vspace=5 border=0 alt="',tytul,'"></A><br clear="all"><font face="Arial CE, Arial" size="2" color="#000000"><b>',tytul,'</b><br><br><br><br><br></center></body></html>');
Win.document.close();
}


function flip(rid)
{
current=(document.getElementById(rid).style.display == 'none') ? 'block' : 'none';
document.getElementById(rid).style.display = current;
}

function chkpasswd()
{
	if( document.dane.pass.value == document.dane.repass.value )
	{
		document.dane.pass.style.color = 'green';
		document.dane.repass.style.color = 'green';
	}
	else
	{
		document.dane.pass.style.color = 'red';
		document.dane.repass.style.color = 'red';
	}
}

function showbuttons()
{
	document.dane.bsave.style.display = 'inline';
	document.dane.breset.style.display = 'inline';
}

function hidebuttons()
{
	document.dane.bsave.style.display = 'none';
	document.dane.breset.style.display = 'none';
}

function formik_a()
{
if (document.dane.user.value=='') {
alert('Proszę uzupełnić pole: Użytkownik');
return false;
}
if (document.dane.pass.value=='') {
alert('Proszę uzupełnić pole: Hasło');
return false;
}
if (document.dane.repass.value=='') {
alert('Proszę uzupełnić pole: Powtórz hasło');
return false;
}
if (document.dane.pass.value!=document.dane.repass.value) {
alert('Hasła, które podałeś nie są jednakowe w obywu polach')
return false;
}
if (document.dane.new.value=='-- WYBIERZ --') {
alert('Proszę uzupełnić pole: Newsletter');
return false;
}
if (document.dane.faktura.value=='-- WYBIERZ --') {
alert('Proszę wybrać rodzaj konta: prywatne lub firmowe');
return false;
}
if (document.dane.imie.value=='') {
alert('Proszę uzupełnić pole: Imię i nazwisko');
return (false);
}
if (document.dane.faktura.value=='1')
{
if (document.dane.nazwa.value=='') {
alert('Proszę uzupełnić pole: Nazwa firmy');
return (false);
}
if (document.dane.nip.value=='') {
alert('Proszę uzupełnić pole: NIP');
return (false);
}
}
if (document.dane.email.value=='') {
alert('Proszę uzupełnić pole: E-mail');
return (false);
}
if (document.dane.telefon.value=='') {
alert('Proszę uzupełnić pole: Telefon');
return (false);
}
if (document.dane.ulica.value=='') {
alert('Proszę uzupełnić pole: Ulica');
return false;
}
if (document.dane.nr_dom.value=='') {
alert('Proszę uzupełnić pole: Numer budynku');
return (false);
}
if (document.dane.kod_mia.value=='') {
alert('Proszę uzupełnić pole: Kod pocztowy');
return (false);
}
if (document.dane.miasto.value=='') {
alert('Proszę uzupełnić pole: Miasto');
return (false);
}
if (document.dane.woj.value=='-- WYBIERZ --') {
alert('Proszę uzupełnić pole: Województwo');
return (false);
}
if(document.dane.zgoda1.checked==false){
alert("Do przeprowadzenia tej operacji wymagana jest zgoda na przetwarzanie danych osobowych.");
return false;
}
if(document.dane.zgoda2.checked==false){
alert("Prosimy zapoznać się z regulaminem naszych usług.");
return false;
}
return true;
}

function formik_b()
{
if (document.pass.haslo_user.value=='') {
alert('Proszę uzupełnić pole: Login Webzi.pl');
return false;
}
if (document.pass.haslo_email.value=='') {
alert('Proszę uzupełnić pole: E-mail');
return false;
}
return true;
}

function formik_c()
{
if (document.logo.logowanie_user.value=='') {
alert('Proszę uzupełnić pole: Login');
return false;
}
if (document.logo.logowanie_pass.value=='') {
alert('Proszę uzupełnić pole: Hasło');
return false;
}
return true;
}


function formik_d()
{
if (document.dane.pass.value!='' || document.dane.repass.value!='') {
if (document.dane.pass.value=='') {
alert('Proszę uzupełnić pole: Hasło');
return false;
}
if (document.dane.repass.value=='') {
alert('Proszę uzupełnić pole: Powtórz hasło');
return false;
}
}
if (document.dane.pass.value!=document.dane.repass.value) {
alert('Hasła, które podałeś nie są jednakowe w obywu polach')
return false;
}
if (document.dane.new.value=='-- WYBIERZ --') {
alert('Proszę uzupełnić pole: Newsletter');
return false;
}
if (document.dane.faktura.value=='-- WYBIERZ --') {
alert('Proszę wybrać rodzaj konta: prywatne lub firmowe');
return false;
}
if (document.dane.imie.value=='') {
alert('Proszę uzupełnić pole: Imię i nazwisko');
return (false);
}
if (document.dane.faktura.value=='1')
{
if (document.dane.nazwa.value=='') {
alert('Proszę uzupełnić pole: Nazwa firmy');
return (false);
}
if (document.dane.nip.value=='') {
alert('Proszę uzupełnić pole: NIP');
return (false);
}
}
if (document.dane.email.value=='') {
alert('Proszę uzupełnić pole: E-mail');
return (false);
}
if (document.dane.telefon.value=='') {
alert('Proszę uzupełnić pole: Telefon');
return (false);
}
if (document.dane.ulica.value=='') {
alert('Proszę uzupełnić pole: Ulica');
return false;
}
if (document.dane.nr_dom.value=='') {
alert('Proszę uzupełnić pole: Numer budynku');
return (false);
}
if (document.dane.kod_mia.value=='') {
alert('Proszę uzupełnić pole: Kod pocztowy');
return (false);
}
if (document.dane.miasto.value=='') {
alert('Proszę uzupełnić pole: Miasto');
return (false);
}
if (document.dane.woj.value=='-- WYBIERZ --') {
alert('Proszę uzupełnić pole: Województwo');
return (false);
}
return true;
}

function encode64(inp){
var key="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var chr1,chr2,chr3,enc3,enc4,i=0,out="";
while(i<inp.length){
chr1=inp.charCodeAt(i++);if(chr1>127) chr1=88;
chr2=inp.charCodeAt(i++);if(chr2>127) chr2=88;
chr3=inp.charCodeAt(i++);if(chr3>127) chr3=88;
if(isNaN(chr3)) {enc4=64;chr3=0;} else enc4=chr3&63
if(isNaN(chr2)) {enc3=64;chr2=0;} else enc3=((chr2<<2)|(chr3>>6))&63 
out+=key.charAt((chr1>>2)&63)+key.charAt(((chr1<<4)|(chr2>>4))&63)+key.charAt(enc3)+key.charAt(enc4);
}
return encodeURIComponent(out);
}

function stats(sid){
var referer=encode64(document.referrer);
var thispage=encode64(window.location.pathname+location.search);
var date=new Date()
var time=date.getTime();
document.writeln("<img src=\"http://stats.webzi.pl/count.php?sid="+sid+"&p="+thispage+"&r="+referer+"&t="+time+"\" alt=\"\" border=\"0\" width=\"0\" height=\"0\" />\n");
}
