function debug(obj) { var d = ''; for (var i in obj) d += i+' : '+obj[i]+"\r\n"; alert(d); } /* math */ function inarray(co, kde) { var len = kde.length; var rslt = -1; var i=0; while ( i < len && rslt==-1 ) { if (kde[i] == co) rslt = i; i++; } // return rslt!=-1 ? rslt : false; return rslt!=-1 ? true : false; } function arraysearch(co, kde) { var len = kde.length; var rslt = -1; var i=0; while ( i < len && rslt==-1 ) { if (kde[i] == co) rslt = i; i++; } return rslt!=-1 ? rslt : false; // return rslt!=-1 ? true : false; } function round(cislo, prec) { var zaklad = Math.floor(cislo); if (zaklad == cislo) return zaklad; var desmista = cislo - zaklad; var exp = Math.pow(10, prec); desmista = Math.round(desmista*exp) / exp; return zaklad + desmista; } /* bloky */ function element(name) { if (document.getElementById) return document.getElementById(name); if (document.all) return document.all[name]; if (document.layers) return document.layers[name]; return false; } function givefocus() { var blok = element('takefocus'); if (blok) blok.focus(); return true; } function getElementsByClassName(clsName) { var i, matches=new Array(); var els=document.getElementsByTagName('*'); for(i=0; i < els.length; i++) { if(els.item(i).className==clsName) matches.push(els.item(i)); } return matches; } function hide(name) { var blok = element(name); if (!blok) return false; blok.style.display = 'none'; return true; } function show(name) { var blok = element(name); if (!blok) return false; blok.style.display = 'block'; return true; } function showhide(name) { var blok = element(name); if (!blok) return false; var stav = blok.style.display; if (stav == 'block') blok.style.display = 'none'; else blok.style.display = 'block'; if (false) return true; // workaround pro warning v mozille } function mailto(name, domain) { if (name == '' || domain == undefined || domain == '') return ''; return(document.location.href="mailto:"+name+"@"+domain); } function emailsplit(name, domain) { if (name == '' || domain == undefined || domain == '') return ''; return name+'@'+domain; } function emaillink(name, domain) { document.write(""+name+"@"+domain+""); } function catchkeypress(e) { var pressedKey = ("undefined" == typeof (e)) ? event.keyCode : e.keyCode ; /* if (pressedKey == "27") { // ASCII code of the ESC key alert('Zmackls ESC. Proc?'); } */ return true; } /* windows */ function OpenWindow(url, name) { return window.open(url, name); } function openwindow(url, name) { return OpenWindow(url, name); } function closeandredirect(url) { window.opener.document.location.href = url; window.close(); return true; } function redirect(url) { document.location.href = url; return true; } function delconfirm() { return window.confirm('Opravdu smazat?'); } function openwin(url) { return !window.open(url, '_blank'); } /* nejede, hazi rekurzi v mozille function confirm(zprava) { if (zprava == undefined) zprava = 'Jste si jist?'; return window.confirm(zprava); } */ function doconfirm() { return window.confirm('Jste si jist?'); } function registerevent(id, event, func) { var el = element(id); if (el) { if (event=='onclick') el.onclick = func; if (event=='onchange') el.onchange = func; if (event=='onfocus') el.onfocus = func; if (event=='onblur') el.onblur = func; if (event=='onmouseover') el.onmouseover = func; if (event=='onmouseout') el.onmouseout = func; if (event=='onsubmit') el.onsubmit = func; if (event=='onkeyup') el.onkeyup = func; return true; } return false; } var inits = new Array(givefocus); function registerinit(func) { if (!inarray(func, inits)) { inits[inits.length] = func; return true; } else return false; } function coreinit() { var len = inits.length; for(var i=0; i < len; i++) { inits[i].call(); } return true; } window.onload = coreinit; /* if (typeof(obj) != null) */