
// funkcja dopasowuje zdjecie do podanych rozmiarow
function resizeImage ( img, width, height )
{
	var cur_width = img.width;
	var cur_height = img.height;
	var ratio = cur_width/cur_height;
	// jesli rozmiary zostaly przekroczone
	if ( cur_width > width && cur_height > height )
	{
		
		
		if ( cur_width > cur_height )
		// jesli obrazek jest szerszy niz wyzszy
		{
			img.width = width;
			img.height = width / ratio;
		}else{
			img.height = height;
			img.width = height * ratio;
		}
	
	}else if ( cur_width > width )
	{
		img.width = width;
		img.height = width/ratio;
	}else if ( cur_height > height )
	{
		img.height = height;
		img.width = height * ratio;
	}
	
	// ostateczna korekta
	if ( img.width > width )
	{
		img.width = width;
		img.height = width / ratio;
	}else if ( img.height > height )
	{
		img.height = height;
		img.width = height * ratio;
	}
	
	// jesli ustawilismy juz wlasciwe rozmiary
	// to mozemy pokazac zdjecie
	img.style.visibility="visible";

}


// otwiera okno z detalami dotyczacymi zdjecia
function openInfoWindow( idzdjecia, startpanel )
{
	theURL="pressinfo/zdjecie_info.php?idzdjecia="+idzdjecia+"&mode="+startpanel;
	
	okno = window.open (theURL,'info','width=276,height=450,scrollbars=yes,resizable=yes');
	okno.focus ();

}
