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 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_kolory(pole) {
	plik='admin_kolory.php?pole='+pole
	noweOkienko=null
	ustawienia=
	"left=0,"
	+"top=0,"
	+"screenX=0,"
	+"screenY=0,"
	+"width=240,"
	+"height=330,"
	+"innerWidth=240,"
	+"innerHeight=330,"
	+"toolbar=no,"
	+"location=no,"
	+"directories=no,"
	+"status=no,"
	+"menubar=no,"
	+"scrollbars=no,"
	+"resizable=no"
	noweOkienko=window.open(plik,"kolory",ustawienia)
	noweOkienko.focus()
}

function AltSel(frm)
	{
	var n=frm.name
	var f=frm.form.name+'.'+n
	var s=frm.form.name+'_'+n
	var s1=s+'_s1'
	var sa=s+'_sa'
	var c=frm.className
//	alert(frm.name+frm.style.width)
//	frm.clientWidth=frm.style.width
	var Ret=''
	Ret+='<INPUT type=hidden name='+n+' value="">'
	Ret+='<TABLE cellpadding=0 cellspacing=0 bgcolor="#FFFFDD" style="border:0 inset;" onmousedown="focus(this)" onfocus="SelON('+sa+')" onblur="SelOFF('+sa+')"><TR>'
	Ret+='<TD WIDTH='+frm.style.width+' style="border:2 solid #000000"><DIV class='+c+' id='+s1+' style="cursor: default; width:'+(frm.style.width-22)+'"></DIV></TD>'
	Ret+='<TD style="border:2 solid #000000;">'
	Ret+='<BUTTON style="font-size:1" onfocus="blur()"><IMG vspace=2 src="img/i_select.gif" width=8 height=5></BUTTON>'
	Ret+='<DIV style="position:absolute"><DIV id='+sa+' style="Z-INDEX:3; position:absolute; visibility:hidden; width:'+(frm.style.width)+'; background-color:#FFFFDD; padding:1; border:1 solid #000000;" nowrap>'
	Ret+='<TABLE cellpadding=0 cellspacing=0 width="100%" style="cursor: default;">'
	for(var i=0; i<frm.length; i++)
		{
		var t=frm[i].text; v=frm[i].value
		if(frm[i].selected) {
			var st=t,sv=v
		}
		Ret+='<TR><TD NOWRAP id=tx'+i+' class='+c
		Ret+=(t.charAt(t.length-1)!='-')? ' onmousedown="'+s1+'.innerHTML=\'<NOBR>'+t+'</NOBR>\';'+f+'.value=\''+v+'\'" onmouseover="SelOver(this)" onmouseout="SelOut(this)"' : ' style="font-weight:bold"'
		Ret+='>&nbsp;'+t+' &nbsp;</TD></TR>'
		}
	Ret+='</TABLE>'
	Ret+='</DIV></DIV>'
	Ret+='</TD>'
	Ret+='</TR></TABLE>'
	frm.parentElement.innerHTML=Ret
	var s1=eval(s1)
	s1.innerHTML='<NOBR>'+st+'</NOBR>'

	var f=eval(f); f.value=sv
	var sa=eval(sa); sa.style.top=19
	}
function SelOver(obj){obj.bgc=obj.bgColor;obj.fgc=obj.style.color;obj.bgColor='#000080';obj.style.color='#FFFFFF'}
function SelOut(obj){obj.bgColor=obj.bgc;obj.style.color=obj.fgc}
function SelON(obj) {obj.style.visibility='visible';obj.style.left=-obj.clientWidth}
function SelOFF(obj){obj.style.visibility='hidden'}
// -------------------------------------------------------------------------------

function okno_katalog(korzen,pole) {
	plik='katalog.php?korzen='+korzen+'&pole='+pole
	noweOkienko=null
	ustawienia=
	"left=0,"
	+"top=0,"
	+"screenX=0,"
	+"screenY=0,"
	+"width=420,"
	+"height=400,"
	+"innerWidth=420,"
	+"innerHeight=400,"
	+"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=400,"
	+"innerWidth=550,"
	+"innerHeight=400,"
	+"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" ALIGN="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_obrazek(src,w,h) {
	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>Proszę czekać na obrazek. . . . . . . . . . . . . . . . .  . . . . . . .</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 ALIGN="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()
}


<!--
// Nowa funkcja - nie kasować!!!
// ----------------------------------------------
// StyleSwitcher functions written by Paul Sowden
// http://www.idontsmoke.co.uk/ss/
// - - - - - - - - - - - - - - - - - - - - - - -
// For the details, visit ALA:
// http://www.alistapart.com/stories/alternate/
//
// nifty StyleSwitcher scripts modified by Aaron Jones 10/10/2002
// ----------------------------------------------

function setActiveStyleSheet(title, reset) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
  if (reset == 1) {
	  createCookie("wstyle", title, 365);
  }
}

function setStyle() {
	var style = readCookie("wstyle");
	if (style != null) {
		setActiveStyleSheet(style, 0);
	}
}

function popChild(url, width, height, winName) {
  var features = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=" + width + ",height=" + height;
  if (winName == "") {
  	winName = "childWin";
  }
  SmallWin = window.open(url,winName,features);
  if (window.focus) {
    SmallWin.focus();
  }
}

function loadParent(url) {
  var parentWin = window.opener
  if (window.opener.closed) {
    window.open(url,"parentWin");
  } else {
    parentWin.location = url;
    if (window.focus) {
      parentWin.focus();
    }
  }
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/; domain=wired.com;";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

//-->
