function mapa_ksiegarni(){
       var Win = window.open('mapka_ksiegarni.php', 'displayWindow','width=500,height=410,resizable=0,scrollbars=0,menubar=0,left=10,top=10');
}

function search_check(id)
	{
		if(id==1)
			{
				if (document.wyszukiwarka.tekst.value=='Wpisz szukaną frazę...' || document.wyszukiwarka.tekst.value==''){
					alert ("Wpisz szukaną frazę...");
				}else{
					document.wyszukiwarka.submit()
				}
			}
		if(id==2)
			{
				if ((document.wyszukiwarka_adv.tekst.value=='Wpisz szukaną frazę...' || document.wyszukiwarka_adv.tekst.value=='') && (document.wyszukiwarka_adv.typ.value==0 && document.wyszukiwarka_adv.kategoria.value==0))
					 {
					alert ("Nie wypełniłeś żadnego pola....");
				}
				else{
					document.wyszukiwarka_adv.submit()
				}
			}
	}

function znajdz(p, s, t){
	window.status='';
	document.znalezione.tekst.value = p;
	document.znalezione.tabela.value = s;
	document.znalezione.pag.value = t;
	document.znalezione.submit();
}

function pokaz_okladke(id){
       var Win = window.open('okladka.php?pid=' + id,'displayWindow','width=400,height=400,resizable=0,scrollbars=0,menubar=0,left=10,top=10');
}

function pokaz_okladke2(id){
       var Win = window.open('okladka2.php?pid=' + id,'displayWindow','width=400,height=400,resizable=0,scrollbars=0,menubar=0,left=10,top=10');
}

function popupGaleria(obrazek, width, height) {
	window.open('galeria.php?id='+obrazek, 'Galeria','width=' + width + ',height=' + height +',resizable=0,scrollbars=no,menubar=no,left=10,top=20')
}

function popupGaleriaAktualnosci(obrazek, width, height) {
	window.open('galeria_aktualnosci.php?id='+obrazek, 'Galeria','width=' + width + ',height=' + height +',resizable=0,scrollbars=no,menubar=no,left=10,top=20')
}

function popupOnas(obrazek, width, height) {
	window.open('obrazek.php?id='+obrazek, 'Obrazek','width=' + width + ',height=' + height +',resizable=0,scrollbars=no,menubar=no,left=10,top=20')
}

//---------
function npokaz_t(cokonkretnie){
	if (document.all||document.getElementById){
	cross_el=document.getElementById? document.getElementById("descriptions3"):document.all.descriptions3
	cross_el.innerHTML=cokonkretnie
	}
	else if (document.layers){
	document.d7.document.d8.document.write(cokonkretnie)
	document.d7.document.d8.document.close()
	}
}

function nddpokaz_t(cokonkretnie){
	if (document.all||document.getElementById){
	cross_el=document.getElementById? document.getElementById("descriptions6"):document.all.descriptions3
	cross_el.innerHTML=cokonkretnie
	}
	else if (document.layers){
	document.d13.document.d14.document.write(cokonkretnie)
	document.d13.document.d14.document.close()
	}
}

function npokaz_s(cokonkretnie){
	if (document.all||document.getElementById){
	cross_el=document.getElementById? document.getElementById("descriptions4"):document.all.descriptions4
	cross_el.innerHTML=cokonkretnie
	}
	else if (document.layers){
	document.d9.document.d10.document.write(cokonkretnie)
	document.d9.document.d10.document.close()
	}
}

function nddpokaz_s(cokonkretnie){
	if (document.all||document.getElementById){
	cross_el=document.getElementById? document.getElementById("descriptions7"):document.all.descriptions4
	cross_el.innerHTML=cokonkretnie
	}
	else if (document.layers){
	document.d15.document.d16.document.write(cokonkretnie)
	document.d15.document.d16.document.close()
	}
}


function npokaz_o(cokonkretnie){
	if (document.all||document.getElementById){
	cross_el=document.getElementById? document.getElementById("descriptions5"):document.all.descriptions5
	cross_el.innerHTML=cokonkretnie
	}
	else if (document.layers){
	document.d11.document.d12.document.write(cokonkretnie)
	document.d11.document.d12.document.close()
	}
}

function nddpokaz_o(cokonkretnie){
	if (document.all||document.getElementById){
	cross_el=document.getElementById? document.getElementById("descriptions8"):document.all.descriptions5
	cross_el.innerHTML=cokonkretnie
	}
	else if (document.layers){
	document.d17.document.d18.document.write(cokonkretnie)
	document.d17.document.d18.document.close()
	}
}

function nwstecz(){
	if (nktory>0){
	//window.status=content.length;
	nktory--;
	npokaz_t(ntytul[nktory]);
	npokaz_s(nopis[nktory]);
	npokaz_o(nokladka[nktory]);
	}
	else
	{
	//window.status='ostatni';
	nktory=(ntytul.length-1);
	npokaz_t(ntytul[nktory]);
	npokaz_s(nopis[nktory]);
	npokaz_o(nokladka[nktory]);
	
	}
}

function nddwstecz(){
	if (nddktory>0){
	//window.status=content.length;
	nddktory--;
	nddpokaz_t(nddtytul[nddktory]);
	nddpokaz_s(nddopis[nddktory]);
	nddpokaz_o(nddokladka[nddktory]);
	}
	else
	{
	//window.status='ostatni';
	nddktory=(nddtytul.length-1);
	nddpokaz_t(nddtytul[nddktory]);
	nddpokaz_s(nddopis[nddktory]);
	nddpokaz_o(nddokladka[nddktory]);
	
	}
}


function ndalej(){
if (nktory<(ntytul.length-1)){
	//window.status=which;
	nktory++;
	npokaz_t(ntytul[nktory]);
	npokaz_s(nopis[nktory]);
	npokaz_o(nokladka[nktory]);
	
	}
	else if (nktory==(ntytul.length-1)){
	//window.status=which;
	nktory=0;
	npokaz_t(ntytul[nktory]);
	npokaz_s(nopis[nktory]);
	npokaz_o(nokladka[nktory]);
	
	}
}

function ndddalej(){
if (nddktory<(nddtytul.length-1)){
	//window.status=which;
	nddktory++;
	nddpokaz_t(nddtytul[nddktory]);
	nddpokaz_s(nddopis[nddktory]);
	nddpokaz_o(nddokladka[nddktory]);
	
	}
	else if (nddktory==(nddtytul.length-1)){
	//window.status=which;
	nddktory=0;
	nddpokaz_t(nddtytul[nddktory]);
	nddpokaz_s(nddopis[nddktory]);
	nddpokaz_o(nddokladka[nddktory]);
	
	}
}

// ------------------ timer -----------
var secs
var timerID = null
var timerRunning = false
var delay = 1000

function InitializeTimer(s)
{
	secs = s
    StopTheClock()
    StartTheTimer()
}

function StopTheClock()
{
    if(timerRunning)
    clearTimeout(timerID)
    timerRunning = false
}

function StartTheTimer()
{
    if (secs==0)
    {       
		//nwstecz();
		//nddwstecz();
		InitializeTimer(10);      		
    }
  	else
    {
        if(secs==6){
        nwstecz();
        }else if(secs==1){
        nddwstecz();
        }
		//document.timer.sekundy.value=secs		
        secs = secs - 1
        timerRunning = true
        timerID = self.setTimeout("StartTheTimer()", delay)
    }	
}

