var nn4=(document.layers)?true:false
var ie4=(document.all)?true:false

function drukuj(){
	if (!window.print){
		alert("Musisz mieć NS4.x lub IE5,\naby użyć przycisku drukowania!")
	} else {
		window.print()
	}
}

function nowyRandom(zakres) {
   var los=Math.round(Math.random()*10*zakres)+zakres
   return Math.round(((los-zakres)*zakres)/los)
} //losuje od 0 do zakres

function marquee(myText){
    textlen=myText.length;         
	newText=myText.substring(2,textlen)+myText.substring(0,2);        
	window.status=newText;         
	setTimeout("marquee('"+newText+"')",300);         
}

function tekstWyczysc(input) {
	if ( input.value == input.defaultValue ) {
		input.value = "";
	}
}

function tekstPowrot(input) {
	if ( input.value == "" ) {
		input.value = input.defaultValue;
	}
}

function zamien(wartosc) {
  var pom=""
  pom=pom+wartosc
  if (isNaN(pom))
   {
     var z=pom.indexOf(",")
	 if (z!=-1) {pom=pom.substring(0,z)+"."+pom.substring(z+1,pom.length)}
   }
  if (!isNaN(pom)) {pom=Math.round(pom*100)/100}
  return pom
}

function usun(tekst) {
  var pom=tekst.indexOf("'",0)
  while (pom!=-1){
    {tekst=tekst.substring(0,pom)+'`'+tekst.substring(pom+1,tekst.length)}
    pom=tekst.indexOf("'",pom)  
  }
  return tekst  
}

function show(ident) { 
    if(nn4) { 
        document.layers[ident].visibility = "show";
    } else if(ie4) { 
        document.all[ident].style.visibility = "visible";
    }
}
function hide(ident) { 
    if(nn4) { 
        document.layers[ident].visibility = "hide";
    } else if(ie4) { 
        document.all[ident].style.visibility = "hidden";
    }
}

function dataSlownie(data) {
  var pomoc=""
	dzien=data.getDay()
	if (data.getDay()==0) {dzien="Niedziela"}
	if (data.getDay()==1) {dzien="Poniedziałek"}
	if (data.getDay()==2) {dzien="Wtorek"}
	if (data.getDay()==3) {dzien="Środa"}
	if (data.getDay()==4) {dzien="Czwartek"}
	if (data.getDay()==5) {dzien="Piątek"}					
	if (data.getDay()==6) {dzien="Sobota"}

	if (data.getMonth()==0) {miesiac="stycznia"}
	if (data.getMonth()==1) {miesiac="lutego"}
	if (data.getMonth()==2) {miesiac="marca"}
	if (data.getMonth()==3) {miesiac="kwietnia"}
	if (data.getMonth()==4) {miesiac="maja"}
	if (data.getMonth()==5) {miesiac="czerwca"}
	if (data.getMonth()==6) {miesiac="lipca"}
	if (data.getMonth()==7) {miesiac="sierpnia"}
	if (data.getMonth()==8) {miesiac="września"}
	if (data.getMonth()==9) {miesiac="października"}
	if (data.getMonth()==10) {miesiac="listopada"}
	if (data.getMonth()==11) {miesiac="grudnia"}

	if (data.getYear()<1900) {rok=data.getYear()+1900} 
	else {rok=data.getYear()}

	pomoc=dzien+" "+data.getDate()+" "+miesiac+" "+rok+"r."
	
	return pomoc
}

// ------------ obrazki -----------------
	function ImageArray(n) {
		this.length = n
		for (var i = 0; i<=n; i++) {
			this[i] = new Image()
		}
		return this
	}
	function mOver(num) { 
		if ((over[num].src != "") ) {
			document.images[num].src = over[num].src;
		}
	}
	
	function mOut(num) {
		if ((off[num].src != "")) {
	  	document.images[num].src = off[num].src;
		}
	}
// ------------ koniec obrazki -----------------


function okno_katalog(korzen,pole) {
	plik='katalog.php?korzen='+korzen+'&pole='+pole
	noweOkienko=null
	ustawienia=
	"left=0,"
	+"top=0,"
	+"screenX=0,"
	+"screenY=0,"
	+"width=620,"
//	+"height="+h+","
	+"innerWidth=620,"
//	+"innerHeight="+h+","
	+"toolbar=no,"
	+"location=no,"
	+"directories=no,"
	+"status=no,"
	+"menubar=no,"
	+"scrollbars=yes,"
	+"resizable=no"
	noweOkienko=window.open(plik,"katalog",ustawienia)
	noweOkienko.focus()
}


function okno_tresc(tresc) {
	noweOkienko=null
	ustawienia=
	"left=0,"
	+"top=0,"
	+"screenX=0,"
	+"screenY=0,"
	+"width=550,"
//	+"height="+h+","
	+"innerWidth=550,"
//	+"innerHeight="+h+","
	+"toolbar=no,"
	+"location=no,"
	+"directories=no,"
	+"status=no,"
	+"menubar=no,"
	+"scrollbars=yes,"
	+"resizable=no"
	noweOkienko=window.open("","tresc",ustawienia)
	noweOkienko.document.open()
	noweOkienko.document.clear()
	noweOkienko.document.write(
	'<HTML><HEAD>\n'
	+'<TITLE>Podgląd treści</TITLE>\n'
	+'<LINK HREF="../style.css" REL="stylesheet">\n'
	+'</HEAD>\n'
	+'<BODY>\n'
	+'<TABLE WIDTH="500" class="center" VALIGN="top"><TR><TD>\n'
	+'<DIV ALIGN="justify">\n'
	+tresc			
	+'</DIV>\n'
	+'</TD></TR></TABLE>\n'
	+'</BODY>\n'
	+"</HTML>\n"
	)
	noweOkienko.document.close()
	noweOkienko.focus()
}

function okno_katalog_plik(korzen,pole) {
	plik='admin_katalog.php?korzen='+korzen+'&pole='+pole
	noweOkienko=null
	ustawienia=
	"left=0,"
	+"top=0,"
	+"screenX=0,"
	+"screenY=0,"
	+"width=620,"
//	+"height=500,"
	+"innerWidth=620,"
//	+"innerHeight=500,"
	+"toolbar=no,"
	+"location=no,"
	+"directories=no,"
	+"status=no,"
	+"menubar=no,"
	+"scrollbars=yes,"
	+"resizable=no"
	noweOkienko=window.open(plik,"katalog",ustawienia)
	noweOkienko.focus()
}

function okno_obrazek(src,w,h,tytul) {
 if (!tytul) {
		tytul='Proszę czekać na obrazek. . . . . . . . . . . . . . . . .  . . . . . . .'
	}
	noweOkienko=null
	if (window.screeen) {
		aw=screeen.availWidth
		ah=screeen.availHeight
	} else {
		aw=640
		ah=450
	}	
	
	ustawienia=
	"left="+(aw-w)/2+","
	+"top="+(ah-h)/2+","
	+"screenX="+(aw-w)/2+","
	+"screenY="+(ah-h)/2+","
	+"width="+w+","
	+"height="+h+","
	+"innerWidth="+w+","
	+"innerHeight="+h+","
	+"toolbar=no,"
	+"location=no,"
	+"directories=no,"
	+"status=no,"
	+"menubar=no,"
	+"scrollbars=no,"
	+"resizable=no"
	noweOkienko=window.open("",("obrazek_"+w+"_"+h),ustawienia)
	noweOkienko.document.open()
	noweOkienko.document.clear()
	noweOkienko.document.write(
	"<HTML><HEAD>\n"
	+"<TITLE>"+tytul+"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TITLE>\n"
	+"<STYLE>\n"
	+"body{\n"
	+"margin-left : 0px; \n"
	+"margin-top : 0px; \n"
	+"margin-bottom : 0px; \n"
	+"margin-right : 0px; \n"
	+"} \n"
	+"</STYLE>\n"
	+"</HEAD>\n"
	+"<BODY onclick='window.close()'>\n"
	+'<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="100%" HEIGHT="100%"><TR><TD class="center" VALIGN="middle">\n'
	+'<IMG SRC="'+src+'" WIDTH="'+w+'" HEIGHT="'+h+'" BORDER="0" ALT="">\n'
	+'</TD></TR></TABLE>\n'
	+"</BODY>\n"
	+"</HTML>\n"
	)
	noweOkienko.document.close()
	noweOkienko.focus()
}

