function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function my_show_div(obj) {
	 obj = document.getElementById(obj);
	 obj.style.display == 'none' ? obj.style.display = '' : obj.style.display = 'none';
}

function my_divs_init(ajdi) {
	 objs = document.getElementsByTagName('div');

	 for(i = 0, i2 = 0; i < objs.length; i++) {
	 	   if(objs[ i ].id == ajdi) {
		   			objs[ i ].id = ajdi + i2.toString();
					i2++;
		   }
	 }

	 objs = document.getElementsByTagName('a');
	 
	 for(i = 0, i2 = 0; i < objs.length; i++) {
	 	   if(unescape(objs[ i ].href) == "javascript: my_show_div('" + ajdi + "');") {
		   			objs[ i ].href = "javascript: my_show_div('" + ajdi + i2.toString() + "')";
					i2++;
		   }
	 }
}

function zazodz(prefix) { // zaznaczenie i odznaczenie checkboxow o wspolnych prefixach
	 chkbx = document.getElementsByName('dz_idx[]');
	 chkbx_length = chkbx.length;
	 if (document.getElementById('rem_all').checked)
	 	for(i = 0; i < chkbx_length; i++) chkbx[ i ].checked = true;
	 	else for(i = 0; i < chkbx_length; i++) chkbx[ i ].checked = false;
} // function




function check_form() {
  if (this.document.forms.rekord.id_kategorii.value == 0) {
    this.window.alert("Nie wybrano kategorii!!!");
  } else this.document.forms.rekord.Submit();
}

function falseSubmit(frm, sbm) {
  if (sbm == 0) { document.getElementById("akcja").value = 0; }

  if (document.getElementById(frm).submit()) document.getElementById(frm).submit();
  this.document.getElementById(frm).Submit();
}


// sprawdzenie poprawnosci podania kolejnosci
function sprawdzPole(formularz, pole)	{

	var blad='';
	validNum=/^[0-9]*$/;
					
    with (formularz) {
		if (pole.value=='') blad+='\n- (pole wymagane)';
		if (pole.value != '' && pole.value.search(validNum) == -1)
			blad+='\n- (dopuszczalne tylko cyfry od 0-9)';
				
		if (blad!='') {
			alert('błąd wypełnienia.\n'+blad);
			pole.value = zmienianaPoz.value;
			return false;
		}  else  {
			 return true;
		   }
	} // while
} // sprawdzPole


function fSubmit(formularz) {
  if (document.getElementById(formularz).submit()) document.getElementById(formularz).submit();
  	else document.getElementById(formularz).Submit();  
}
