function zobraz (kod, textZobraz, textSkryj) { var prvek = document.getElementById (kod + 'Prvek'); var ovladac = document.getElementById (kod + 'Ovladac'); if (ovladac.className == 'zobraz') { ovladac.innerHTML = textSkryj; ovladac.className = 'skryj'; prvek.style.display = 'block'; } else { ovladac.innerHTML = textZobraz; ovladac.className = 'zobraz'; prvek.style.display = 'none'; } } var napoveda = function () { this.idZobrazeneNapovedy = ''; this.sirkaStranky = 960; this.okraje = 20; this.minimalniSirka = 200; this.paddingDivuSOkrajem = 22; var objekt = this; window.onscroll = function () { objekt.posun (); } window.onresize = function () { objekt.sirka (); } this.zobraz = function (id) { var napovedy = document.getElementsByTagName ('div'); for (var i = 0; i < napovedy.length; i++) if (napovedy[i] != null && (napovedy[i].className == 'napoveda' || napovedy[i].className == 'napoveda napovedaUObrazku')) napovedy[i].style.display = 'none'; if (id != null) { var divSNapovedou = document.getElementById (id); //osetreni, hlavne pro kategorieIdPridej, kde to je vzdy i kdyz se napoveda nepouziva if (divSNapovedou != null) { this.idZobrazeneNapovedy = id; divSNapovedou.style.display = 'block'; } else this.idZobrazeneNapovedy = ''; } else this.idZobrazeneNapovedy = ''; this.posun (); this.sirka (); return true; } this.posun = function () { if (this.idZobrazeneNapovedy != '') { var divSNapovedou = document.getElementById (this.idZobrazeneNapovedy); divSNapovedou.style.top = f_scrollTop () + this.okraje + 'px'; } return true; } this.sirka = function () { if (this.idZobrazeneNapovedy != '') { var divSNapovedou = document.getElementById (this.idZobrazeneNapovedy); var sirka = Math.floor (((f_clientWidth () - this.sirkaStranky) / 2) - (this.okraje * 2) - this.paddingDivuSOkrajem); if (sirka >= this.minimalniSirka) { divSNapovedou.style.position = 'absolute'; divSNapovedou.style.left = this.okraje + 'px'; divSNapovedou.style.width = sirka + 'px'; } else { divSNapovedou.style.position = ''; divSNapovedou.style.left = ''; divSNapovedou.style.width = ''; } } return true; } } var zaneprazdneno = function () { //this.pocetZobrazeni = 0; this.zaneprazdnenoDiv = document.createElement ('div'); this.zaneprazdnenoDiv.style.position = 'fixed'; this.zaneprazdnenoDiv.style.top = '50%'; this.zaneprazdnenoDiv.style.background = '#888 url(/adminGrafika/ajax-loader.gif) no-repeat center 40px'; this.zaneprazdnenoDiv.style.textAlign = 'left'; this.zaneprazdnenoDiv.style.width = '300px'; this.zaneprazdnenoDiv.style.height = '100px'; this.zaneprazdnenoDiv.style.border = '1px solid #000'; this.zaneprazdnenoDiv.style.color = '#fff'; this.zaneprazdnenoDiv.style.fontWeight = 'bold'; this.zaneprazdnenoDiv.style.opacity = '0.80'; this.zaneprazdnenoDiv.style.filter = 'alpha(opacity=80)'; this.zaneprazdnenoDiv.style._position = 'absolute'; this.zaneprazdnenoDiv.style._top = 'expression(0+body.scrollTop);'; this.zaneprazdnenoDiv.style.visibility = 'hidden'; var objekt = this; this.zaneprazdnenoDiv.onmouseover = function () { if (objekt.zaneprazdnenoDiv.style.top == '50%') objekt.zaneprazdnenoDiv.style.top = '30%'; else objekt.zaneprazdnenoDiv.style.top = '50%'; } document.body.appendChild(this.zaneprazdnenoDiv); this.zobraz = function () { //this.pocetZobrazeni++; //
{$texty->preloz ('ńĆekejte...')}
var scrolledX, scrolledY; if (self.pageYoffset) { scrolledX = self.pageXoffset; scrolledY = self.pageYoffset; } else if (document.documentElement && document.documentElement.scrollTop) { scrolledX = document.documentElement.scrollLeft; scrolledY = document.documentElement.scrollTop; } else if (document.body) { scrolledX = document.body.scrollLeft; scrolledY = document.body.scrollTop; } var centerX, centerY; if (self.innerHeight) { centerX = self.innerWidth; centerY = self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { centerX = document.documentElement.clientWidth; centerY = document.documentElement.clientHeight; } else if (document.body) { centerX = document.body.clientWidth; centerY = document.body.clientHeight; } var leftoffset = scrolledX + (centerX - this.zaneprazdnenoDiv.offsetWidth) / 2; var topoffset = scrolledY + (centerY - this.zaneprazdnenoDiv.offsetHeight) / 2; //this.zaneprazdnenoDiv.style.top = topoffset + 'px'; this.zaneprazdnenoDiv.style.left = leftoffset + 'px'; this.zaneprazdnenoDiv.style.visibility = 'visible'; } this.skryj = function () { //this.pocetZobrazeni--; //if (this.pocetZobrazeni == 0) this.zaneprazdnenoDiv.style.visibility = 'hidden'; // this.zaneprazdnenoDiv.parentNode.removeChild (this.zaneprazdnenoDiv); } } // function getElementsByName_iefix (tag, name) { // var elem = document.getElementsByTagName (tag); // var arr = new Array(); // for(i = 0, iarr = 0; i < elem.length; i++) { // att = elem[i].getAttribute("name"); // if(att == name) { // arr[iarr] = elem[i]; // iarr++; // } // } // return arr; // } /* * Copyright (C) 2008 Backplane Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** @fileoverview For browsers such as Firefox, that do not support IE's rather handy bonus functions insertAdjacentHTML, and insertAdjacentElement. */ /** Inserts an element into the DOM at a given location. This is an addon applied to Elements in the target environment. Nodes must be of compatible types in the target DOM, i.e. this will not be able to insert an XML Element into an HTML tree unless the underlying DOMs allow it. To mix incompatible DOMs, serialise the inserted node, and use insertAdjacentHTML @param {String} where One of beforeBegin, afterBegin, beforeEnd, or afterEnd @param {Node} parsedNode a node to insert into this element @addon */ function insertAdjacentElement(where,parsedNode) { switch (where) { case 'beforeBegin': this.parentNode.insertBefore(parsedNode,this); break; case 'afterBegin': this.insertBefore(parsedNode,this.firstChild); break; case 'beforeEnd': this.appendChild(parsedNode); break; case 'afterEnd': if (this.nextSibling) { this.parentNode.insertBefore(parsedNode,this.nextSibling); } else { this.parentNode.appendChild(parsedNode); } break; } } /** Inserts some markup into the DOM at a given location. This is an addon applied to Elements in the target environment. @param {String} where One of beforeBegin, afterBegin, beforeEnd, or afterEnd @param {String} htmlStr markup to insert into this element @addon */ function insertAdjacentHTML(where,htmlStr) { var r = this.ownerDocument.createRange(); r.setStartBefore(this); var parsedHTML = r.createContextualFragment(htmlStr); this.insertAdjacentElement(where,parsedHTML); } /** Inserts some text into the DOM at a given location, ignoring markup. This is an addon applied to Elements in the target environment. If parseable (or poorly-formed) markup is present in txtStr it will be escaped and inserted into the target element as text. @param {String} where One of beforeBegin, afterBegin, beforeEnd, or afterEnd @param {String} txtStr text to insert into this element @addon */ function insertAdjacentText(where,txtStr) { var parsedText = document.createTextNode(txtStr); this.insertAdjacentElement(where,parsedText); } //Add the functions to the HTMLElement prototype, if absent if(typeof HTMLElement!="undefined" && !HTMLElement.prototype.insertAdjacentElement) { HTMLElement.prototype.insertAdjacentElement = insertAdjacentElement; HTMLElement.prototype.insertAdjacentText = insertAdjacentText; HTMLElement.prototype.insertAdjacentHTML =insertAdjacentHTML; } //Add the functions to the Element prototype, if absent if(typeof Element!="undefined" && !Element.prototype.insertAdjacentElement) { Element.prototype.insertAdjacentElement = insertAdjacentElement; Element.prototype.insertAdjacentText = insertAdjacentText; Element.prototype.insertAdjacentHTML =insertAdjacentHTML; } // if (typeof HTMLElement != 'undefined') { // if (typeof HTMLElement.insertAdjacentHTML == 'undefined') { // HTMLElement.prototype.insertAdjacentElement = function (where, parsedNode) { // switch (where) { // case 'beforeBegin': // this.parentNode.insertBefore (parsedNode, this); // break; // case 'afterBegin': // this.insertBefore (parsedNode, this.firstChild); // break; // case 'beforeEnd': // this.appendChild (parsedNode); // break; // case 'afterEnd': // if (this.nextSibling) // this.parentNode.insertBefore (parsedNode, this.nextSibling); // else // this.parentNode.appendChild (parsedNode); // break; // } // }; // } // // if (typeof HTMLElement.insertAdjacentHTML == 'undefined') { // HTMLElement.prototype.insertAdjacentHTML = function (where, htmlStr) { // var r = this.ownerDocument.createRange (); // r.setStartBefore (this); // var parsedHTML = r.createContextualFragment (htmlStr); // this.insertAdjacentElement (where, parsedHTML); // }; // } // // if (typeof HTMLElement.insertAdjacentText == 'undefined') { // HTMLElement.prototype.insertAdjacentText = function (where, txtStr) { // var parsedText = document.createTextNode (txtStr); // this.insertAdjacentElement (where, parsedText); // }; // } // } // if (typeof HTMLElement!="undefined" && !HTMLElement.prototype.insertAdjacentElement) { // HTMLElement.prototype.insertAdjacentElement = function (where, parsedNode) { // switch (where) { // case 'beforeBegin': // this.parentNode.insertBefore (parsedNode, this); // break; // case 'afterBegin': // this.insertBefore (parsedNode, this.firstChild); // break; // case 'beforeEnd': // this.appendChild (parsedNode); // break; // case 'afterEnd': // if (this.nextSibling) // this.parentNode.insertBefore (parsedNode, this.nextSibling); // else // this.parentNode.appendChild (parsedNode); // break; // } // } // // HTMLElement.prototype.insertAdjacentHTML = function (where, htmlStr) { // var r = this.ownerDocument.createRange (); // r.setStartBefore (this); // var parsedHTML = r.createContextualFragment(htmlStr); // this.insertAdjacentElement (where, parsedHTML); // } // // // HTMLElement.prototype.insertAdjacentText = function (where, txtStr) { // var parsedText = document.createTextNode (txtStr) // this.insertAdjacentElement (where, parsedText) // } // } function vybraneOption (vyber) { var pole = new Array(); var pocitadlo = 0; for (var i = 0; i < vyber.length; i++) { if (vyber.options[i].selected) { pole[pocitadlo] = vyber.options[i].value; pocitadlo++; } } return pole; } function vsechnyOption (vyber) { var pole = new Array(); for (var i = 0; i < vyber.length; i++) pole[i] = vyber.options[i].value; return pole; } function doplnNulu (cislo) { if (cislo < 10) return '0' + cislo.toString (); else return cislo.toString (); } function f_clientWidth() { return f_filterResults ( window.innerWidth ? window.innerWidth : 0, document.documentElement ? document.documentElement.clientWidth : 0, document.body ? document.body.clientWidth : 0 ); } function f_clientHeight() { return f_filterResults ( window.innerHeight ? window.innerHeight : 0, document.documentElement ? document.documentElement.clientHeight : 0, document.body ? document.body.clientHeight : 0 ); } function f_scrollLeft() { return f_filterResults ( window.pageXOffset ? window.pageXOffset : 0, document.documentElement ? document.documentElement.scrollLeft : 0, document.body ? document.body.scrollLeft : 0 ); } function f_scrollTop() { return f_filterResults ( window.pageYOffset ? window.pageYOffset : 0, document.documentElement ? document.documentElement.scrollTop : 0, document.body ? document.body.scrollTop : 0 ); } function f_filterResults(n_win, n_docel, n_body) { var n_result = n_win ? n_win : 0; if (n_docel && (!n_result || (n_result > n_docel))) n_result = n_docel; return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result; } function rychlostPocitace () { var t0 = new Date(); for (var i = 0; i < 1000000; i++); var t1 = new Date(); return t1 - t0; } ////////////// // // absolutni pozice // http://www.codeproject.com/KB/scripting/dom-element-abs-pos.aspx // var __isIE = navigator.appVersion.match(/MSIE/); var __userAgent = navigator.userAgent; var __isFireFox = __userAgent.match(/firefox/i); var __isFireFoxOld = __isFireFox && (__userAgent.match(/firefox\/2./i) || __userAgent.match(/firefox\/1./i)); var __isFireFoxNew = __isFireFox && !__isFireFoxOld; function __parseBorderWidth(width) { var res = 0; if (typeof(width) == "string" && width != null && width != "" ) { var p = width.indexOf("px"); if (p >= 0) { res = parseInt(width.substring(0, p)); } else { //do not know how to calculate other //values (such as 0.5em or 0.1cm) correctly now //so just set the width to 1 pixel res = 1; } } return res; } //returns border width for some element function __getBorderWidth(element) { var res = new Object(); res.left = 0; res.top = 0; res.right = 0; res.bottom = 0; if (window.getComputedStyle) { //for Firefox var elStyle = window.getComputedStyle(element, null); res.left = parseInt(elStyle.borderLeftWidth.slice(0, -2)); res.top = parseInt(elStyle.borderTopWidth.slice(0, -2)); res.right = parseInt(elStyle.borderRightWidth.slice(0, -2)); res.bottom = parseInt(elStyle.borderBottomWidth.slice(0, -2)); } else { //for other browsers res.left = __parseBorderWidth(element.style.borderLeftWidth); res.top = __parseBorderWidth(element.style.borderTopWidth); res.right = __parseBorderWidth(element.style.borderRightWidth); res.bottom = __parseBorderWidth(element.style.borderBottomWidth); } return res; } //returns absolute position of some element within document function getElementAbsolutePos(element) { var res = new Object(); res.x = 0; res.y = 0; if (element !== null) { res.x = element.offsetLeft; res.y = element.offsetTop; var offsetParent = element.offsetParent; var parentNode = element.parentNode; var borderWidth = null; while (offsetParent != null) { res.x += offsetParent.offsetLeft; res.y += offsetParent.offsetTop; var parentTagName = offsetParent.tagName.toLowerCase(); if ((__isIE && parentTagName != "table") || (__isFireFoxNew && parentTagName == "td")) { borderWidth = __getBorderWidth(offsetParent); res.x += borderWidth.left; res.y += borderWidth.top; } if (offsetParent != document.body && offsetParent != document.documentElement) { res.x -= offsetParent.scrollLeft; res.y -= offsetParent.scrollTop; } //next lines are necessary to support FireFox problem with offsetParent if (!__isIE) { while (offsetParent != parentNode && parentNode !== null) { res.x -= parentNode.scrollLeft; res.y -= parentNode.scrollTop; if (__isFireFoxOld) { borderWidth = __getBorderWidth(parentNode); res.x += borderWidth.left; res.y += borderWidth.top; } parentNode = parentNode.parentNode; } } parentNode = offsetParent.parentNode; offsetParent = offsetParent.offsetParent; } } return res; } ////////////// // neni nutne pouzivat // // function nactiWindowScrollbarVelikosti () { // var i = document.createElement ('p'); // i.style.width = '100%'; // i.style.height = '200px'; // // var o = document.createElement ('div'); // o.style.position = 'absolute'; // o.style.top = '0px'; // o.style.left = '0px'; // o.style.visibility = 'hidden'; // o.style.width = '200px'; // o.style.height = '150px'; // o.style.overflow = 'hidden'; // o.appendChild (i); // // document.body.appendChild (o); // var w1 = i.offsetWidth; // var h1 = i.offsetHeight; // o.style.overflow = 'scroll'; // var w2 = i.offsetWidth; // var h2 = i.offsetHeight; // if (w1 == w2) // w2 = o.clientWidth; // if (h1 == h2) // h2 = o.clientWidth; // // document.body.removeChild (o); // // window.scrollbarWidth = w1 - w2; // window.scrollbarHeight = h1 - h2; // }