
//skrypty by mat2@mwd.pl

//ładuje odpowiednią stronę do ramki ze zdjęciami, wersja polska
function laduj(kogo) {

	if(kogo == null && top.pict.location.href != 'pict_pl.html') {

	top.pict.location.href = 'pict_pl.html';
	return false;
	
	} else {

	top.pict.location.href = 'pict_pl' + kogo + '.html';
    return false;

	}
	
}

//otwiera okno z konkretnym zdjęciem, wypisuje komentarz do zdjęcia
function  okno(plik,rozmiarX,rozmiarY,opis){

        oknoW=screen.availWidth;
        oknoH=screen.availHeight;
		
		if (opis) {
		okienko = window.open(plik+"?"+opis, "popup", "width=" + rozmiarX + ",height=" + rozmiarY + "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1");
		} else {
		okienko = window.open(plik, "popup", "width=" + rozmiarX + ",height=" + rozmiarY + "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1");
		}
		okienko.moveTo(oknoW/2 - rozmiarX/2 ,oknoH/2 - rozmiarY/2);
		okienko.resizeTo(rozmiarX,rozmiarY);
		okienko.focus();		
		//okienko.document.close();
	}

function nic() {;}		

//to samo co na górze, tylko dla angielskiej wersji
function ladujEng(kogo) {

	if(kogo == null && top.pict.location.href != 'pict_eng.html') {

	top.pict.location.href = 'pict_eng.html';
	return false;
	
	} else {

	top.pict.location.href = 'pict_eng' + kogo + '.html';
    return false;

	}
	
}

function replace(string,text,by) {

    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}
 
