﻿
function dmbanner(){
	var b= document.getElementsByTagName('body')[0];
	var dim =[b.offsetWidth,b.offsetHeight];
	var div = document.createElement('div');
	var s = {
		position:'absolute',
		left:0,
		top:0,
		width:dim[0]+'px',
		height:dim[1]+'px',
		background:'#ffffff',
		cursor:'pointer',
		textAlign:'center'
	}
	for(var i in s){
		div.style[i]=s[i];
	}
	div.innerHTML = '<img style="margin:100px 1% 0 1%" width="97%" src="dariusz_machinski_baner_internet_podpis.jpg"/>';
	div.onclick=function(){
		this.parentNode.removeChild(this)
	}
	b.appendChild(div);
	
	


}


function Design(){
	//dmbanner();

	o("design").innerHTML="Design : ojrzenski@gmail.com"
}

function loadstrzelcy(){

if(o("ligi_wyborS").options[o('ligi_wyborS').selectedIndex].value!=''){
_loading()
scr=document.createElement("script");
scr.src="dane/strzelcy/view.php?f="+o("ligi_wyborS").options[o('ligi_wyborS').selectedIndex].value+".xls&scr=1&r="+Math.random();
document.body.appendChild(scr);
}


}

function strzelcyloaded(arg){
o("strzelcy_rank").innerHTML=arg
_loaded()
}





function zaladujkontakt(){

scr=document.createElement("script");
scr.src="dane/kontakt.php?r="+Math.random();
document.body.appendChild(scr)
_loading();

}

function zaladowanokontakt(arg){
_loaded()
o("main_window").innerHTML="<div><H2>Kontakt:</H2></div>"+arg;


}

function zaladujnewsy(){
_loading()
scr=document.createElement("script");
scr.src="dane/shownotes.php?r="+Math.random()
document.body.appendChild(scr);
return false;
}

function newsydownloaded(l){
_loaded()
try{
if(!(newsy||newsy_uid))
return false;
}catch(err){
_loaded();
o("main_window").innerHTML="";
return false;
}
str="";
for(i in newsy){
d=new Date()
d.setTime(newsy_uid[i]);
str+="<P><H4>"+digi(d.getDate())+"."+digi(d.getMonth()+1)+"."+d.getFullYear()+"&nbsp;&nbsp;&nbsp;&nbsp;<small>"+digi(d.getHours()+1)+":"+digi(d.getMinutes())+"</small></H4>"
str+=newsy[i]+"</P><HR width='50%'>"
}

o("main_window").innerHTML=str;
//org_height=o("main_window").offsetHeight
}


function zaladujdokumenty(){
_loading()
scr=document.createElement("script");
scr.src="dane/showdocs.php?r="+Math.random()
document.body.appendChild(scr);
return false;

}

function zaladowanodokumenty(docs,names,files){
_loaded()
tmp="<div><H2>Dokumenty:</H2></div><UL>"
for(i=0;i<docs.length;i++){
if(files[i]){
tmp+="<LI>"
if(docs[i]!="")
 tmp+=docs[i]+"-<BR>"

tmp+="<a class='l1' href='dane/images/"+files[i]+"'  onClick='return opendoc(\"dane/images/"+files[i]+"\")'><img src=\"doc.gif\" border=\"0\" >"+names[i]+"</a>"
tmp+="</LI>"
}
}
tmp+="</UL>"

o("main_window").innerHTML=tmp

}






var mx;
var my;


function _loading(){

o("loading").style.display="block"

}

function _loaded(){

o("loading").style.display="none"

}


function roc(arg){
document.getElementById("c"+arg).src="roc.gif"
}

function cor(arg){
document.getElementById("c"+arg).src="cor.gif"

}
var org_height=null;

function OPEN(arg){
switch(arg){
case  "strona glowna" : 

zaladujnewsy()
break;
case  "rozgrywki" : 
rk='ligi_wybor'
o("main_window").innerHTML='<div><H2>Rozgrywki:</H2></div><TABLE BORDER="0"  WIDTH="100%" HEIGHT="100%" CELLPADDING="4" CELLSPACING="0"><TR><TD><select id="ligi_wybor" onChange="downloadsezon(this.options[this.selectedIndex].value,1)"><option value="new">Wybierz ligę</option></select></TD></TR><TR><TD  VALIGN="TOP" ALIGN="LEFT"><DIV  ID="tabelaout" style="display:none"><TABLE BORDER="0"   CLASS="u1"   CELLPADDING="2" CELLSPACING="0"><TR><TD WIDTH="100%" class="u2"><B>Tabela : </B></TD></TD></TR><TR><TD  WIDTH="100%" HEIGHT="100%" CLASS="u3" VALIGN="TOP" ID="tabela"></TD></TR></TABLE></DIV></TD></TR><TR><TD HEIGHT="100%"  VALIGN="TOP"  ><DIV  ID="rundajesiennaout" style="display:none"><TABLE BORDER="0"  CLASS="u1" WIDTH="100%"  CELLPADDING="2" CELLSPACING="0"><TR><TD WIDTH="100%" class="u2"><B>Runda Jesienna : </B></TD></TR><TR><TD  WIDTH="100%" HEIGHT="100%" CLASS="u3" VALIGN="TOP" ID="rundajesienna"></TD></TR><TR><TD WIDTH="100%"  ALIGN="LEFT" CLASS="u2"><BUTTON onClick="printjesien()"><img src="images/print.jpg"></BUTTON></TD></TR></TABLE></DIV></TD></TR><TR><TD HEIGHT="100%"  VALIGN="TOP"><DIV  ID="rundawiosennaout" style="display:none"><TABLE BORDER="0"  CLASS="u1" WIDTH="100%"  CELLPADDING="2" CELLSPACING="0"><TR><TD WIDTH="100%" class="u2"><B>Runda Wiosenna : </B></TD></TD></TR><TR><TD  WIDTH="100%" HEIGHT="100%" CLASS="u3" VALIGN="TOP" ID="rundawiosenna"></TD></TR><TR><TD WIDTH="100%"  ALIGN="LEFT" CLASS="u2"><BUTTON onClick="printwiosna()"><img src="images/print.jpg"></BUTTON></TD></TR></TABLE></DIV></TD></TR></TABLE>';

start();
break;
case "kluby" : 
rk='ligi'
o("main_window").innerHTML='<div><H2>Kluby:</H2></div><TABLE BORDER="0" ><TR><TD valign="top"><select id="ligi" onChange="zaladujkluby()"><option value="" >Wybierz ligę</option></select></TD><TD valign="top"><select id="klubyK" onChange="zaladujKlub()"><option value="new">Wybierz klub</option></select></TD></TR><TR><TD colspan="2"><HR ></TD></TR><TR><TD valign="top" align="right"><B>Nazwa Klubu:</B></TD><TD valign="top" id="nazwaklubu"></TD></TR><TR><TD valign="top" align="right"><B>Kierownik drużyny:</B></TD><TD valign="top" id="kierownik"></TD></TR><TR><TD valign="top" align="right"><B>Adres:</B></TD><TD valign="top" id="adres"> </TD></TR><TR><TD valign="top" align="right"><B>Tel/Fax:</B></TD><TD valign="top" id="telefon"></TD></TR><TR><TD valign="top" align="right"><B>Adres boiska:</B></TD><TD id="adresboiska"></TD></TR><TR><TD valign="top" align="right"><B>Zdjęcie:</B></TD><TD id="img_klub"></TD></TR></TABLE>';
o('ligi').disabled=true;
zaladujligi();
break;
case "strzelcy"  :
o("main_window").innerHTML='<div><H2>Najlepsi strzelcy:</H2></div><DIV><select id="ligi_wyborS" onChange="loadstrzelcy()"><option value="">Wybierz ligę</option></select></DIV><DIV ID="strzelcy_rank" width="50%"></DIV>'
rk='ligi_wyborS'
start()
break;
case "dokumenty" : 
zaladujdokumenty();
break;
case "galeria" :
o("main_window").innerHTML="Strona jest w trakcie budowy.<BR>Ten dział zostanie wkrótce uruchomiony."
break;
case "kontakt":
zaladujkontakt();
break;
case "archiwum":
o("main_window").innerHTML='<div><H2>Archiwum:</H2></div><select  id="arch_select"  onChange="view_ligi(this)"><option value="">Sezon:</option></select>&nbsp;&nbsp;&nbsp;<select  id="arch_view"  onChange="download_arch_liga(this.options[this.selectedIndex].value,1)"><option value="">Liga:</option></select><TABLE BORDER="0"  WIDTH="100%" HEIGHT="100%" CELLPADDING="4" CELLSPACING="0"><TR><TD  VALIGN="TOP" ALIGN="LEFT"><DIV  ID="tabelaout" style="display:none"><TABLE BORDER="0"   CLASS="u1"   CELLPADDING="2" CELLSPACING="0"><TR><TD WIDTH="100%" class="u2"><B>Tabela : </B></TD></TD></TR><TR><TD  WIDTH="100%" HEIGHT="100%" CLASS="u3" VALIGN="TOP" ID="tabela"></TD></TR></TABLE></DIV></TD></TR><TR><TD HEIGHT="100%"  VALIGN="TOP"  ><DIV  ID="rundajesiennaout" style="display:none"><TABLE BORDER="0"  CLASS="u1" WIDTH="100%"  CELLPADDING="2" CELLSPACING="0"><TR><TD WIDTH="100%" class="u2"><B>Runda Jesienna : </B></TD></TR><TR><TD  WIDTH="100%" HEIGHT="100%" CLASS="u3" VALIGN="TOP" ID="rundajesienna"></TD></TR><TR><TD WIDTH="100%"  ALIGN="LEFT" CLASS="u2"><BUTTON onClick="printjesien()"><img src="images/print.jpg"></BUTTON></TD></TR></TABLE></DIV></TD></TR><TR><TD HEIGHT="100%"  VALIGN="TOP"><DIV  ID="rundawiosennaout" style="display:none"><TABLE BORDER="0"  CLASS="u1" WIDTH="100%"  CELLPADDING="2" CELLSPACING="0"><TR><TD WIDTH="100%" class="u2"><B>Runda Wiosenna : </B></TD></TD></TR><TR><TD  WIDTH="100%" HEIGHT="100%" CLASS="u3" VALIGN="TOP" ID="rundawiosenna"></TD></TR><TR><TD WIDTH="100%"  ALIGN="LEFT" CLASS="u2"><BUTTON onClick="printwiosna()"><img src="images/print.jpg"></BUTTON></TD></TR></TABLE></DIV></TD></TR></TABLE>';
get_arch_sezony();
break;

case "linki" :
o("main_window").innerHTML="<div><H2>Linki:</H2></div><BR>Ten dział zostanie wkrótce uruchomiony."
break;
default:
break;

}
return false;
}






function get_arch_sezony(){
scr2=document.createElement("script")
scr2.src="rozgrywki/arch_sezony.php?"+Math.random()
document.body.appendChild(scr2)
}


function add_arch_sez(){

while(o("arch_select").length)o("arch_select").remove(0);

var y=document.createElement('option');
  y.text="Sezon:";
  y.value="";


  try{
    o("arch_select").add(y,null);
    
    }catch(ex){
     o("arch_select").add(y);
    
    }




for(p in arch_sez){

  y=document.createElement('option');
  y.text=arch_sez[p];
  y.value=arch_sez[p];
  
  try{
    o("arch_select").add(y,null);
    
    }catch(ex){
     o("arch_select").add(y);
    
    }
  
}

}



function view_ligi(s,r){

	if(s.options[s.selectedIndex].value){
		scr=document.createElement("script")
		scr.src="rozgrywki/arch_ligi.php?arch_sez="+s.options[s.selectedIndex].value+"&r="+Math.random()
		document.body.appendChild(scr)
	}else{
		while(o("arch_view").length)o("arch_view").remove(0);

		var y=document.createElement('option');
		y.text="Liga:";
		y.value="";


		try{
 		   o("arch_view").add(y,null);
    
		}catch(ex){
 		    o("arch_view").add(y);
    
		}

	}
}



function arch_ligi_set(){

while(o("arch_view").length)o("arch_view").remove(0);

var y=document.createElement('option');
  y.text="Liga:";
  y.value="";


  try{
    o("arch_view").add(y,null);
    
    }catch(ex){
     o("arch_view").add(y);
    
    }

for(p in arch_ligi){

  y=document.createElement('option');
  y.text=arch_ligi[p];
  y.value=arch_ligi[p];


  try{
    o("arch_view").add(y,null);
    
    }catch(ex){
     o("arch_view").add(y);
    
    }



}



}

function o(arg){
return document.getElementById(arg)
}

function opendoc(arg){
window.open(arg)
return false;
}

function digi(arg){
arg=""+arg+"";
return ("0").substring(0,2-arg.length)+arg;
}


