<!-- 
/* javascript CMS */

function SprawdzNazwe(id,lang,submit_value) {
	$("checkResult").down('div').innerHTML = "Trwa weryfikacja nazwy...";
	
	unhideByID('checkResult');
	
	var req = mint.Request();
    req.AddParam("noheader",'1');
    req.AddParam('dzial',$("dzial_id").value);
    req.AddParam('parent',$("menu_rodzic").value);
    if($("_adres")!=null && $("_adres").checked==false)
    {
    	req.AddParam('nazwa',$("menu_adres").value);
    }
    else
    {
    	req.AddParam('nazwa',$("menu_nazwa").value);	
    }
    req.AddParam('id',id);
    req.AddParam('lang',lang);
    
    req.OnSuccess = function() {
    	var text = this.responseText;
    	$("checkResult").down('div').innerHTML = text.replace(/ _err._/,'');
    	if(text.match('_err0_')!=null) {
    		if(submit_value!=null)
    		{
    			$("submit_button").value=submit_value;
    		}
    		$("ustawienia").submit();
    	}
    }
    req.Send("administracja/check_name.php");
}

function SprawdzNazweKopiowanie(langs,submit_value) {
	$('names_check_failed').value='false';
	var req = new Array();
	var group = mint.RequestGroup();
	var lang = '';
	for(i=0;i<langs.length;i++)
	{
		lang = langs[i];
		$("checkResult_"+lang).down('div').innerHTML = "Trwa weryfikacja nazwy...";
		unhideByID('checkResult_'+lang);
		req[i] = mint.Request();
		req[i].AddParam("noheader",'1');
		req[i].AddParam('dzial',$("dzial_id").value);
		req[i].AddParam('parent',$("menu_rodzic").value);
		req[i].AddParam('id','new');
		req[i].AddParam('lang',lang);
		req[i].AddParam('nazwa',$(lang).value);
		req[i].OnSuccess = function() {
			var tmp;
			for(var i = 0; i < this.params.length; ++i) {
				if(this.params[i].name == 'lang') {
					tmp = this.params[i].value;
				}
			}
			var text = this.responseText;
			$("checkResult_"+tmp).down('div').innerHTML = text.replace(/ _err._/,'');
			if(text.match('_err0_')==null) {
				$('names_check_failed').value='true';
			}
		}
		group.Add(req[i]);
	}
	group.OnDone = function() {
		if($('names_check_failed').value!='true')
		{
			if(submit_value!=null)
			{
				$("submit_button").value=submit_value;
			}
			$("ustawienia").submit();
		}
	}
	for(i=0;i<langs.length;i++)
	{
		req[i].Send("administracja/check_name.php");
	}
}

function sprawdzUpload(nazwa,filtr)
{
	if(nazwa=="")
	{
		alert("Nie wybrałeś pliku!");
		return false;
	}
	if(nazwa.match(filtr))
	{
		return true;
	}
	else
	{
		alert("Nie można dodawać plików tego typu");
	}
	return false;
}

function changeLang(url) {
	box = document.getElementById("lang");
	destination = box.options[box.selectedIndex].value;
	if (destination) location.href = url+"lang=" + destination;
}
function popup(URL,width,height,param) {
	day = new Date();
	id = day.getTime();
	if(param==null)
	{
		param = "";
	}
	eval("page" + id + " = window.open('" + URL + param + "', '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=" + width + ",height=" + height + "');");
}

function clearParent(text)
{
	document.ustawienia.menu_rodzic.value=0;
	document.ustawienia.menu_rodzic_nazwa.value=text;
}
function wstawLinkDoFCK(nazwa,url) {
		var FCK = window.opener.FCK;
		var variable = "<a href=\""+url+"\">"+nazwa+"</a> ";
		FCK.Focus();
        FCK.InsertHtml(variable);
        window.close();
}
function wstawLink(nazwa,url) {
		var field = window.opener.document.getElementById(nazwa);
		field.value=url;
        window.close();
}

function wstawDoFCK(text) {
		var FCK = window.opener.FCK;
		var variable = text;
		FCK.Focus();
        FCK.InsertHtml(variable);
        window.close();
}

function zaznacz(id,check) {
	var element = document.getElementById(id);
	element.checked = check;
	return false;
}

function sprawdzNazwe(field_name,field,alert_text)
{
	var nazwa = document.getElementById(field_name);
	if(nazwa.value=="")
	{
		alert("'"+field+"'"+alert_text);
		return false;
	}
	return true;
}
function zaznaczWszystkie(nazwa)
{
	i=0;
	while(document.getElementById(nazwa+i) != null)
	{
		document.getElementById(nazwa+i).checked=!document.getElementById(nazwa+i).checked;
		i++;
	}
}

function zmienStan(id)
{
	toggleVisibilityById(id);
	var value;
	if (document.getElementById(id).style.display == '') {
		value = 'visible';
	} else {
		value = 'hidden';
	}
	ustawCiastko('adm_sect_vis_'+id,value,'/')
	return false;
}

function ustawCiastko(name, value, path, expire) {
 document.cookie = name + "=" + escape(value)
 + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()))
 + ((path == null) ? "" : ("; path=" + path))
}

function checkboxcheck(field,check)
{
	var te = document.getElementById(field);
	var ch = document.getElementById(check);
	if(te.value!='')
	{
		ch.checked=false;
	}
	else
	{
		ch.checked=true;
	}
}

function toggle_chbox (var_name,duplikacja)
{
	if (!document.getElementById(var_name).checked)
	{
		document.getElementById(var_name).checked = '1';
		document.getElementById(var_name + '_img').src = 'i/checkbox_full.gif';
		if (duplikacja>0)
			document.getElementById(var_name + 'A_img').src = 'i/checkbox_full.gif';
	}
	else
	{
		document.getElementById(var_name).checked = false;
		document.getElementById(var_name + '_img').src = 'i/checkbox_empty.gif';
		if (duplikacja>0)
			document.getElementById(var_name + 'A_img').src = 'i/checkbox_empty.gif';
	}
}

function select(name,type)
{
	if(type==1)
	{
		var opt = document.getElementById(name).childNodes;
		for(var i = 0 ; i < opt.length ; i++)
		{
			if(opt[i].value!=null)
			{
				opt[i].selected=true;
			}
		}
	}
	else
	{
		var opt = document.getElementsByTagName('option');
		for(var i = 0 ; i < opt.length ; i++)
		{
			if(opt[i].getAttribute("name")==name)
			{
				opt[i].selected=true;
			}
		}
	}
}



function do_select(name)
{
	switch (name)
	{
		case 'groups':
			select('grupy',1);
			break;
		case 'public':
			select('public',2);
			break;
		case 'nonpublic':
			select('nonpublic',2);
			break;
	}
}

function czyZaznaczono(nazwa,komunikat)
{
	var tags = document.getElementsByTagName('input');
	for (var i = 0; i < tags.length; i++) {
		if(tags[i].getAttribute("name")==nazwa)
		{
				if(tags[i].checked)
				{
					return true;
				}
		}
	}
	if(komunikat!=null)
	{
		alert(komunikat);
	}
	return false;
}

function users_groups_perm(value) {
	if(value=='user')
	{
		document.getElementById('group_perm').style.display='none';
		document.getElementById('users_perm').style.display='';
	}
	else
	{
		document.getElementById('users_perm').style.display='none';
		document.getElementById('group_perm').style.display='';
	}
}

/* javascript CMS koniec */

/* javascript-WEBCUMULUS */

ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false

function setzakladka(nowa)
{
	zakladka_bak=zakladka;
	zakladka=nowa;
	var formularz;
	var formularz_bak;
	if(zakladka_bak==1) { formularz_bak = document.form1 }
		else if(zakladka_bak==2) { formularz_bak = document.form2 }
		else if(zakladka_bak==3)	{ formularz_bak = document.form3 }
	if(zakladka==1) { formularz = document.form1 }
		else if(zakladka==2) { formularz = document.form2 }
		else if(zakladka==3)	{ formularz = document.form3 }
	formularz.miasto_z.value=formularz_bak.miasto_z.value;
	formularz.w_kod_z.value=formularz_bak.w_kod_z.value;
	
	formularz.miasto_d.value=formularz_bak.miasto_d.value;
	formularz.w_kod_d.value=formularz_bak.w_kod_d.value;

	formularz.ile_dor.value=formularz_bak.ile_dor.value;
	formularz.ile_dzi.value=formularz_bak.ile_dzi.value;
	formularz.ile_nie.value=formularz_bak.ile_nie.value;
	formularz.ile_mlo.value=formularz_bak.ile_mlo.value;
	formularz.ile_sen.value=formularz_bak.ile_sen.value;
	
	formularz.ile_dor_text.value=formularz_bak.ile_dor_text.value;
	formularz.ile_dzi_text.value=formularz_bak.ile_dzi_text.value;
	formularz.ile_nie_text.value=formularz_bak.ile_nie_text.value;
	formularz.ile_mlo_text.value=formularz_bak.ile_mlo_text.value;
	formularz.ile_sen_text.value=formularz_bak.ile_sen_text.value;
	
	formularz.w_d.value=formularz_bak.w_d.value;
	formularz.w_m.value=formularz_bak.w_m.value;
	formularz.w_r.value=formularz_bak.w_r.value;
	formularz.p_d.value=formularz_bak.p_d.value;
	formularz.p_m.value=formularz_bak.p_m.value;
	formularz.p_r.value=formularz_bak.p_r.value;
}

function ukryjWyniki(zostaw)
{
	var show = 'SearchResultsOption'+zostaw;
	var tags = document.getElementsByTagName('div');
	for (var i = 0; i < tags.length; i++) {
		if(tags[i].getAttribute("name")=='SearchResultsOption')
		{
			if(tags[i].id!=show)
			{
				hideByID(tags[i].id);
			}
		}
	}
	unhideByID('unhideResultsButton');
	unhideByID(show);
	return false;
}
function odkryjWyniki()
{
	var tags = document.getElementsByTagName('div');
	for (var i = 0; i < tags.length; i++) {
		if(tags[i].getAttribute("name")=='SearchResultsOption')
		{
				unhideByID(tags[i].id);
		}
	}
	hideByID('unhideResultsButton');
	return false;
}

function getSelectedRadio(name)
{
	var tags = document.getElementsByTagName('input');
	for (var i = 0; i < tags.length; i++) {
		if(tags[i].getAttribute("name")==name)
		{
			if (tags[i].checked) {
				return tags[i].value;
			}
		}
	}
	return '';
}

function preload(imgObj,imgSrc){
    eval(imgObj+' = new Image()')
    eval(imgObj+'.src = "'+imgSrc+'"')}

function none(){}


//E-MAILS
function secret(nr) {
switch (nr) {
   case 1: var array=[98,105,117,114,111,64,105,99,108,99,46,112,108]; break; //biur
   case 2: var array=[115,122,107,111,108,101,110,105,97,64,105,99,108,99,46,112,108]; break; //szkoleni
   default: var array=[98,105,117,114,111,64,105,99,108,99,46,112,108]; break; //biur
}
var encrypted='' 
for (var i=0; i<array.length; i++)
encrypted+=String.fromCharCode(array[i])
document.write('<a href="mailto:'+encrypted+'">'+encrypted+'</a>')
}


// DRUKUJ
function drukuj(){
if (!window.print){
alert("Musisz mieć NS4.x lub IE5,\naby użyć przycisku drukowania!")
return
}
window.print()
window.close()
//history.go(-1)
}


function openWin (path,Xsiz,Ysiz,scrBar) {
	var przed = "";
	if (!(Xsiz > 0)) {
		Xsiz = 460;
		przed = "zoom.php?path=";
	}
	if (!(Ysiz > 0)) { Ysiz = 350; }
	if (scrBar == "") { scrBar = "no"; }

	window.open(przed+path, "fotozoom", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars="+scrBar+",resizable=yes,fullscreen=no,channelmode=no,width="+Xsiz+",height="+Ysiz+",top=10,left=10");
	void(0);
}

function openOp(cOp) {
	on = (cOp < 10)?"0"+cOp:cOp;
	openWin ("/mm/opinie/"+on+".gif");
	return false;
}
			
// OKNO
function okno(url) {
    window.open( url, 'Okno', 'width=720,height=600,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=1');
}
function oknoBar(url) {
    window.open( url, 'Okno', 'width=720,height=600,toolbar=1,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=1');
}

//  PODMIANA WARSTW

 function toggle_fold(nr,ilosc)  { 
  for (i=1; i<ilosc+1; i++){ eval ("f" + i + ".style.display = 'none'"); }
	eval("f" + nr + ".style.display = ''");
	eval("f" + nr + ".style.position.top = '100'");	
	}
	
 function toggle_div(nr,ilosc)  { 
  for (i=1; i<ilosc+1; i++){ eval ("d" + i + ".style.display = 'none'"); }
	eval("d" + nr + ".style.display = ''");
	eval("d" + nr + ".style.position.top = '100'");	
	}
	
function toggle_div2(nr,ilosc) {
  for (i=1; i<ilosc+1; i++){
			eval("document.nd" + i + ".src = nd" + i + "_off.src");
			eval ("d" + i + ".style.display = 'none'");}
	eval("d" + nr + ".style.display = ''");
  eval("document.nd" + nr + ".src = nd" + nr + "_on.src");
}

 function toggle_none(nr,ilosc)  { 
	window.setTimeout("toggle_div("+ nr +","+ilosc+")",2000);
	}
// LOSOWA PODMIAN ZDJEC W NAGLOWKU

var time = 10000;
function Podmiana() {
  var nr = Math.floor(Math.random() * images) + 1;
	document.photo.src = eval("photo0"+nr+".src");
	window.setTimeout('Podmiana()',time);}

// MAIL

function msg() {
document.mailer.action = "mailto:" 
mailtoandsubject = ((document.mailer.mailtoperson.options[document.mailer.mailtoperson.selectedIndex].value) + '?subject=' + document.mailer.subject.value);
}

// STYLE MENU
function getObj(id){
  if (document.all) obj = eval ('document.all.' + id);
  else obj = document.getElementById(id);
  return obj;
	}

function setStyle(item,style){
  obj = getObj(item + '_A');  obj.className = style;
  obj = getObj(item + '_TD'); obj.className = style;
	}

//FORMULARZE
function ustawPole(nazwa,wartosc){
	if(pole = document.getElementById(nazwa))
	{
		pole.value=wartosc;
		return true;
	}
}

function submitForm(nazwa)
{
	document.wyszukaj_wiecej.submit();
}

//PODMIANA GALERII
function galeria(content){
gallery_content = content;
if (iedom) cross_scroll.style.left=0
	 else ns_scroll.left=0
actualwidth=''
fillup() 
}

// AUTOMATYCZNA PREZENTACJA ZDJEC

function openImage(name,width,height,text){
var autoclose = true
var title =  "Galeria zdjęć"
winW = (ns4)? window.innerWidth-16 : document.body.offsetWidth-20
winH = (ns4)? window.innerHeight : document.body.offsetHeight
var windowW=width+150
var windowH=height+160
var windowX = (winW-windowW)/2
var windowY = (winH-windowH)/2

    NFW = window.open("","popFrameless","width="+windowW+",height="+windowH)     
    NFW.blur()
    window.focus()       
    NFW.resizeTo(windowW,windowH)
    NFW.moveTo(windowX,windowY)
    var frameString=""+
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\""+
"\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"+
"<html><head><title>"+title+"</title>"+
"<meta http-equiv=Content-Type content=\"text/html; charset=iso-8859-2\">"+
"<meta name=\"language\" content=\"pl\" />"+
"<meta name=author content=\"Webcumulus  http://www.webcumulus.pl e-mail:biuro@webcumulus.pl\">"+
"<link rel=\"stylesheet\" href=\"/css/s.css\" type=\"text/css\" media=\"screen\" />"+
"</head><body class=galeria><br /><br /><br /><div class=center>"+
"<img src=photo/"+name+".jpg width="+width+" height="+height+" hspace=0 vspace=10 border=1><dd>"+
text+"<div id=\"Navigation\">&laquo;&nbsp;<a href=\"javascript:void(window.close())\">zamknij</a></div></body></html>"
    NFW.document.open();
    NFW.document.write(frameString)
    NFW.document.close()
  
  NFW.focus()   
  if (autoclose){
    window.onunload = function(){NFW.close()}
  }
}

function toggleVisibilityById(id) {
	if (document.getElementById(id) == null) return false;
	if (document.getElementById(id).style.display == '') {
		document.getElementById(id).style.display = 'none';
	} else {
		document.getElementById(id).style.display = '';
	}
	return false;
}

function hideByID(id) {
	var el = document.getElementById(id);
	if(el!=null)
	{
		el.style.display = 'none';
	}
	return false;
}

function unhideByID(id) {
	var el = document.getElementById(id);
	if(el!=null)
	{
		el.style.display = '';
	}
	return false;
}

function hideElementsByName(t,id,setcookie) {
	var tags = document.getElementsByTagName(t);
	for (var i = 0; i < tags.length; i++) {
		if(tags[i].getAttribute("name")==id)
		{
				tags[i].style.display = 'none';
				if(setcookie!=null)
				{
					ustawCiastko('adm_sect_vis_'+tags[i].id,'hidden','/');
				}
		}
	}
	return false;
}

function unhideElementsByName(t,id,setcookie) {
	var tags = document.getElementsByTagName(t);
	for (var i = 0; i < tags.length; i++) {
		if(tags[i].getAttribute("name")==id)
		{
				tags[i].style.display = '';
				if(setcookie!=null)
				{
					ustawCiastko('adm_sect_vis_'+tags[i].id,'visible','/');
				}
		}
	}
	return false;
}


//DROP MENU

/***********************************************
* AnyLink Drop Down Menu- Š Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

	
var menuwidth='250px' //default menu width
var menubgcolor='lightyellow'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="no" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu

