<!-- <![CDATA[

var okiGlobal = true;

function usuwanie(newURL) {
	if (confirm('Czy napewno usun±ć ?!')) {location.href=newURL;}
}

function sprawdz_date(id_pola,wys_kom) {
  var j=0;
  var dobradata = /^\d\d-\d\d-\d\d\d\d$/i;
	if (dobradata.test(document.getElementById(id_pola).value)) {return true;}
  else {
    if (wys_kom) {
		  alert(document.getElementById(id_pola).value + USER_LIB_ZLE_DATA_JS);
    }
    return false;
  }
}

function sprawdz_email(id_pola,wys_kom) {
  var dobryEmail = /^[^@]+@([a-z0-9\-]+\.)+[a-z]{2,4}$/i;
  /* wyrażenie opisuj±ce dobry adres e-mail:
     ^                 - pocz±tek napisu
     [^@]+             - 1 lub więcej znaków innych niż @
     @                 - znak @
     ([a-z0-9\-]+\.)+  - jedna lub więcej grupa, a w niej:
        [a-z0-9\-]+    - jedna lub więcej litera, cyfra lub my¶lnik
        \.             - kropka
     [a-z]{2,4}        - od dwóch do czterech liter
     $                 - koniec napisu
  */
  	if (dobryEmail.test(document.getElementById(id_pola).value)) {
		return true;
	} else {
    	if (wys_kom) {alert('"' + document.getElementById(id_pola).value + USER_LIB_ZLE_MAIL_JS);}
    	return false;
  	}
}

function sprawdz_kod(id_pola,wys_kom) {
  var dobryregon = /^\d\d-\d{3}$/i;
  if (dobryregon.test(document.getElementById(id_pola).value)) {return true;}
  else {
    if (wys_kom) {alert(document.getElementById(id_pola).value + USER_LIB_ZLE_KOD_JS);}
    return false;
  }
}

function sprawdz_nip(id_pola,wys_kom) {
  var tmp=0;
  var i=0; j=0;
  var nip=0;
  var dobrynip = /^[1-9]{3}[0-9]{7}$/i;
  // Trzy pierwsze cyfry numeru NIP oznaczają kod Urzędu Skarbowego,
  // w kodzie tym występują cyfry od 1 do 9 (nie występuje cyfra 0)
  // pozostałe 7 cyfr to cyfry od 0 do 9

  str_nip = new String();
  wagi = new Array(6, 5, 7, 2, 3, 4, 5, 6, 7);

  if (dobrynip.test(document.getElementById(id_pola).value)) {
    str_nip = document.getElementById(id_pola).value;
    for (i=0; i<9; i++) {nip = (str_nip.charAt(i) * wagi[i]) + nip;}
    nip = nip%11;
    nip = nip%10;
    if (str_nip.charAt(9) == nip) {return true;}
    else {
      if (wys_kom) {alert(USER_LIB_ZLE_NIP_JS);}
      return false;
    }
	}
  else {
    if (wys_kom) {alert(USER_LIB_ZLE_NIP_JS);}
    return false;
  }
}

function on_komentarz(element, zdarzenie, komentarz) {
  /* wykożystanie w kodzie */
	/* onmouseover="on_komentarz(this, event, 'tu tekst komentarza')" */
	var tmp='';
	if(!komentarz||!document.createElement) {return false;}
  div_kom=document.createElement('div');
  div_kom.move=function(e){
    if (zdarzenie=e||event) {
		  div_kom.style.left=zdarzenie.clientX+((document.documentElement.scrollLeft||document.body.scrollLeft)+13)+'px';
			div_kom.style.top=zdarzenie.clientY+((document.documentElement.scrollTop||document.body.scrollTop)+15)+'px';
		}
  }
  div_kom.hide=function(x){
    element.title=tmp;
    if(x=document.getElementById('onmouse_komentarz')) {document.body.removeChild(x);}
  }
  
  // usuwa wszystkie inne elementy tego samego id (może istnieć tylko jeden taki element w danej chwli)
    if (document.getElementById('onmouse_komentarz')) {document.body.removeChild(document.getElementById('onmouse_komentarz'));}
  // --------------------------------------------------------------------------------------------------
	
  div_kom.move(zdarzenie);
  div_kom.id='onmouse_komentarz';
  tmp=element.title; element.title='';
	div_kom.innerHTML=komentarz;
  document.body.appendChild(div_kom);
  element.onmouseout=div_kom.hide;
  element.onmousemove=div_kom.move;
  return true;
}

function zmien_activ(akcja,id,actualvar,kolumna_sql) {
  document.forms[0].akcja.value=akcja;
  document.forms[0].id.value=id;
  document.forms[0].actual_var.value=actualvar;
  document.forms[0].kolumna_sql.value=kolumna_sql;
  document.forms[0].submit();
}

function clear_form_style(tmp_id, pn_prefix) {
  if (!pn_prefix) {var pn_prefix='';}
  if(document.getElementById(pn_prefix + tmp_id + '_wymagane')) {
	  if(document.getElementById(pn_prefix + tmp_id + '_wymagane').value == 1) {
	    document.getElementById(tmp_id).value="";
		  document.getElementById(tmp_id).className = 'form_1';
	    document.getElementById(pn_prefix + tmp_id + '_wymagane').value = '0';
    }
  }
	if(document.getElementById(pn_prefix + tmp_id + '_sprawdz')) {
	  if(document.getElementById(pn_prefix + tmp_id + '_sprawdz').value == 1) {
		  document.getElementById(tmp_id).className = 'form_1';
	    document.getElementById(pn_prefix + tmp_id + '_sprawdz').value = '0';
		if (document.getElementById(tmp_id).type == 'password') {
			 document.getElementById(tmp_id).value="";
		 }
    }
  }
}  

function polaSprawdzane(oki, pn_prefix) {
	var i=0;
  var tmp_oki=true;
  var flaga=false;
  var flaga_pass = true;
  while (document.getElementById(pn_prefix + 'pole_sprawdzane_' + i)) {
    tmp_oki=true;
		tmp_id = document.getElementById(pn_prefix + 'pole_sprawdzane_' + i).value;
		switch (document.getElementById(pn_prefix + tmp_id + '_cosprawdz').value) {
		  case 'sprawdz_date':  if (!sprawdz_date(tmp_id,false)) {tmp_oki=false;} break;
		  case 'sprawdz_email': if (!sprawdz_email(tmp_id,false)) {tmp_oki=false;} break;
		  case 'sprawdz_kod':   if (!sprawdz_kod(tmp_id,false)) {tmp_oki=false;} break;
		  case 'sprawdz_nip': if (!sprawdz_nip(tmp_id,false)) {tmp_oki=false;} break;
    }
    
    if (document.getElementById(tmp_id + '_if_check')) {
      if (document.getElementById(document.getElementById(tmp_id + '_if_check').value).checked) {$sprawdz_pole=true;}
      else {$sprawdz_pole=false;}
    } else {$sprawdz_pole=true;}
    
    if (document.getElementById(tmp_id + '_wlwy')) {
		  if (document.getElementById(document.getElementById(tmp_id + '_wlwy').value).style.display != 'none') {flaga=true;}
		  else {flaga=false;}
		}
		else {flaga=true;}
		
		if (flaga && $sprawdz_pole) {		
		  if (!tmp_oki ) {
		    if (document.getElementById(pn_prefix + tmp_id + '_wymagane')) {
			    if (document.getElementById(pn_prefix + tmp_id + '_wymagane').value=='0') {
			      document.getElementById(tmp_id).className = 'form_1_notvalid';
            document.getElementById(pn_prefix + 'info_pytajnik_' + i).style.visibility = 'visible';
            document.getElementById(pn_prefix + tmp_id + '_sprawdz').value = '1';
            oki=false;
			    }
			  }
			  else {
			    if (document.getElementById(tmp_id).value!='') {
			      document.getElementById(tmp_id).className = 'form_1_notvalid';
            document.getElementById(pn_prefix + 'info_pytajnik_' + i).style.visibility = 'visible';
            document.getElementById(pn_prefix + tmp_id + '_sprawdz').value = '1';
            oki=false;
			    }			
			  }
      }
    }  
		i++;
  }
  return oki;
}

function sprawdz(form_name, akcja) {

	var i=0;
	var oki=true;
	var flaga=false;
	var on_s = false;
	var pn_prefix = '';
	if (document.getElementById(form_name + '_pnprefix')) {pn_prefix = document.getElementById(form_name + '_pnprefix').value;}
	
  while (document.getElementById(pn_prefix + 'pole_wymagane_' + i)) {
    tmp_id = document.getElementById(pn_prefix + 'pole_wymagane_' + i).value;
    
    if (document.getElementById(tmp_id + '_if_check')) {
      if (document.getElementById(document.getElementById(tmp_id + '_if_check').value).checked) {$sprawdz_pole=true;}
      else {$sprawdz_pole=false;}
    } else {$sprawdz_pole=true;}
    
		if (document.getElementById(tmp_id + '_wlwy')) {
		  if (document.getElementById(document.getElementById(tmp_id + '_wlwy').value).style.display != 'none') {flaga=true;}
		  else {flaga=false;}
		} else {flaga=true;}
		
		if (flaga && $sprawdz_pole) {
		  if (document.getElementById(tmp_id).value == '' || document.getElementById(pn_prefix  + tmp_id + '_wymagane').value == '1') {
		    document.getElementById(tmp_id).value = USER_LIB_POLE_WYMAGANE_JS;
		    document.getElementById(tmp_id).className = 'form_1_notok';
        document.getElementById(pn_prefix + tmp_id + '_wymagane').value = '1';
			  oki=false;
     	}
    }
		i++;
	}
  
	oki = polaSprawdzane(oki, pn_prefix);
  if (oki) {
    if (akcja) {zmiana_akcji(form_name, akcja);}
    else {zmiana_akcji(form_name);}
  }
}
 
function zmiana_akcji(form_name, akcja) {
	if (akcja){
	  tmp_form=document.forms[form_name];
	  var tmp_input = document.createElement('input');
	  tmp_input.type = 'hidden';
	  tmp_input.name = 'akcja';
	  tmp_input.id = 'akcja';
	  tmp_input.value = akcja;
	  tmp_input.style.display = 'none';
    tmp_form.appendChild(tmp_input);
  }
  if (okiGlobal){document.forms[form_name].submit();}
}

function ustaw_form_action(form_name, form_action) {
	document.forms[form_name].action = form_action;
}

function get_pole_file(idPola){
 	var i=0,ele_szu=0;
	while (document.forms[0].elements[i].name){
		if (idPola.name ==	document.forms[0].elements[i].name) {ele_szu = i-1; break;}
		i++;
	}
	var adres = '../editor/assetmanager/assetmanager_small.php?ffilter=image&id_pola=' + ele_szu;
	if (document.forms[0].elements[ele_szu].value != ''){
		var buf = document.forms[0].elements[ele_szu].value.slice(0,document.forms[0].elements[ele_szu].value.lastIndexOf('/'));
		adres = adres + '&bufor=' + buf;
	} 
	open(adres,"assetmanager","width=640,height=465,resizable=no,location=no,scrollbars=no");
 } 


//----------------------------------------------------------------------------//
//   Funkcje FieldTip - wyswietla informacje przy polach input - info_top     //
//----------------------------------------------------------------------------//

var isIE = (navigator.appName.toLowerCase().indexOf('internet explorer')+1?1:0);

var fieldtip = {
	leftPos : 0,  /* used for the tip-field offset left */
	topPos : -4, /* used for the tip-field offset top */
	tipClass : 'hint', /* assumed classname for the tip, used to _find_ it */
	activeTip : null, /* used to store the active tip */
	get : function(parent) {
		for(var i = 0; i < parent.childNodes.length; i++){
			
			if(parent.childNodes[i].className && parent.childNodes[i].className.indexOf(this.tipClass) > -1 ){
				return parent.childNodes[i]; //found the tip, YAY!
			}//nope, keep looking then
		} 
		return null;// didn't find the tip, BORK!
	},
	show : function(t){
		var _fieldTop = t.offsetTop;
		var _fieldLeft = t.offsetLeft;

		var _y = _fieldTop;
		var _x = _fieldLeft;

		this.activeTip = this.get(t.parentNode);
		var _tipHeight = this.activeTip.offsetHeight;

		var _tipCanvas = document.getElementsByTagName((document.compatMode && document.compatMode == "CSS1Compat") ? "html" : "body")[0];
		var _canvWidth = (_tipCanvas.clientWidth) ? _tipCanvas + _tipCanvas.scrollLeft : window.innerWidth + window.pageXOffset;
		var _canvHeight = (window.innerHeight) ? window.innerHeight + window.pageYOffset : _tipCanvas.clientHeight + _tipCanvas.scrollTop;

		//this.activeTip.style.width = ((this.activeTip.max_width) && (this.activeTip.offsetWidth > this.activeTip.max_width)) ? this.max_width + "px" : "auto";
		
		this.activeTip.style.left = (_x + this.leftPos) + "px";
		this.activeTip.style.top = (_y + this.topPos - _tipHeight) + "px";

		if (isIE) {this.activeTip.style.left = "0px";}

		/* check canvas bounds */
		if( _x + this.activeTip.offsetWidth > _canvWidth ){this.activeTip.style.left = (_canvWidth - this.activeTip.offsetWidth) + "px";}
		if( _y + this.activeTip.offsetHeight > _canvHeight ){this.activeTip.style.top = (_canvHeight - this.activeTip.offsetHeight) + "px";}
		this.activeTip.style.visibility = "visible";
	},
	hide : function(){
		if(this.activeTip != null){
			this.activeTip.style.visibility = "hidden";
			this.activeTip = null;
		}
	}
}

//----------------------------------------------------------------------------//

// ]]> -->
