//drukowanie przelwu
function drukuj_przelew(op) {
window.open(op,'druk_przelewu','width=700, height=500 ,left=100,top=100,resizable=0,scrollbars=yes,menubar=yes,toolbar=yes');
}
//otwieranie okna
function otworz_okno(url, nazwa, atr) {
	window.open(url, nazwa, atr+',top=(screen.height-height)/2,left=(screen.width-width)/2)');
}
// Komunikaty potwierdzenia
function potwierdz(komunikat, url) {
	if (confirm(komunikat)) {
		window.location.href=url;
	}
}
//przekierowania
function przekieruj(url) {
	window.location.href=url;
}
//zamykanie komunikatow
function zamknij_kom(id) {
		var kom = document.getElementById(id);
		kom.style.display='none';
}
//pokaz/ukryj
function pokaz_ukryj(id) {
		var blok = document.getElementById(id);
		if (blok.style.display == 'none') {
			blok.style.display='block';
		} else if (blok.style.display == 'block') {
			blok.style.display='none';
		}
}
//operacje na zaznaczonych biur
function zaznaczone_biura() {
	if (document.operacje.operacje_zaznaczone.value == 'drukuj_biura') {
		window.open('include/wydruk-biura.php', 'biura', 'width=800 height=800');
	}
}
function potwierdz_usuniecie() {
	if (document.operacje.operacje_zaznaczone.value == 'usun_zaz') {
		document.getElementById('usun_wiele').style.display='block';
	} else {
		document.getElementById('usun_wiele').style.display='none';
	}
}
//ikony powiatow
function ikona_zm(id, cel, id_cel) {
	var blok = document.getElementById(id);
	blok.style.display='block';
	
	document.getElementById("cel1").value = cel;
	document.getElementById("id_zm_ikona1").value = id_cel;
}
// kalendarzyk
//Written by Bogdan Blaszczak/BlaTek
//blatek@25.pl
function Calendar(E,T,id){
 if(!document.getElementById||!document.body.appendChild)return
 var i,j,tBody,Row,od,Do,d,dt
 function cEl(t,p,h,w){
  p.appendChild(t=document.createElement(t))
  if(h)t.innerHTML=h;if(w)t.style.width='27px'
  return t}
 function cB(x){with(cld_BlaTek){
  B=0;x==0?R--:x==1?R++:x==2?(!M?(M=11,R--):M--):(M==11?(M=0,R++):M++)}
 }
 with(cld_BlaTek){
  od=Date.UTC(R,M,1);Do=Date.UTC(R,M+1,1)}
 E=document.getElementById(E)
 while(E.childNodes.length)E.removeChild(E.firstChild)
 tBody=cEl('tbody',cEl('table',E))
 tBody.onmouseup=function(){T.focus()}
 tBody.onmousemove=function(){
  if(window.getSelection)window.getSelection().removeAllRanges()}
 Row=cEl('tr',tBody)
 cEl('td',Row,'&#171;',1).onmousedown=function(){cB(0)}
 cEl('th',Row,cld_BlaTek.R)
 cEl('td',Row,'&#187;',1).onmousedown=function(){cB(1)}
 Row=cEl('tr',tBody)
 cEl('td',Row,'&#171;',1).onmousedown=function(){cB(2)}
 cEl('th',Row,cld_BlaTek.month[cld_BlaTek.M])
 cEl('td',Row,'&#187;',1).onmousedown=function(){cB(3)}

 tBody=cEl('tbody',cEl('table',E))
 Row=cEl('tr',tBody)
 for(i=0;i<7;i++)
  with(cEl('th',Row,cld_BlaTek.day[i]))
   if(i==6)style.backgroundColor='#f88'

 for(i=od;i<Do;i+=86400000){
  with(new Date(i)){d=getUTCDate();dt=getUTCDay()}
  if(dt==1||i==od)Row=cEl('tr',tBody)
  if(dt!=1&&d==1)for(j=1;j<(dt?dt:7);j++)cEl('th',Row)
  dt=cEl('td',Row,d);dt.onmousedown=function(x){
   x=+this.innerHTML
   with(cld_BlaTek)

    T.value=R+'-'+((z=M+1)<10?'0'+z:z)+'-'+(x<10?'0'+x:x)
  }
  with(cld_BlaTek)
  if(R==D.getFullYear()&&M==D.getMonth()&&d==D.getDate())
   dt.style.backgroundColor='#fff'
 }
 var pole = document.getElementById(id);
 T.onblur=function(){if(cld_BlaTek.B)E.style.display='none'
 if(pole) {
 pamietaj(id);
 }
 }
 cld_BlaTek.B=1;E.style.display='block'
}
//global object (You can translate month&day names)
cld_BlaTek={
 day:['pn','wt','sr','cz','pt','so','n'],
 month:['styczen','luty','marzec','kwiecien','maj','czerwiec',
 'lipiec','sierpien','wrzesien','pazdziernik','listopad','grudzien'],
 D:new Date(),M:new Date().getMonth(),R:new Date().getFullYear()
}
//pokaz div, pola zaznaczenia
function pokaz_div(zaz, pokaz) {
	if (document.getElementById(zaz).checked == true) {
		document.getElementById(pokaz).style.display='block';
	} else if (document.getElementById(zaz).checked == false) {
		document.getElementById(pokaz).style.display='none';
	}
}

