<!-- <![CDATA[
var okiGlobal = true;

function usuwanie(newURL) {
	if (confirm('Czy napewno usunąć ?!')) {location.href=newURL;}
}

function operacja_zaz_odz(newURL,co) {
  var flaga=false;
  var i=0;
  var tmp_txt='';
  
	while (document.getElementById('zaznaczone_id_' + i)) {
		if (document.getElementById('zaznaczone_id_' + i).checked) {flaga=true; break;}
	  i++;
  }
	if (flaga) {
    if (co=='usun') {tmp_txt = 'Czy napewno usunąć ?!';}
    else if (co=='archiwum') {tmp_txt = 'Czy napewno przenieść zaznaczone do archiwum ?!';}
		if (confirm(tmp_txt)) {
		  document.forms[0].action = newURL;
		  document.forms[0].submit();
    }
  }
}

function nowe_okno(url,w,h) {
  new_window=window.open(url,'Nowe okno','left=50,top=20,width=' + w + 'height=' + h);
	if (window.focus) {new_window.focus();}
}

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_email_add(id_pola,wys_kom,id_i) {	
  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)) {
		var adres = "include/form_spr_mail.php?mail_value=" + document.getElementById(id_pola).value;
		advAJAX.get({ url: adres, onSuccess : function(obj) { 
			if (obj.responseText == 'true'){
				clear_form_style(id_pola);
				okiGlobal = true;
				document.getElementById("info_pytajnik_"+ (id_i + 1)).style.visibility = 'hidden';
				if (document.getElementById("activ_check_0") != null){
					okiGlobal = document.getElementById("activ_check_0").checked;
				} else {
					okiGlobal = true;
				}
				//clearTimeout();
			} else if (obj.responseText == 'false') {
				document.getElementById(id_pola).className = 'form_1_notvalid';
				document.getElementById("info_pytajnik_"+ id_i).style.visibility = 'hidden';
            	document.getElementById("info_pytajnik_"+ (id_i + 1)).style.visibility = 'visible';
            	document.getElementById(id_pola + '_sprawdz').value = '1';
			}
		}});
		document.getElementById("info_pytajnik_"+ id_i ).style.visibility = 'hidden';
		document.getElementById("info_pytajnik_"+ (id_i + 1)).style.visibility = 'hidden';
		okiGlobal = false;
		return true;
	} else {
    	if (wys_kom) {alert('"' + document.getElementById(id_pola).value + USER_LIB_ZLE_MAIL_JS);}
    	return false;
  	}
}

function sprawdz_pass(ar_pass) {
	//alert('sdf');
	if (ar_pass != '' && ar_pass.length >= 2 ) {
		if (ar_pass[ar_pass.length - 2].value == ar_pass[ar_pass.length - 1].value) {return true;}
	  	//if (ar_pass[0].value == ar_pass[1].value) {return true;}
	  	else {return false;}
	}
	else {return true;}
	
}

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 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);}
  }
	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) {
	if(document.getElementById(tmp_id + '_wymagane')) {
	  if(document.getElementById(tmp_id + '_wymagane').value == 1) {
	    document.getElementById(tmp_id).value="";
		  document.getElementById(tmp_id).className = 'form_1';
	    document.getElementById(tmp_id + '_wymagane').value = '0';
    }
  }
	if(document.getElementById(tmp_id + '_sprawdz')) {
	  if(document.getElementById(tmp_id + '_sprawdz').value == 1) {
		  document.getElementById(tmp_id).className = 'form_1';
	    document.getElementById(tmp_id + '_sprawdz').value = '0';
		if (document.getElementById(tmp_id).type == 'password') {
			 document.getElementById(tmp_id).value="";
		 }
    }
  }
}  

function polaSprawdzane(oki, ar_pass) {
	var i=0;
  var tmp_oki=true;
  var flaga=false;
  var flaga_pass = true;
  while (document.getElementById('pole_sprawdzane_' + i)) {
    tmp_oki=true;
		tmp_id = document.getElementById('pole_sprawdzane_' + i).value;
		switch (document.getElementById(tmp_id + '_cosprawdz').value) {
		  case 'sprawdz_pass':  if (!sprawdz_pass(ar_pass,false)){tmp_oki=false;} break;
		  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_email_add':  if (!sprawdz_email(tmp_id,false)){tmp_oki=false;} break;
		  case 'sprawdz_email_add': if (!sprawdz_email_add(tmp_id,false,i)){tmp_oki=false;} break;
    }
    
    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) {		
		  if (!tmp_oki ) {
		    if (document.getElementById(tmp_id + '_wymagane')) {
			    if (document.getElementById(tmp_id + '_wymagane').value=='0') {
			      	document.getElementById(tmp_id).className = 'form_1_notvalid';
            		document.getElementById("info_pytajnik_"+i).style.visibility = 'visible';
            		document.getElementById(tmp_id + '_sprawdz').value = '1';
            		oki=false;
			    }
			  }
			  else {
			    if (document.getElementById(tmp_id).value!='') {
			      	document.getElementById(tmp_id).className = 'form_1_notvalid';
            		document.getElementById("info_pytajnik_"+i).style.visibility = 'visible';
            		document.getElementById(tmp_id + '_sprawdz').value = '1';
            		oki=false;
			    }			
			  }
      }
    }  
		i++;
  }
  return oki;
}

function sprawdz(form_name, akcja) {
	//
	var i=0;
	var ap=0;
	var oki=true;
	var flaga=false;
	var ar_pass = new Array();
	var on_s = false;
  while (document.getElementById('pole_wymagane_' + i)) {
		tmp_id = document.getElementById('pole_wymagane_' + i).value;
	
		if (document.getElementById(tmp_id).type == 'password') {ar_pass[ap]=document.getElementById(tmp_id); ap++; }
				
		
		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) {
      		if (document.getElementById(tmp_id).value == '' || document.getElementById(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(tmp_id + '_wymagane').value = '1';
			  	oki=false;
      		}
    	}
		i++;
	}

	oki = polaSprawdzane(oki, ar_pass);
  	if (oki ) { 
		  if (akcja) {setTimeout("zmiana_akcji('" + form_name + "', '" + akcja + "')", 1000);}
		  else {setTimeout("zmiana_akcji('" + form_name + "')", 1000);}
	 }
}
 
function zmiana_akcji(form_name, akcja, sprawdz, input_id, sprawdz_kod_p, input_kod_id) {
	
	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_form.appendChild(tmp_input); 
  }
	if (sprawdz) {
		if (sprawdz=='email') {
			if (sprawdz_email(input_id)) {
				if (sprawdz_kod_p) {
					if (sprawdz_kod(input_kod_id)) {
						document.forms[form_name].submit();		
					} else {
						alert('Podany kod_pocztowy jest nieprawidłowy');
						document.getElementById(input_kod_id).focus();
					}
				} else
				if (sprawdz_kod_p && sprawdz_kod(input_kod_id)) { 
					document.forms[form_name].submit();
				} else if (!sprawdz_kod_p) {document.forms[form_name].submit();}
			} else {
				alert('Podany adres e-mail jest nieprawidłowy');
				document.getElementById(input_id).focus();
			}		
		}		
	} else 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");
 } 

function zaz_odz() {
  var i=0;
	var ch=true;
  if (document.getElementById('zaznaczone_id_'+i)) {
    if (document.getElementById('zaznaczone_id_'+i).checked==true) {ch=false;}
  }
  while (document.getElementById('zaznaczone_id_'+i)) {
		document.getElementById('zaznaczone_id_'+i).checked=ch;
		i++;
	}
}

function wl_wy_jezyk(this_check) {
  var i=0;
  var wartosc = '';
	if (this_check.checked) {
	  if (!this.opera && (navigator.appName.indexOf('Microsoft') != -1)) {wartosc='block';}
	  else {wartosc='table-row';}
	}
	else {wartosc='none';}
	
	while (document.getElementById(this_check.value + '_' + i)) {
		document.getElementById(this_check.value + '_' + i).style.display = wartosc;
	  i++;
  }
}

function wl_wy_jezyk_onload() {
  var i=0;
  var j=0;
  var wartosc='none';  
	while (document.getElementById('activ_' + i)) {
		if (!document.getElementById('activ_' + i).checked) {
	    j=0;
			while (document.getElementById(document.getElementById('activ_' + i).value + '_' + j)) {
				document.getElementById(document.getElementById('activ_' + i).value + '_' + j).style.display = wartosc;
	      j++;
      }
    }
    i++;
  }
}



//----------------------------------------------------------------------------//
//   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;
		}
	}
}

//----------------------------------------------------------------------------//

// ]]> -->