/*
* to są moje początki w js także prosze o wyrozumiałość ;)
*wszelka konstruktywna krytyka mile widziana
*(c) 2005 Dariusz 'Bigfoot' Stróżyński
*dstrozynski@gmail.com
*/

function zaznacz() {
i=0;

//jezeli document.formularz["pole["+i+"]"].checked nie ma jednej z 2 
//wartosci true lub false to znaczy ze nie istnieje ... 
//i wtedy wychodzimy z petli -- przy takim podejsciu ie wywala blad ze brak obiektu ... :)
	while (document.formularz["pole"+i].checked == true || 
               document.formularz["pole"+i].checked == false){
            document.formularz["pole"+i++].checked = true;
	};
};

function odznacz() {
i=0;
	while (document.formularz["pole"+i].checked == true || 
               document.formularz["pole"+i].checked == false){
            document.formularz["pole"+i++].checked = false;
	};
};

function check(e, regexp) {

	// wywolanie obliczen
	//funkcja_liczaca();

	if(navigator.userAgent.indexOf('Gecko') != -1) {
	  charCode = e.which;
	} 
        else {
	  charCode = e.keyCode;
	};
	
    if(charCode > 31) {
	   znak = String.fromCharCode(charCode);
	//   zmiana();   
	   return regexp.test(znak);
	};
    
};

function spis(url){
window.open(url,'okienko','status=no,toolbar=no,scrollbars=yes,width=630,height=460');
}


//testy dynamicznego zachowania ..
function anyObj(divName) {
	this.IE5=this.NN4=this.NN6=false
	if(document.all)this.IE5=true
	else if(document.layers)this.NN4=true
	else if(document.getElementById)this.NN6=true
	
	if(this.NN4)this.obj=eval("document."+divName)
	if(this.IE5)this.obj=eval("document.all."+divName)
	if(this.NN6)this.obj=eval("document.getElementById(\""+divName+"\")")

	this.show = showDiv
	this.hide = hideDiv
	this.showtext = showText
}
function showDiv() {
	if(this.NN4) this.obj.visibility="visible"
	else this.obj.style.visibility="visible"
}
function hideDiv() {
	if(this.NN4) this.obj.visibility="hidden"
	else this.obj.style.visibility="hidden"
}
function showText(content) {
	if(this.NN4) {
		// Couldn't get this to work inside table cell.
		//	this.obj.document.write(content)
		//	this.obj.document.close()
		alert("I couldn't get part to work in NN4")
	} else if(this.NN6) {
		this.obj.innerHTML = content
	} else if(this.IE5) {
		content=content+"\n"	// You have to have this new line character for a bug on Mac IE.
		this.obj.innerHTML = content
	}
}

function display() {
	if(document.all.prezent.checked==true){
		myObj.show();
	}
	else{
		myObj.hide();
	} 
}

function initialize() {
	myObj = new anyObj("tableDiv");
	myObj.hide();

}



//initialize;


//a to wygenerowal dreamwaver Globiego ... 

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


