var okno = null;
function powieksz(width, height, url) {
	borderless=false;
	ScrWidth = 640; ScrHeight = 480;
	if (window.screen) {ScrWidth = window.screen.width; ScrHeight = window.screen.height}
	PosX = Math.round((ScrWidth - width)/2);
	PosY = Math.round((ScrHeight - height)/2);
	if (okno != null && !document.layers) {okno.close();}
	if (borderless && !document.layers) {
		okno = window.open("", "splash", "fullscreen=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0");
		okno.resizeTo(w, s);
		okno.moveTo(PosX, PosY);
	}
	else
		okno = window.open("", "splash", "menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width=" + width + ",height=" + height + ",left=" + PosX + ",top=" + PosY);

	okno.document.open();
	okno.document.clear();
	okno.document.write("<HTML><HEAD><title>cmsBullDesign - powiększenie obrazka</title></HEAD><body leftmargin=0 topmargin=0 rightmargin=0 bottommargin=0 marginwidth=0 marginheight=0><a href='javascript:window.close()'><img src="+url+" alt='Kliknij gdziekolwiek aby zamkn±ć to okno.' border='0'></a></BODY></HTML>");
	okno.document.close();
	okno.focus();	
}

function move(fbox, tbox) {
	var arrFbox = new Array();
	var arrTbox = new Array();
	var arrLookup = new Array();
	var i;
	for(i=0; i<tbox.options.length; i++) {
		arrLookup[tbox.options[i].text] = tbox.options[i].value;
		arrTbox[i] = tbox.options[i].text;
	}
	var fLength = 0;
	var tLength = arrTbox.length
	for(i=0; i<fbox.options.length; i++) {
		arrLookup[fbox.options[i].text] = fbox.options[i].value;
		if(fbox.options[i].selected && fbox.options[i].value != "") {
			arrTbox[tLength] = fbox.options[i].text;
			tLength++;
		} else {
			arrFbox[fLength] = fbox.options[i].text;
			fLength++;
		}
	}
	arrFbox.sort();
	arrTbox.sort();
	fbox.length = 0;
	tbox.length = 0;
	var c;
	for(c=0; c<arrFbox.length; c++) {
		var no = new Option();
		no.value = arrLookup[arrFbox[c]];
		no.text = arrFbox[c];
		fbox[c] = no;
	}
	for(c=0; c<arrTbox.length; c++) {
		var no = new Option();
		no.value = arrLookup[arrTbox[c]];
		no.text = arrTbox[c];
		tbox[c] = no;
	}
}
function selectAll(box) {
	for(var i=0; i<box.length; i++) {
		box.options[i].selected = true;
	}
}

function apotwierdzenie(adres, wiadomosc)
{
    if(!adres.potwierdzenie.checked)
	{
	    //alert(document.form_kasuj.potwierdzenie);
		alert("Aby usun±ć rekord najpierw zaznacz checkbox!");
		return false;
	}
    var czy_potwierdzony = confirm(wiadomosc);
    if (czy_potwierdzony) {
        adres.href += '&czy_potwierdzony=1';
    }
    return czy_potwierdzony;
}

function sprawdz(formularz, wiadomosc)
{
	if(!formularz.potwierdzenie.checked)
	{
		alert("Aby usun±ć rekord najpierw zaznacz checkbox!");
		return false;
	}
	var czy_potwierdzony = confirm(wiadomosc);
    if(czy_potwierdzony)
	{
        return true;
    }
	else
	{
		return false;
	}
}

function drukuj(id)
{
  borderless = false;
  width = 656;
  height = 600;
  ScrWidth = 640;
  ScrHeight = 480;
  if(window.screen)
  {
    ScrWidth = window.screen.width; 
	ScrHeight = window.screen.height;
  }
  PosX = Math.round((ScrWidth - width) / 2);
  PosY = Math.round((ScrHeight - height) / 2);
  if(okno != null && !document.layers)
  {
    okno.close();
  }
  if(borderless && !document.layers)
  {
	okno = window.open("zamowienia_drukuj.php?id="+ id +"", "splash", "fullscreen=1, toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0");
	okno.resizeTo(w, s);
	okno.moveTo(PosX, PosY);
  }
  else
  {
	okno = window.open("zamowienia_drukuj.php?id="+ id +"", "splash", "menubar=no, toolbar=no, location=no, directories=no, status=no, scrollbars=yes, resizable=no, copyhistory=no, width=" + width + ", height=" + height + ", left=" + PosX + ", top=" + PosY);
  }
  okno.focus()
}

function OtworzEdytor(pole)
{
	var oknoEdytor = null;
	szerokosc = 800;
	wysokosc = 600;
	if(window.screen)
  	{
   	szerokosc = window.screen.width*0.8;
		wysokosc = window.screen.height*0.8;
  	}
  	oknoEdytor = window.open("edytor.php?pole="+pole, "edytor", "menubar=no,toolbar=no,location=no,directories=no,status=yes,scrollbars=no,resizable=no,copyhistory=no,width="+ szerokosc +",height="+ wysokosc +",left=0,top=0");
	oknoEdytor.focus(); 
}