//otwórz stronę
function loaddoc(link) {
var link;
window.location.href=link;
}

//otwarcie zdjęcia w nowym oknie
function new_img(link, width, height) {
var link;
var width;
var height;
window.open('window.php?bimage='+link+'', 'foto' ,'left=20,top=20, width='+width+' , height='+height+', menubar=0, resizable=1, scrollbars=1');
}

//otwarcie zdjęcia w nowym oknie
function new_obr(link, width, height) {
var link;
var width;
var height;
window.open('window.php'+link+'', 'noweokno' ,'left=20,top=20, width='+width+' , height='+height+', menubar=0, resizable=1, scrollbars=1');
}

//w zależnosci od wybranego regionu pokazuje odpowiedni select z miejscowosciami
function zmienMiasta()
{
	for (i=0; i<regiony.length; i++)
	{
	r = regiony[i];	
	p = document.getElementById(r)
		if (document.formularz.region.value == r)
		p.style.display="inline";

		else
		p.style.display="none";
	}

}

// cross browser functions
function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}

function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}

function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}

//komunikat o ładowaniu plików
function doit()
{
	var f=0;
	//polozenie scrolla pionowego + 100 px
	var h = f_scrollTop()+200;
	
	for (i=1; i<=6; i++)
	{
		if (document.formularz.elements['photo'+i].value!="") f = 1;
	}	

	//jeżeli sa dolaczone pliki
	if (f!="")
	{
		e = document.getElementById("doing");
		e.style.display="block";
		e.style.top=h; //przesun okienko w dol zeby zawsze bylo na srodku w pionie (scroll)
	}
}
