﻿/* POPUPS */
function otworzOkno (tytul, src, szer, wys, opis) {
		szer_ok = szer+10; 
		wys_ok = wys+10; 
		tlo = 'FFFFFF';	
		topmargin = 5;
		
		//if (wys_ok > screen.availWidth) wys_ok = screen.availWidth;
		//if (szer_ok > screen.availHeight) szer_ok = screen.availHeight;

		lok_hor=((screen.availWidth/2)-(szer_ok/2));
		lok_ver=((screen.availHeight/2)-(wys_ok/2));
		

		var okienko = window.open("", "", "toolbar=no, scrollbars=no, menubar=no, top=" + lok_ver + ", left=" + lok_hor + ", width=" + szer_ok + ", height=" + wys_ok);
		okienko.document.write("<html>\n<head>\n<title>" + tytul + "</title>\n</head>\n<style>td {text-align: center; font-family: Arial; font-size: 11px; font-weight: bold}</style>\n<body bgcolor=" + tlo + " marginwidth=0 marginheight=0 topmargin=" + topmargin + " leftmargin=0><center><table cellspacing=\"0\" cellpadding=\"0\" style=\"border: none\" border=0 width=" + szer + " height=" + wys + "><tr><td height=100% align=\"center\" valign=\"middle\"><a href=\"#\" onClick=\"window.close();\"><img src=\"" + src + "\" border=\"0\"></a></td></tr><tr><td>" + opis + "</td></tr></table></body></html>");
		//okienko.document.write("<img src=\"" + src + "\" border=\"0\">");
}

function otworzOknoSimple (url, width, height) {
		lok_hor=((screen.availWidth/2)-(width/2));
		lok_ver=((screen.availHeight/2)-(height/2));
        var Win = window.open(url,"OknoSimple",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=1,menubar=no,top='+lok_ver+',left='+lok_hor+',location=no');
		}

function otworzOknoSimple2 (url, width, height) {
		lok_hor=((screen.availWidth/2)-(width/2));
		lok_ver=((screen.availHeight/2)-(height/2));
        var Win = window.open(url,"OknoSimple2",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=1,menubar=no,top='+lok_ver+',left='+lok_hor+',location=no');
		}

		
function otworzOknoObraz (tytul, url, width, height) {
		if (navigator.appName == 'Microsoft Internet Explorer') {
			width = width+40; 
			height = height+35
		}
		else {
			width = width+20;
			height = height+25
		}
		lok_hor=((screen.availWidth/2)-(width/2));
		lok_ver=((screen.availHeight/2)-(height/2));
        var Win = window.open(url,tytul,'width=' + width + ',height=' + height + ',resizable=0,scrollbars=1,menubar=no,top='+lok_ver+',left='+lok_hor+',location=no');
		Win.document.write = ('onClick="window.close();"');
		}

function otworzOknoObraz2 (tytul, src, szer, wys) {
		szer_ok = szer+10; 
		wys_ok = wys+10; 
		tlo = '#FFFFFF';	
		topmargin = 5;

		lok_hor=((screen.availWidth/2)-(szer_ok/2));
		lok_ver=((screen.availHeight/2)-(wys_ok/2));

		var okienko = window.open('syp', 'okieno', 'toolbar=no,scrollbars=no,menubar=no,top=' + lok_ver + ',left=' + lok_hor + ',width=' + szer_ok + ',height=' + wys_ok);
		okienko.document.write('<html>\n<head>\n<title>' + tytul + '</title>\n<meta name="Pragma" content="no-cache" />\n</head>\n<style>td {text-align: center; font-family: Arial; font-size: 11px; font-weight: bold}</style>\n<body bgcolor="' + tlo + '" marginwidth="0" marginheight="0" topmargin="' + topmargin + '" leftmargin="0"><center><table cellspacing="0" cellpadding="0" style="border: none" border="0" width="' + szer + '" height="' + wys + '"><tr><td height="100%" align="center" valign="middle"><a href="#" onClick="window.close();"><img src="' + src + '" border="0"></a></td></tr></table></body></html>');
}

function otworzOknoGaleria (tytul, src, tablicaDanych) {
		szer_ok = 800+10; 
		wys_ok = 700+10; 
		tlo = '#ffffff';	
		topmargin = 5;
		
		tabliczka = toString(tablicaDanych);

		
		lok_hor=((screen.availWidth/2)-(szer_ok/2));
		lok_ver=((screen.availHeight/2)-(wys_ok/2));
		
		var x = window.open('v', 'a', 'toolbar=no,resizable=1,scrollbars=no,menubar=no,top=' + lok_ver + ',left=' + lok_hor + ',width=' + szer_ok + ',height=' + wys_ok);
		x.document.write('<html>\n<head>\n<title>' + tytul + '</title>\n<meta name="Pragma" content="no-cache" />\n</head>\n');
		x.document.write('<style>td {text-align: center; font-family: Arial; font-size: 11px; font-weight: bold}</style>\n');
		x.document.write('<body bgcolor="' + tlo + '" marginwidth="0" marginheight="0" topmargin="' + topmargin + '" leftmargin="0">\n');
		x.document.write('<table cellspacing="0" cellpadding="0" border="1" width="100%" height="100%" align="center"><tr><td colspan="3"><b>aaaa</b></td></tr><tr><td  colspan="3" height="100%" align="center" valign="middle"><a href="#" onClick="window.close();"><img src="' + src + '" border="0"></a></td></tr><tr><td width="75px"><<</td><td><b>' + tabliczka + '</b></td><td width="75px" align="right">>></td></tr></table>\n');
		x.document.write('</body></html>');
}

/* POPUPS */

function sprawdzCzyEmail(string) {
	wzor=/^[a-zA-Z0-9ąęóńżźćśłĄĘÓŃŻŹĆŚŁ\.\-]{1,30}@[a-zA-Z0-9ąęóńżźćśłĄĘÓŃŻŹĆŚŁ\-]+(\.[a-zA-Z0-9ąęóńżźćśłĄĘÓŃŻŹĆŚŁ\-]+)+$/;
	if (string.match(wzor)) return true;
	else return false;
}

function sprawdzCzyTelefon(string) {
	wzor=/^[\d\+\s\-]{9,30}$/;
	if (string.match(wzor)) return true;
	else return false;
}

function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}

function UkryjElement(nazwa) {
	var x = new getObj(nazwa);
	x.style.display = 'none';
}

function obsadzFlasha(nazwa_pliku, szer, wys) {
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8" id="flash" width="'+szer+'" height="'+wys+'">');
  	document.write('<param name="movie" value="'+nazwa_pliku+'">');
	document.write('<param name="bgcolor" value="#FFFFFF">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="allowscriptaccess" value="samedomain">');
  	document.write('<embed type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="'+szer+'" height="'+wys+'" name="flash" src="'+nazwa_pliku+'" bgcolor="#FFFFFF" quality="high" swLiveConnect="true" allowScriptAccess="samedomain"></embed>');
	document.write('</object>');
}

// pela okno
function openWin(url, w, h) 
{ 
var winprop = "width=" + w + ",height=" + h; 
openwin = window.open(url,'',winprop,"scrollbars=yes"); 
} 

function wstawAktualnaDate() {
Dzisiaj = new Date();
dzien = Dzisiaj.getDate();
if (dzien < 10) dzien = "0" + dzien;
miesiac = (Dzisiaj.getMonth()+1);
if (miesiac < 10) miesiac = "0" + miesiac;
if (Dzisiaj.getYear()<1900) rok = (Dzisiaj.getYear()+1900);
else rok = Dzisiaj.getYear();

DzisiejszaData = dzien  + "/" + miesiac + "/" + rok;
return DzisiejszaData;
}
