//otwórz stronę
function loaddoc(link) {
var link;
window.location.href=link;
}

//otwarcie zdjęcia lub strony w nowym oknie
var newWindow = null
function new_img(link, width, height) 
{
	var link;
	var width;
	var height;
	if (!newWindow || newWindow.closed)
	{
		window.open('window.php?bimage='+link+'', 'foto' ,'left=20,top=20, width='+width+' , height='+height+', menubar=0, resizable=1, scrollbars=1');
	}
	else //jeżeli otwarte to pokaż
	{
		newWindow.focus();
		newWindow.location.href=link;
	}
}

function new_win(link, width, height) 
{
	var link;
	var width;
	var height;
	if (!newWindow || newWindow.closed)
	{
		pos1 = link.indexOf("page=galeria");
		pos2 = link.indexOf("page=realizacje");

		if (pos1>0 || pos2>0) //zdjecia - bez menubar i tolbar
		newWindow = window.open(''+link+'', 'window' ,'left=0, top=0, width='+width+' , height='+height+', menubar=no, resizable=yes, toolbar=no, status=no, scrollbars=yes');
		else
		newWindow = window.open(''+link+'', 'window' ,'left=20, top=0, width='+width+' , height='+height+', menubar=yes, resizable=yes, toolbar=yes, scrollbars=yes');
	}
	else
	{
		newWindow.focus();
		newWindow.location.href=link;
	}
}

//sprawdzenie czy login istnieje
function check_login()
{
	var p_log = document.getElementById('log').value;
	new_win('window.php?page=check_login&login='+p_log,'550','120');
}

//zwraca kliknięta wartosc w oknie do pola formularza w oknie parent
function open_back(name,link)
{
	opener.document.formularz.elements[name].value = link;
	window.close();
}

//w zależnosci od wybranej wartosci pola select 1 pokaz odpowiedni select 2
function subsel(sel1)
{
	if (subtab)
	{
		main_op = document.getElementById(sel1).value; //glowny select
		for (i=0; i<subtab.length; i++) //w petli sprawdz wszystkie divy z selectami - pokaz jeden wlasciwy
		{
			sub = "sub"+subtab[i];
			p = document.getElementById(sub);

			if (main_op == subtab[i])
			p.style.display="inline";
			else
			p.style.display="none";
		}
	}
}

//schowaj banner na stronie głównej
function zamknij()
{
	var p = document.getElementById('fl');
	p.style.display="none"
}

