function init()
{
    if (document._GET['p']) p=document._GET['p']*16; else p=0;
    d1 = document.getElementById("dim"+p);
    if (d1.style) d1.style.display="none";
    document.offElem = d1;
}

function showbigfoto(caller){
    f = document.getElementById('ramka_fotografii');
	f.style.background = 'url('+caller.href+') 50% 50% no-repeat';
    ch = caller.firstChild;
    while (ch.className!='th_fade') {
        if (!(ch=ch.nextSibling)) break;
    }
    if ((document.offElem)&&(document.offElem.className='th_fade')) document.offElem.style.display = 'inline';
    if (ch.className=='th_fade') ch.style.display='none';
    document.offElem = ch;
}

function cstmGetElementsByClassName(class_name) {
    var docList = this.all || this.getElementsByTagName('*');
    var matchArray = new Array();

	/*Create a regular expression object for class*/
    var re1 = new RegExp("(?:^|\\s)"+class_name+"(?:\\s|$)");
    for (var i = 0; i < docList.length; i++) {
        if (re1.test(docList[i].className))  {
            matchArray[matchArray.length] = docList[i];
        }
	}

    return matchArray;
}//eof cstmGetElementsByClassName

function showNextFoto() {
    ul = document.getElementById("stykowki");
    l = ul.getElementsByTagName("li");
    for (i=0; i<l.length; i++) {
        if (l[i]) {
            if (!l[i].getElementsByClassName) l[i].getElementsByClassName=cstmGetElementsByClassName;
            if (l[i].getElementsByClassName("th_fade")[0].style.display=="none") {
                if (l[i+1])
                {
                    l[i].getElementsByClassName("th_fade")[0].style.display=="inline";
                    if (!l[i+1].getElementsByClassName) l[i+1].getElementsByClassName=cstmGetElementsByClassName;
                    l[i+1].getElementsByClassName("th_fade")[0].style.display=="none";
                    showbigfoto(l[i+1].getElementsByClassName("th_fade")[0].parentNode);
                    break;
                }
                else {
                    n = document.getElementById("next_th_page");
                    if (n.href) document.location = n.href;
                }
            }
        }
    }
}

