//nie wiem ?????????????????????????????????????????????????????????????????????????????
function MM_findObj(n, d) {//v4.0
  var p,i,x;  
 if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;}
function MM_showHideLayers() {//v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) {v=args[i+2];
    if (obj.style) {obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v;}
    obj.visibility=v;}}
//--------------------------------------------------------------
function MM_reloadPage(init) {  
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

// druk strony ============================================================================================================================
function doit(){ if (!window.print) {alert("Dysponujesz starą wersją przeglądarki"); return; } window.print(); }

// okna indeksu ===========================================================================================================================
function openmenu(adres) { wind0=window.open(adres, 'window0' , 'menubar=no, toolbar=no, location=no, scrollbars=yes, resizable=yes, status=yes, width=900, height=700'); wind0.focus();}
function closemenu() { wind0=window.close(); } // wind0=window.close(); wind0.close();

function openpdf(adres) { wind1=window.open(adres, 'window1' , 'menubar=no, toolbar=no, location=no, scrollbars=yes, resizable=yes, status=yes, width=900, height=600'); wind1.focus();}

function opennews(adres) { wind2=window.open(adres, 'window2' , 'menubar=no, toolbar=no, location=no, scrollbars=yes, resizable=yes, status=yes, width=900, height=600'); wind2.focus();}
function closenews() { wind2=window.close(); } 

function openuser(adres) {wind3=window.open(adres, 'window3', 'menubar=no, toolbar=no, location=no, scrollbars=yes, resizable=yes, status=yes, width=928, height=700'); wind3.focus(); }
function closeuser() { wind3=window.close(); } 

function openlist(adres) {wind4=window.open(adres, 'window4', 'menubar=no, toolbar=no, location=no, scrollbars=yes, resizable=yes, status=yes, width=530, height=600'); wind4.focus(); }
function closelist() { wind4=window.close(); } 

function openmeteolink(adres) {wind5=window.open(adres, 'window5' , 'menubar=no, toolbar=no, location=no, scrollbars=yes, resizable=no, status=yes, width=900, height=700'); wind5.focus();}


// okna pageusa /sprawdzić w oscylatorach zmiany !!!!
//function openprv(adres) {noweOkno2=window.open(adres, 'okienko2', 'menubar=no, toolbar=no, location=no, scrollbars=yes, resizable=no, status=yes, width=530, height=600'); noweOkno2.focus(); }


// zmiana odświerzacza okien cyklicznie odświerzanych (REFCHA) =========================================================================================
function  insertolicz(obj,form,input,tyrb) 
		{		var status,refcha;  status = obj.id;
				refcha = document.getElementById(form)[input].value;
				if(refcha=='off') {refcha=8;}	
				if(status=='min') { if(refcha>2) refcha--; else refcha=2;}
				if(status=='plu') {refcha++;}
				if(status=='off') {refcha='off';}
		        document.getElementById(form)[input].value=refcha;
		 }

// zmiana wielkości w oknie (PKTO) =========================================================================================
function  insertoliczpkto(obj,form,input,tyrb) 
		{		var status,pkto;
				status = obj.id;
				pkto = document.getElementById(form)[input].value;
				pkto = pkto/1;
				if(status=='min') { pkto=pkto-10; }
				if(status=='plu') { pkto=pkto+10;}
		        document.getElementById(form)[input].value=pkto;
		 }

// checkBOX i nie tylko - ustawia imputy na fals i true =====================================================================================================
function setCheck(obj, sIDInput){
				if (obj.checked)
				{obj.checked=true; obj.firstChild.innerHTML="";} else {obj.checked=false; obj.firstChild.innerHTML="a";}
				obj.document.getElementById(sIDInput).value=obj.checked;
				obj.checked=!obj.checked;}

// wstawianie w obiekt false lub true=================================================================================================================
function seto(obj, sIDInput)
	{obj.checked=obj.name;
	obj.document.getElementById(sIDInput).value=obj.checked;
	obj.checked=!obj.checked;}

function setotext(obj, sIDInput)
	{obj.checked=obj.name;
	obj.document.getElementById(sIDInput).value=obj.checked;
	obj.checked=!obj.checked;}
// zastosowane w hangarlist do wstawiania wartości pola z okna do pola w innym oknie ==========================================================================
function setlist(str) { opener.document.forms("listsf").f6.value = str; }

// wstawia nazwe obiektu jako wartość inputa=========================================================================================================
function  insertostat(obj,form,input) 
		{ var status;  status = obj.id; document.getElementById(form)[input].value=status; }


// wstawianie w obszar span tekstu z przedrostkiem ==================================================================================================
function  inserto(wiz,form,input,txt)
	{var strin, sours;
	sours=document.getElementById(form)[input].value;
	strin=""; strin += txt + sours;
	document.getElementById(wiz).innerHTML=strin;}

// wstawianie tagów =========================================================================================================================
function insert(startTag,defaultText,endTag,tryb,forma,objekt) 
	{with(document.forms(forma))
   	{var objt=document.forms(forma).elements(objekt);
   		 if (objt.createTextRange) 
	      {var text;
	         objt.focus(objt.caretPos);
	         objt.caretPos=document.selection.createRange().duplicate();
	         if(objt.caretPos.text.length>0)
	         {if(tryb==1) {var sel=objt.caretPos.text; var fin='';
				            while(sel.substring(sel.length-1, sel.length)==' ')
            					{sel=sel.substring(0, sel.length-1)
               						fin += ' ';}  objt.caretPos.text=startTag + sel + endTag + fin;} else objt.caretPos.text=startTag+endTag;}  else 	objt.caretPos.text=startTag+defaultText+endTag;} else objt.value += startTag+defaultText+endTag;
	objt.focus();}
	}

// czyszczenie pola i wizjera ==================================================================================================================
function czysc(spa,wiz) 
	{document.getElementById(spa).innerHTML=document.getElementById(spa).innerHTML;
	 document.getElementById(wiz).innerHTML="";}

// czyszczenie pola =========================================================================================================================
function czyscin(spa) {document.getElementById(spa).value="";}

// wstawki w textarea ========================================================================================================================
var b,u,i; 
function wstaw(co)  {if(co=='<b>') {if(b=='on' ) {co='</b>';  b='off';} else  {b='on';  co='<b>';}} 
	 if(co=='<u>') {if(u=='on' ) {co='</u>';  u='off';} else  {u='on';  co='<u>';}} 
	 if(co=='<i>')  {if(i=='on'  )  {co='</i>';  i='off';} else  {i='on';  co='<i>';}} 
	newsf.tresc.value=newsf.tresc.value+co;} 

// zmieniacz grafiki przycisków - dwie funkcje gdy 2 typy przycisków ======================================================================================
function zmien(grafika,plik) {document.images[grafika].src=plik;}
function zmien2(grafika,plik) {document.images[grafika].src=plik;}

// wywołanie div do listy wyborów ================================================================================================================
var refer=true;
function combot(objekt) 
	{
	if (refer) {document.all(objekt).style.visibility="visible"; refer=false;} else {document.all(objekt).style.visibility="hidden"; refer=true;}
	}

// menu strony pływające =====================================================================================================================
window.onerror=null;
var topMargin=10;
var slideTime=1200;
var ns6=(!document.all && document.getElementById);
var ie4=(document.all);
var ns4=(document.layers);
function layerObject(id,left) {if (ns6) {this.obj=document.getElementById(id).style;
this.obj.left=left; return this.obj;}
else if(ie4) {this.obj=document.all[id].style; this.obj.left=left; return this.obj;}
else if(ns4) {this.obj=document.layers[id]; this.obj.left=left; return this.obj;}}
function layerSetup() {floatLyr=new layerObject('floatLayer', 130);
window.setInterval("main()", 10)}
function floatObject() {if (ns4 || ns6) {findHt=window.innerHeight;} else if(ie4) {findHt=document.body.clientHeight;}} 
function main() {if (ns4) {this.currentY=document.layers["floatLayer"].top; this.scrollTop=window.pageYOffset; mainTrigger();}
else if(ns6) {this.currentY=parseInt(document.getElementById('floatLayer').style.top); this.scrollTop=scrollY; mainTrigger();} else if(ie4) {this.currentY=floatLayer.style.pixelTop; this.scrollTop=document.body.scrollTop; mainTrigger();}}
function mainTrigger() {var newTargetY=this.scrollTop + this.topMargin;
if ( this.currentY != newTargetY ) {if ( newTargetY != this.targetY ) {this.targetY=newTargetY; floatStart();} animator();}}
function floatStart() {var now=new Date();
this.A=this.targetY - this.currentY;
this.B=Math.PI/( 2 * this.slideTime );
this.C=now.getTime();
if (Math.abs(this.A)> this.findHt) {this.D=this.A> 0 ? this.targetY - this.findHt : this.targetY + this.findHt; this.A=this.A> 0 ? this.findHt : -this.findHt;}
else {this.D=this.currentY;}}
function animator() {var now=new Date();
var newY=this.A * Math.sin( this.B * ( now.getTime() - this.C ) ) + this.D;
newY=Math.round(newY);
if (( this.A> 0 && newY> this.currentY ) || ( this.A <0 && newY <this.currentY )) {if ( ie4 )document.all.floatLayer.style.pixelTop=newY;
if ( ns4 )document.layers["floatLayer"].top=newY;
if ( ns6 )document.getElementById('floatLayer').style.top=newY + "px";}}
function start() {if(ns6||ns4) {pageWidth=innerWidth; pageHeight=innerHeight; layerSetup(); floatObject();} else 
if(ie4) {pageWidth=document.body.clientWidth; pageHeight=document.body.clientHeight; layerSetup(); floatObject();}}

// AO- fotoview czyli nowe okno z obrazem po kliknięciu ========================================================================================================
PositionX=10;
PositionY=10;
defaultWidth=500;
defaultHeight=500;
var AutoClose=true;
if (parseInt(navigator.appVersion.charAt(0))>=4){var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=500,height=500,left='+PositionX+',top='+PositionY;
function openpic(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(500,500);');
writeln('width=500-(document.body.clientWidth-document.images[0].width);');
writeln('height=500-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
close();}
}

//  pływający tekst w indeksie ============================================================================================================================
var l1 =   0; // left of ticker in pixel, or 0 to position relative
var t1 =   0; // top of ticker in pixel, or 0 to position relative
var w1 = 520; // width of ticker in pixel
var ie = document.all ? true : false;
var first = true;
var l2 = l1 + w1;
var l3 = l1 - l2;
var l = l2;
function tickinit()
{
if (ie) {
	if (l1 == 0 && t1 == 0) { pos = document.all['tickpos']; l1 = getLeft(pos);  t1 = getTop(pos);}
	ticktext.style.posTop = t1;
}
 else {
if (l1 == 0 && t1 == 0) {
pos = document.anchors['tickpos'];
l1 = pos.x;
t1 = pos.y;
}
document.ticktext.pageY = t1;
}
l2 = l1 + w1;
l3 = l1 - l2;
l = l2;
setInterval('tick()', 10);
}
function getLeft(ll) {
if (ll.offsetParent)
return (ll.offsetLeft + getLeft(ll.offsetParent));
else 
return (ll.offsetLeft);
}
function getTop(ll) {
if (ll.offsetParent)
return (ll.offsetTop + getTop(ll.offsetParent));
else
return (ll.offsetTop);
}
function tick() {
l = l - 0.5;
if (l < l3) l = l2;
cl = l1 - l;
cr = l2 - l;
if (ie) {
ticktext.style.posLeft = l;
ticktext.style.posTop = t1;
ticktext.style.clip = "rect(auto "+cr+"px 12px "+cl+"px)";
//ticktext.style.clip = "rect(auto "+cr+"px auto "+cl+"px)";
if (first) ticktext.style.visibility = "visible";
}
else {
document.ticktext.pageX = l;
document.ticktext.clip.left = cl;
document.ticktext.clip.right = cr;
if (first) document.ticktext.visibility = "show";
}
first = false;
}
//=========================================================================================================================================
