/*global HTTPRequest, escape, unescape, window, self, navigator, document, screen, clearTimeout, setTimeout, setInterval, XMLHttpRequest, ActiveXObject, _gat, _gaq, $, jQuery */ // przypisanie zmiennych globalnie uzywanych var oCGR, cGR, oG_OSA = oG_OSA || {}, sUrl = sUrl || oG_OSA.sUrl; // przypisanie podstawowych wlasnosci do oG_OSA (function () { var dl = document.location; if (!oG_OSA.debug) { oG_OSA.debug = 0; } if (!oG_OSA.pobranePliki) { oG_OSA.pobranePliki = []; } if (!oG_OSA.chmurki) { oG_OSA.chmurki = {}; } if (sUrl && !/^https?:/.test(sUrl)) { if ('https:' == document.location.protocol) { sUrl = "https://" + sUrl; } else { sUrl = "https://" + sUrl; } oG_OSA.sUrl = sUrl; } if (!oG_OSA.sUrl) { oG_OSA.sUrl = 'https://s.gratka.pl'; } oG_OSA.Url = dl.protocol + '//' + dl.hostname; // Przechwytywanie bledow skladni i czesci wykonania window.onerror = function (msg, url, line, column, errorObj) { var msg_excluded = [ 'Script error.', 'Script error', 'Błąd składni', '' ]; if (oG_OSA.debug) { return false; } if (typeof jQuery != "function" || oG_OSA.jserrors > 5) { return false; } if (msg_excluded.includes(msg)) { return false; } var loc = window.location; oG_OSA.jserrors = oG_OSA.jserrors || 0; if (Math.random() < 0.1) { var data = { line: line, column: column, app: oG_OSA.projekt || oG_OSA.serwis || null, domain: loc.hostname, request_id: oG_OSA.requestId || null }; if (typeof errorObj == "object" && errorObj != null) { data.stack = errorObj.stack; } oG_OSA.jserrors++; obj = {msg: msg, url: loc.href, data: JSON.stringify(data)}; if (url != obj.url) { obj.file = url; } jQuery.post("/_event/jserror/", obj); } return false; }; })(); if (typeof Object.create !== 'function') { Object.create = function (o) { function F() {} F.prototype = o; return new F(); }; } /** * Umozliwia zbudowanie prototypu (rozszerzenia) jezeli on nie istnieje */ Function.prototype.rozszerz = function (nazwa, fn) { if (!this.prototype[nazwa]) { this.prototype[nazwa] = fn; } }; /** * Rozszerzenie Function o metode bind - ECMAScript 262 - 5 definiuje natywna metode do zmiany kontekstu wywolania * * to rozszerzenie bedzie utworzone jezeli nie ma definicji natywnej */ Function.rozszerz('bind', function (context) { var that = this, slice = Array.prototype.slice, args = slice.call(arguments, 1); return function () { return that.apply(context, args.concat(slice.call(arguments))); }; }); /** * Rozszerzenie obiektu String o metode trim (usuwanie bialych znakow) * * @memberOf String * @return string */ String.rozszerz('trim', function () { return this.replace(/(^[\s\xA0]+|[\s\xA0]+$)/g, ''); }); /** * Redukuje w tekscie wszystkie biale znaki do jednej spacji i usuwa biale znaki z poczatku tekstu i konca tekstu * * @memberOf String * @return string */ String.rozszerz('trimToSpace', function () { return this.replace(/(\s+)/g, ' ').trim(); }); /** * Rozszerzenie obiektu String o metode toObject (zamienia string JSON na obiekt) * * @memberOf String * @return string */ String.rozszerz('toObject', function () { return eval('(' + this + ')'); }); /** * Rozszerzenie obiektu String o metode ucfirst - zwraca string o pierwszym znaku z duzej litery * * @memberOf String * @return string */ String.rozszerz('ucfirst', function () { var f = this.charAt(0).toUpperCase(); return f + this.substr(1); }); /** * Sprawdza czy podana wartosc o jest tablica Array * * @param {MIX} o - wartosc do sprawdzenia */ if (!Array.isArray) { Array.isArray = function (o) { return Object.prototype.toString.call(o) === '[object Array]'; }; } /** * Zwraca pierwszy (najmniejszy) indeks elementu w tablicy rownego podanej wartosci * lub -1, gdy nie znaleziono takiego elementu. * Zaimplementowana w: JavaScript 1.6 (Gecko 1.8b2 i wyzsze) * * @param {Object} vItem Element do znalezienia w tablicy. * @param {Number} iStart Indeks od ktorego ma zaczac sie wyszukiwanie. Domyslnie 0. */ Array.rozszerz('indexOf', function (vItem, iStart) { var i = 0, ln = this.length; iStart = iStart || 0; for (i = iStart; i < ln; i += 1) { if (this[i] === vItem) { return i; } } return -1; }); /** * Zwraca ostatni indeks, pod ktorym podany element moze byc znaleziony w tablicy, * lub -1 jesli nie jest obecny. * Tablica jest przeszukiwana od konca, zaczynajac od indeksu iStart domyslnie jest to dlugosc tablicy * Zaimplementowana w: JavaScript 1.6 (Gecko 1.8b2 i wyzsze) * * @param {Object} vItem Element do znalezienia w tablicy. * @param {Number} iStart Indeks od ktorego ma zostac rozpoczlte wyszukiwanie od tylu. * Domyslnie jest to dlugosc tablicy */ Array.rozszerz('lastIndexOf', function (vItem, iStart) { if (iStart === null || iStart >= this.length) { iStart = this.length - 1; } for (var i = iStart; i >= 0; i -= 1) { if (this[i] === vItem) { return i; } } return -1; }); Array.rozszerz('copy', function () { return [].concat(this); }); /** * Sprawdza czy dana element znajduje sie w tablicy * * @param {Object} vItem */ Array.rozszerz('contains', function (vItem) { return this.indexOf(vItem) > -1; }); /** * Podstawowa funkcja wywolujaca rozszerzenia konstruktora cGR * Pierwszy parametr może być tablicą która ma dwa pola: nazwę funkcji oraz wersję */ function GR() { var tb = Array.prototype.slice.call(arguments), fn = tb.shift(), statyczne, plik, wersja = '', rge, spl; try { if (!oCGR) { oCGR = new cGR(); } // warunek bazowany na https://javascript.crockford.com/remedial.html if (typeof fn === 'object' && fn && fn instanceof Array && fn.length == 2) { wersja = (fn[0].indexOf("?") + 1 ? "&" : "?") + fn[1]; fn = fn[0]; } if ("" !== fn && "function" === typeof oCGR[fn]) { return oCGR[fn].apply(oCGR, tb); } rge = fn.match(/(o|os|p)([A-Z][a-z0-9]+)/); spl = fn.split("_"); statyczne = rge ? rge[1] : spl[0]; plik = rge ? rge[2] : spl[1]; if (/o|os|p/.test(statyczne)) { GR('zaladujPlikJS', sUrl + ('os' !== statyczne ? '/' + statyczne : '') + '/js/cgr/' + plik.toLowerCase() + '.js' + wersja, "head", function () { if ("" !== fn && "function" === typeof oCGR[fn]) { return oCGR[fn].apply(oCGR, tb); } }); } } catch (ex) { } } (function () { if ('undefined' === typeof jQuery) { return; } GR.DOM = jQuery; })(); // Podstawowy obiekt obslugi zdarzen var Zdarzenia = { zaczep: function (cel, typ, fn) { if (!cel || cel.nodeType === 3 || cel.nodeType === 8) { return; } if (cel.addEventListener) { cel.addEventListener(typ, fn, false); } else if (cel.attachEvent) { cel.attachEvent("on" + typ, fn); } else { cel["on" + typ] = fn; } }, odczep: function (cel, typ, fn) { if (cel.nodeType === 3 || cel.nodeType === 8) { return; } if (cel.removeEventListener) { cel.removeEventListener(typ, fn, false); } else if (cel.detachEvent) { cel.detachEvent("on" + typ, fn); } else { cel["on" + typ] = null; } }, formatuj: function (oZd) { var body = document.body, doc = document.documentElement, orginal = oZd; if (!oZd.target) { oZd.target = oZd.srcElement || document; } // jezeli target jest textnode (safari) if (oZd.target.nodeType === 3) { oZd.target = oZd.target.parentNode; } if (!oZd.relatedTarget && oZd.fromElement) { oZd.relatedTarget = oZd.fromElement === oZd.target ? oZd.toElement : oZd.fromElement; } if (oZd.pageX == null && oZd.clientX != null) { oZd.pageX = oZd.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); oZd.pageY = oZd.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); } try { if (!oZd.which && ((oZd.charCode || oZd.charCode === 0) ? oZd.charCode : oZd.keyCode)) { oZd.which = oZd.charCode || oZd.keyCode; } } catch (ex) {} if (!oZd.which && oZd.button !== undefined) { oZd.which = (oZd.button & 1 ? 1 : (oZd.button & 2 ? 3 : (oZd.button & 4 ? 2 : 0))); } if (!oZd.metaKey && oZd.ctrlKey) { oZd.metaKey = oZd.ctrlKey; } if (GR('czyIE')) { oZd.charCode = oZd.keyCode || 0; oZd.eventPhase = 2; oZd.isChar = (oZd.charCode > 0); oZd.preventDefault = function () { oZd.returnValue = false; }; oZd.stopPropagation = function () { oZd.cancelBubble = true; }; oZd.timeStamp = (new Date()).getTime(); } return oZd; }, anuluj: function (oZd) { oZd.preventDefault(); oZd.stopPropagation(); return false; }, odpal: function(cel, typ) { var evt; if (document.createEvent) { // dla wszystkich przegladarek oprocz IE przed 9 evt = document.createEvent("HTMLEvents"); evt.initEvent(typ, true, true ); return !cel.dispatchEvent(evt); } else if (document.createEventObject) { // dla IE przed 9 evt = document.createEventObject(); return cel.fireEvent('on'+typ,evt) } } }; Zdarzenia.pobierz = function (e) { e = e || window.event || Zdarzenia.pobierz.caller.arguments[0]; if (e) { return this.formatuj(e); } }; /** * Konstruktor cGR - podstawowa klasa gratkowego frameworka */ cGR = function () { var data = new Date(); var znacznikDaty = data.getDate() + data.getMonth() + data.getFullYear(); this.wersja = (typeof oG_OSA.wersja_serwisu !== "undefined" ? oG_OSA.wersja_serwisu : znacznikDaty.toString()); this.sPrzegladarka = navigator.userAgent.toLowerCase(); this.sS = "%3Cscript%20type%3D%22text%2Fjavascript%22%3E"; this.eS = "%3C%2Fscript%3E"; }; cGR.prototype = { czyIE: function (ie) { if (ie) { return (this.sPrzegladarka.indexOf('msie ' + ie) > -1); } return !!(window.attachEvent && !/opera/.test(this.sPrzegladarka)); }, czyOpera: function () { return (/opera/).test(this.sPrzegladarka); }, czyWebKit: function () { return (/webkit/).test(this.sPrzegladarka); }, czyGecko: function () { return ((/gecko/).test(this.sPrzegladarka) && !/khtml/.test(this.sPrzegladarka)); }, czyMobileSafari: function () { return !!navigator.userAgent.match(/Apple.*Mobile.*Safari/); }, czyMacOS: function () { return (/mac/).test(this.sPrzegladarka); }, pobierzWersje: function () { return this.wersja; }, czyPoprawnyEmail: function(email) { var regex = /^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|consulting|xyz|cool|coop|club|edu|gov|group|info|int|jobs|mil|museum|name|net|online|org|pro|studio|travel|mobi|estate|expert|company|berlin|tel|tech|link|gifts|house|ski|gmbh|[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$/i; return regex.test(email); }, $: function (el) { if (el && (arguments.length > 1 || el instanceof Array)) { var a = arguments.length > 1 ? arguments : el, i = 0, aEl = [], l = a.length; for (i = 0; i < l; i += 1) { aEl.push(GR("$", a[i])); } return aEl; } if ("object" === typeof el) { return el; } if ("string" === typeof el) { return document.getElementById(el); } return null; }, /** * class, wezel, tag, callback */ $$: function () { var aK = [], aEl, ln = 0, i = 0, a = arguments, wezel = a[1] || document.body, tag = a[2] || "*", czyFn = 'function' === typeof a[3]; // obecnie tylko IE nie obsluguje tego cuda stad warunek if (wezel.getElementsByClassName) { aEl = wezel.getElementsByClassName(a[0]); } else { aEl = wezel.getElementsByTagName(tag); } ln = aEl.length; for (i = 0; i < ln; i += 1) { if (this.czyCssClass(aEl[i], a[0]) && ((tag !== '*' && (new RegExp(aEl[i].tagName, 'gi')).test(tag)) || tag === '*')) { aK.push(aEl[i]); if (czyFn) { a[3].call(null, aEl[i]); } } } return aK; }, relParam: function (rel, wyl) { var tmp, ret = {}, relTmp, i = 0; wyl = wyl || 0; if (rel.match(new RegExp('(^{.*}$)'))) { return rel.toObject(); } relTmp = rel.split(" "); rel = relTmp[0].split('-'); if (!wyl) { rel.shift(); } for (i = 0; i < rel.length; i += 1) { tmp = rel[i].split(':'); ret[tmp[0]] = tmp[1] || false; } return ret; }, czyCssClass: function (oid, cssClass) { oid = this.$(oid); return oid && new RegExp('(^|\\s)' + cssClass + '(\\s|$)').test(oid.className); }, pobierzCssClass: function (oid, czyTablica) { oid = this.$(oid); if (czyTablica) { return (oid ? oid.className.split(' ') : []); } return (oid ? oid.className : null); }, ustawCssClass: function (oid, cssClass) { oid = this.$(oid); if (!oid) { return; } oid.className = cssClass; return oid; }, dodajCssClass: function (oid, cssClass) { oid = this.$(oid); if (!this.czyCssClass(oid, cssClass)) { oid.className = ([oid.className, cssClass].join(' ')).trim(); } return oid.className; }, usunCssClass: function (oid, cssClass, nowa) { oid = this.$(oid); nowa = nowa || ""; if (this.czyCssClass(oid, cssClass)) { oid.className = (oid.className.replace(new RegExp('(?:^|\\s+)' + cssClass), nowa)).trim(); } if ("" === oid.className.trim()) { oid.removeAttribute("class"); } return oid.className; }, przelaczCssClass: function (oid, cssClass) { if (this.czyCssClass(oid, cssClass)) { this.usunCssClass(oid, cssClass, ' '+arguments[2]); } else { if (this.czyCssClass(oid, arguments[2])) { this.usunCssClass(oid, arguments[2], ' '+cssClass); } else { this.dodajCssClass(oid, cssClass); } } return oid; }, ustawReguleCss: function (oid, regula) { oid = this.$(oid); if (!oid) { return; } if (GR("czyIE") && !GR('czyIE', 9)) { oid.style.setAttribute("cssText", regula); } else { oid.style.cssText = regula; } if (!regula) { oid.removeAttribute('style'); } }, utworzElement: function (oid, tag, atrybuty, typ, tekst) { var ob, k, attr, niestandardowe = (!document.documentElement.hasAttribute) ? { // IE < 8 'for': 'htmlFor', 'class': 'className' } : { // w3c 'htmlFor': 'for', 'className': 'class' }; atrybuty = atrybuty || {}; tekst = tekst || null; try { if ('name' in atrybuty) { ob = document.createElement('<' + tag + ' name="' + atrybuty.name + '">'); //delete atrybuty.name; } } catch (ex) { } if (!ob || ob.nodeName !== tag.toUpperCase()) { ob = document.createElement(tag); } for (k in atrybuty) { if ('function' !== typeof atrybuty[k]) { if ('style' === k) { this.ustawReguleCss(ob, atrybuty[k]); } else { attr = niestandardowe[k] || k; ob.setAttribute(attr, atrybuty[k]); } } } if (tekst) { ob.appendChild(document.createTextNode(tekst)); } if (typ !== -1) { this.dolaczElement((this.$(oid) || document.body), ob, typ); } return ob; }, dolaczElement: function (oid, obiekt, pozycja) { pozycja = pozycja || "ostatni"; switch (pozycja) { case "pierwszy": oid.insertBefore(obiekt, oid.firstChild); break; case "przed": oid.parentNode.insertBefore(obiekt, oid); break; case "po": oid.parentNode.insertBefore(obiekt, oid.nextSibling); break; case 'ostatni': oid.appendChild(obiekt); break; } }, usunElement: function (oid) { oid = $(oid); if (!oid) { return; } oid.parentNode.removeChild(oid); }, wyczyscElement: function (n) { try { while (n.firstChild) { n.removeChild(n.firstChild); } } catch (ex) { n.innerHTML = ''; } }, wstawHTML: function (oid, tresc) { // do weryfikacji this.$(oid).innerHTML = tresc; }, wpisz: function (tresc) { // do weryfikacji document.write(tresc); }, wpiszSkrypt: function (skrypt, typ) { // do weryfikacji typ = typ || "wpisz"; var d = document, s; if (typ === "wpisz") { d.write(unescape(this.sS) + skrypt + unescape(this.eS)); } else if (typ === "head") { s = d.createElement("script"); s.setAttribute("type", "text/javascript"); this.utworzTekst(s, skrypt); d.getElementsByTagName("head")[0].appendChild(s); } }, dodajOnload: function (f) { var load = window.onload; if (typeof window.onload !== 'function') { window.onload = f; } else { window.onload = function () { if (load) { load(); } f(); }; } }, zaladujPlikJS: function (p, typ, fWy, bezWersji, id) { var d = document, src, tmp, s; typ = typ || "head"; if ('function' !== typeof fWy) { fWy = function () {}; } try { if (oG_OSA.pobranePliki[p] && oG_OSA.pobranePliki[p] === 1) { fWy(); return; } src = p; if (!bezWersji) { src = p + (p.indexOf("?") + 1 ? "&" : "?") + this.pobierzWersje(); } if (d.getElementsByTagName("head") && typ === "head") { s = document.createElement("script"); s.async = true; if (GR("czyIE")) { s.onreadystatechange = function () { if (/loaded|complete/.test(this.readyState)) { fWy(); oG_OSA.pobranePliki[p] = 1; } }; } else { s.onload = function () { fWy(); oG_OSA.pobranePliki[p] = 1; }; } s.setAttribute("type", "text/javascript"); s.setAttribute("src", src); if (id) { s.setAttribute("id", id); } d.getElementsByTagName("head")[0].appendChild(s); } else if (typ === "plik") { tmp = "%3Cscript%20type%3D%22text%2Fjavascript%22%20src%3D%22" + src + "%22%3E"; d.write(unescape(tmp) + unescape(this.eS)); } } catch (ex) {} }, zaladujPlikCSS: function (p) { if (typeof oG_OSA.pobranePliki[p] !== "undefined" && oG_OSA.pobranePliki[p] === 1) { return; } var href = p + (p.indexOf("?") + 1 ? "&" : "?") + this.pobierzWersje(), css = document.createElement("link"); css.setAttribute("type", "text/css"); css.setAttribute("rel", "stylesheet"); css.setAttribute("href", href); document.getElementsByTagName("head")[0].appendChild(css); }, utworzTekst: function (oid, tekst) { oid = typeof oid === 'object' ? oid : GR("$", oid); if (null === oid.canHaveChildren || oid.canHaveChildren) { oid.appendChild(document.createTextNode(tekst)); } else { oid.text = tekst; } } }; cGR.prototype.zmienCssClass = cGR.prototype.usunCssClass; cGR.prototype.zaczepZdarzenie = function (oid, typ, fn, o) { Zdarzenia.zaczep(this.$(oid), typ, fn); }; cGR.prototype.odczepZdarzenie = function (oid, typ, fn) { Zdarzenia.odczep(this.$(oid), typ, fn); }; cGR.prototype.przetworzLinki = function () { var i, k, l, attRel, tmp = [], linki = document.getElementsByTagName("a"), ciacho = GR('pobierzCookie', 'zakladki'), lH = document.location.hash.replace('#', ''), ln = linki.length, dRel = { "external": { "target": "_blank" }, "popup": { "click": function () { GR("pokazPopup", this); return false; } }, "modul": { "click": function () { GR("o_warstwaPrzykrywajaca_pokazModul", this); return false; } }, "kadr_warstwa": { "click": function () { GR("o_kadrowanie_inicjalizuj", this); return false; } }, "zakladka": { "click": function () { GR("o_zakladki_wykonaj", this); return false; }, "obiekt": "zakladka" } }, click = function () { return false; }; for (i = 0; i < ln; i += 1) { attRel = linki[i].getAttribute("rel") || 0; if (attRel) { for (k in dRel) { if ('function' !== typeof dRel[k]) { if (attRel.indexOf(k) === 0) { for (l in dRel[k]) { switch (l) { case "target": linki[i].target = dRel[k][l]; break; case "obiekt": var attRelParam = GR("relParam", attRel, 1); if (!oG_OSA[dRel[k][l]]) { oG_OSA[dRel[k][l]] = {}; } if (!oG_OSA[dRel[k][l]][attRelParam.id]) { oG_OSA[dRel[k][l]][attRelParam.id] = linki[i]; } if (lH === attRelParam.id || ciacho === attRelParam.id) { GR('o_zakladki_wykonaj', linki[i]); } break; default: if (GR("czyCssClass", linki[i].parentNode, "wyszarzony")) { linki[i].onclick = click; break; } linki[i].onclick = dRel[k][l]; break; } } } } } } } }; cGR.prototype.pobierzPozycjeScroll = function () { var dd = document.documentElement, db = document.body; if (self.pageYOffset) { return [self.pageXOffset, self.pageYOffset]; } if (dd && dd.scrollTop) { return [dd.scrollLeft, dd.scrollTop]; } if (db) { return [db.scrollLeft, db.scrollTop]; } return [0, 0]; }; cGR.prototype.pobierzRozmiary = function () { var xOkno, yOkno, xStrona, yStrona, xScroll, yScroll, dd = document.documentElement, db = document.body, w = window; if (w.innerHeight && w.scrollMaxY) { xScroll = db.scrollWidth; yScroll = w.innerHeight + w.scrollMaxY; } else if (db.scrollHeight > db.offsetHeight) { xScroll = db.scrollWidth; yScroll = db.scrollHeight; } else { xScroll = db.offsetWidth; yScroll = db.offsetHeight; } if (self.innerHeight) { xOkno = self.innerWidth; yOkno = self.innerHeight; } else if (dd && dd.clientHeight) { xOkno = dd.clientWidth; yOkno = dd.clientHeight; } else if (db) { xOkno = db.clientWidth; yOkno = db.clientHeight; } xStrona = (xScroll < xOkno) ? xOkno : xScroll; yStrona = (yScroll < yOkno) ? yOkno : yScroll; return [xStrona, yStrona, xOkno, yOkno, screen.width, screen.height]; }; cGR.prototype.pobierzPozycje = function (oid) { oid = this.$(oid); var T = 0, L = 0; while (oid.tagName !== 'HTML') { T += oid.offsetTop || 0; L += oid.offsetLeft || 0; if (oid.offsetParent) { oid = oid.offsetParent; } else { break; } } T += oid.offsetTop || 0; L += oid.offsetLeft || 0; return { x: L, y: T }; }; cGR.prototype.pokazPopup = function (oAhref) { var pTmp = [], k, popup, rel = oAhref.getAttribute("rel"), p = GR("relParam", rel), defP = { "scrollbars": 0, "channelmode": 0, "directories": 0, "fullscreen": 0, "resizable": 0, "toolbar": 0, "location": 0, "menubar": 0, "status": 0, "titlebar": 0, "width": 750, "height": 550, "left": 0, "top": 0 }; p.width = p.s || p.width; p.height = p.w || p.height; p.left = p.l || p.left || Math.floor((screen.width - p.width) / 2); p.top = p.g || p.top || Math.floor((screen.height - p.height) / 2); p.screenX = p.left; p.screenY = p.top; for (k in defP) { if ('function' !== typeof p[k]) { if (p[k]) { pTmp.push(k + '=' + p[k]); } else { pTmp.push(k + '=' + defP[k]); } } } popup = window.open(oAhref.href, (p.name || ''), pTmp.join()); popup.focus(); if (p.fn && 'function' === typeof oG_OSA[p.fn]) { oG_OSA[p.fn](); } }; // Uwaga - nie zmieniac cGR.prototype.pokazUkryj = function (pola, wlacz, typ) { var el = this.$(pola), ln = el.length, i = 0; wlacz = wlacz || []; typ = typ || "block"; for (i = 0; i < ln; i += 1) { if (!el[i]) { continue; } if ("undefined" === typeof wlacz[i]) { wlacz[i] = el[i].style.display === "none" ? 1 : 0; } if (wlacz[i]) { el[i].style.display = typ; } else { el[i].style.display = "none"; } } return false; }; cGR.prototype.usunWezelTekstowy = function (n, typ) { typ = typ || "default"; try { if (n && 3 === n.nodeType) { switch (typ) { case "previous": return n.previousSibling; case "next": return n.nextSibling; default: return n.parentNode; } } } catch (e) { } return n; }; /** * Rozszerzenie umozliwiajace pobranie listy tylko dzieci danego rodzica * * @param oid - string ID lub HTMLElement */ cGR.prototype.DOM_pobierzListeDzieci = function (oid) { oid = GR('$', oid); if (!oid) { return []; } if (!GR('czyIE')) { return Array.prototype.slice.call(oid.children); } var tb = [], ln = oid.childNodes.length, i, child; for (i = 0; i < ln; i += 1) { child = oid.childNodes[i]; if (1 === child.nodeType) { tb.push(child); } } return tb; }; cGR.prototype.ustawCookie = function (nazwa, wartosc, wygasniecie, sciezka, domena, bezpieczne) { var r = [nazwa + "=" + escape(wartosc)], s, i; if (wygasniecie instanceof Date) { wygasniecie = wygasniecie.toGMTString(); } else if ('number' === typeof wygasniecie) { wygasniecie = (new Date(+(new Date()) + (wygasniecie * 1e3))).toGMTString(); } s = { expires: wygasniecie || 0, path: sciezka || 0, domain: domena || 0, secure: bezpieczne || 0 }; for (i in s) { if (s[i] && "function" !== typeof s[i]) { r.push(i + "=" + s[i]); } } document.cookie = r.join(";"); }; cGR.prototype.pobierzCookie = function (nazwa) { var oRE = new RegExp("(?:;)?" + nazwa + "=([^;]*);?"); if (oRE.test(document.cookie)) { return decodeURIComponent(RegExp.$1); } return null; }; cGR.prototype.usunCookie = function (k, fn) { if (this.pobierzCookie(k.nazwa)) { document.cookie = k.nazwa + '=' + (k.sciezka ? ';path=' + k.sciezka : '') + (k.domena ? ';domain=' + k.domena : '') + ';expires=Thu, 01-Jan-1970 00:00:01 GMT'; } if ("function" === typeof fn) { fn(); } }; cGR.prototype.generujHTML = function (ob) { if ('string' === typeof ob) { ob = ob.toObject(); } if ('object' !== typeof ob) { return; } var ln = ob.length, i, k, ret = {}, tmp, fragment = document.createDocumentFragment(); function utworzTag(rodzic, budulec) { var tmpTag, i, iz, ln = 0; try { if ('TEKST' === budulec.tag) { rodzic.appendChild(document.createTextNode(budulec.wstawTekst)); return; } tmpTag = GR('utworzElement', rodzic, budulec.tag, budulec.atrybuty, budulec.pozycja, budulec.wstawTekst); if (budulec.wstawHtml) { tmpTag.innerHTML = budulec.wstawHtml; } if (budulec.zmienna) { ret[budulec.zmienna] = tmpTag; } if (budulec.zdarzenia) { for (k in budulec.zdarzenia) { if ('function' === typeof budulec.zdarzenia[k]) { Zdarzenia.zaczep(tmpTag, k, budulec.zdarzenia[k]); } } } if (budulec.struktura) { ln = budulec.struktura.length; for (i = 0; i < ln; i += 1) { utworzTag(tmpTag, budulec.struktura[i]); } } } catch (ex) { } } for (i = 0; i < ln; i += 1) { tmp = ob[i]; utworzTag(fragment, tmp); } return { fragment: fragment, zmienne: ret, wstawDo: function (cel, pozycja) { GR('dolaczElement', $(cel), fragment, pozycja); } }; }; /** * Funkcja tworzaca kontener z informacja o ladowaniu danych * * @param dane {Object} * { * kontener: '', // {String | HTMLObject} id lub obiekt, ktory ma byc przykryty przez kontener ladowania * tloKolor: '#000', // {String} kolor tla - domyslnie #fff * tloImg: 'url do obrazka', // {String} url do obrazka z kolkiem ladowania * czasUkryj: 100 // {Number} czas po jakim ma byc ukryty kontener ladowania - domyslnie 100 ms * } * @return HTMLDIVObject - obiekt kontenera ladowania */ cGR.prototype.kontenerLadowania = function (dane) { if (!dane.kontener || !this.$(dane.kontener)) { return; } var kontener, obiekt = this.$(dane.kontener), timer, styl = []; if (dane.tloKolor) { styl.push('background-color: ' + dane.tloKolor); } if (dane.tloImg) { styl.push('background-image: url(' + dane.tloImg + ')'); } kontener = GR('utworzElement', obiekt, 'div', { 'class': 'ladowanie schowaj', 'style': 'height: ' + obiekt.offsetHeight + 'px;' }); return { pokaz: function () { var wysokosc = obiekt.offsetHeight; styl.push('height: ' + wysokosc + 'px'); styl.push('line-height: ' + wysokosc + 'px'); GR('ustawReguleCss', kontener, styl.join(';')); GR('usunCssClass', kontener, 'schowaj'); }, ukryj: function () { clearTimeout(timer); timer = setTimeout(function () { GR('dodajCssClass', kontener, 'schowaj'); }, (dane.czasUkryj || 100)); } }; }; /** * Tworzy iframe w zadanym elemencie * @param {Object} el * @param {Object} atrybuty * @param {Object} def */ cGR.prototype.utworzIframe = function (el, atrybuty, def) { var src, ramka; atrybuty = atrybuty || {}; def = def || {}; if (!atrybuty.id) { atrybuty.id = 'gt-ramka'; } if (!atrybuty.name) { atrybuty.name = atrybuty.id; } if (atrybuty.src) { src = atrybuty.src; delete atrybuty.src; } else { src = 'about:blank'; } ramka = this.utworzElement(el, 'iframe', atrybuty); if ('function' === typeof def.fnLoad) { if (this.czyIE) { ramka.onreadystatechange = function () { if (/loaded|complete/.test(this.readyState)) { def.fnLoad(ramka); } }; } else { ramka.onload = function () { def.fnLoad(ramka); }; } } ramka.src = src; return ramka; }; /** * Ogolny dostawca danych */ cGR.prototype.dostawca = function (dane) { dane = dane || {}; var typ = dane.typ, fn = {}, that = this; if (!typ) { return; } fn.zmienna = function (param, wykonaj) { var towar; if (dane.dane) { towar = dane.dane; } else if (dane.nazwa && oG_OSA[dane.nazwa]) { towar = oG_OSA[dane.nazwa]; } else { towar = {}; } if (!wykonaj || 'function' !== typeof wykonaj) { return towar; } wykonaj(towar); }; fn.ajax = function (param, wykonaj) { var ajax = new HTTPRequest(), metoda = dane.metoda || 'get'; ajax[metoda](dane.url, param, function (o) { var zwrot; if (o.responseText) { zwrot = o.responseText.toObject(); wykonaj(zwrot); } }); }; fn.plik = function (param, wykonaj) { GR('pobierzPlikJS', dane.url + that.wersja, '', wykonaj, param.id); }; return { wykonaj: function (zamowienie, wykonaj) { fn[typ](zamowienie, wykonaj); }, dostarcz: function (zamowienie) { return fn[typ](zamowienie); } }; }; /** * zaslona przykrywajaca * @todo przebudowac pod nowa koncepcje - 1 zaslona -> 1 pojemnik */ cGR.prototype.zaslona = function () { var zaslona = $('zaslona'), zIndex = 12000, tla = [], zamknijTB = [], pozycjaScroll, rozmiary; if (zaslona) { return zaslona; } zaslona = GR("utworzElement", '', "div", { "id": "zaslona", 'class': 'schowaj' }, "pierwszy"); zaslona.liczbaOdslon = 0; zaslona.zIndex = zIndex; function zaczepZamknij(zamknij) { if (!zamknij) { Zdarzenia.zaczep(zaslona, 'click', function () { Zdarzenia.anuluj(Zdarzenia.pobierz()); }); return; } zamknij = zamknij || {}; if (true === zamknij.esc) { document.onkeydown = function () { var keycode = Zdarzenia.pobierz().keyCode; if (keycode === 27) { zaslona.ukryj(zamknij.fn); } }; } if (true === zamknij.click) { Zdarzenia.zaczep(zaslona, 'click', function () { zaslona.ukryj(zamknij.fn); Zdarzenia.anuluj(Zdarzenia.pobierz()); }); } } zaslona.pokaz = function (tlo, zamknij, fn) { pozycjaScroll = GR("pobierzPozycjeScroll"); rozmiary = GR("pobierzRozmiary"); var wysokosc = parseInt(rozmiary[1], 10); tlo = tlo || ''; if (GR('czyOpera')) { wysokosc += Math.floor(rozmiary[3] / 2.5); } if (GR('czyCssClass', zaslona, 'schowaj')) { zaslona.liczbaOdslon = 0; zIndex = 12000; } if (zaslona.style.zIndex) { zIndex = parseInt(zaslona.style.zIndex, 10); } zIndex += (zaslona.liczbaOdslon * 2); zaslona.zIndex = zIndex; GR('ustawReguleCss', zaslona, 'height: ' + wysokosc + 'px; z-index: ' + zIndex + '; background-color: ' + tlo); zaczepZamknij(zamknij); zaslona.liczbaOdslon += 1; tla[zaslona.liczbaOdslon] = tlo; zamknijTB[zaslona.liczbaOdslon] = zamknij; GR('usunCssClass', this, 'schowaj'); if ('function' === typeof fn) { fn(this); } }; zaslona.odswiez = function () { pozycjaScroll = GR("pobierzPozycjeScroll"); rozmiary = GR("pobierzRozmiary"); var wysokosc = parseInt(rozmiary[1], 10); zaslona.style.height = wysokosc + 'px'; }; zaslona.ukryj = function (fn) { try { var tlo, zamknij; zaslona.liczbaOdslon -= 1; if (zaslona.liczbaOdslon < 0) { zaslona.liczbaOdslon = 0; } zIndex -= (zaslona.liczbaOdslon * 2); if (0 === zaslona.liczbaOdslon) { GR('ustawReguleCss', zaslona); GR('dodajCssClass', this, 'schowaj'); } else { zaslona.zIndex = zIndex; zaslona.style.zIndex = zIndex; tlo = tla[zaslona.liczbaOdslon]; if (tlo) { zaslona.style.backgroundColor = tlo; } zamknij = zamknijTB[zaslona.liczbaOdslon]; zaczepZamknij(zamknij); } if ('function' === typeof fn) { fn(this); } } catch (ex) { } }; zaslona.ustawPojemnik = function (pojemnik, wlasnosci) { pojemnik = $(pojemnik); wlasnosci = wlasnosci || {}; if (!pojemnik) { return; } var szerokosc = wlasnosci.width || pojemnik.offsetWidth, wysokosc = wlasnosci.height || pojemnik.offsetHeight, gora = wlasnosci.top || Math.floor(pozycjaScroll[1] + ((rozmiary[3] - wysokosc) / 2)), lewy = wlasnosci.left || Math.floor((rozmiary[0] - szerokosc) / 2), css = ['top: ' + gora + 'px; left: ' + lewy + 'px; visibility: visible']; if (wlasnosci.width) { css.push('width: ' + wlasnosci.width + 'px'); } if (wlasnosci.height) { css.push('height: ' + wlasnosci.height + 'px'); } GR('ustawReguleCss', pojemnik, css.join(';')); }; return zaslona; }; // IE 5.5|6 png filtr try { document.execCommand("BackgroundImageCache", false, true); } catch (oB) { } function fixPNG(oEl) { if ((/MSIE (5\.5|6).+Win/).test(navigator.userAgent)) { var src, re_scale_mode, scale_mode, m; if (oEl.tagName === 'IMG') { if ((/\.png$/).test(oEl.src)) { src = oEl.src; oEl.src = "./i/e.gif"; } } else { src = oEl.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i); if (src) { src = src[1]; oEl.runtimeStyle.backgroundImage = "none"; } } re_scale_mode = /iesizing\-(\w+)/; m = re_scale_mode.exec(oEl.className); scale_mode = (m) ? m[1] : 'crop'; if (src) { oEl.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='" + scale_mode + "')"; } } } // ------ var dodajOnload = cGR.prototype.dodajOnload, gr$ = cGR.prototype.$, $ = cGR.prototype.$; function HTTPRequest(kodowanie) { this.czySync = false; this.zdarzenia = ["start", "open", "send", "load", "end"]; this.kodowanie = kodowanie || oG_OSA.kodowanie || 'iso-8859-2'; } HTTPRequest.prototype = { czyObsluguje: function () { return !!this.polaczenie(); }, filtr: function (url) { if ('utf-8' === this.kodowanie) { return encodeURIComponent(url); } var matches, i = 0, j = 0, mLn = 0, utf8code = '', utf16 = ['%u0104', '%u0106', '%u0118', '%u0141', '%u0143', '%u015A', '%u017B', '%u0179', '%u0105', '%u0107', '%u0119', '%u0142', '%u0144', '%u015B', '%u017C', '%u017A'], utf8 = ['%A1', '%C6', '%CA', '%A3', '%D1', '%A6', '%AF', '%AC', '%B1', '%E6', '%EA', '%B3', '%F1', '%B6', '%BF', '%BC']; url = escape(url); matches = url.match(/%u[a-z0-9]{4}/gi); if (matches) { for (i = 0, mLn = matches.length; i < mLn; i += 1) { utf8code = ''; for (j = 0; j < utf16.length; j += 1) { if (utf16[j] === matches[i]) { utf8code = utf8[j]; break; } } url = url.replace(matches[i], utf8code); } } return url; }, polaczenie: function () { var i = 0, s = ["MSXML2.XMLHTTP.6.0", "MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"]; try { return new XMLHttpRequest(); } catch (ex1) { for (i = 0; i < s.length; i += 1) { try { return new ActiveXObject(s[i]); } catch (ex2) {} } } }, formatujParametry: function (parametry) { var r = [], i; for (i in parametry) { if ('function' !== typeof parametry[i]) { r[r.length] = i + "=" + (this.filtr ? this.filtr(parametry[i]) : parametry[i]); } } return r.join("&"); }, ustawKodowanie: function (kodowanie) { this.kodowanie = kodowanie.toLowerCase(); }, pobierzKodowanie: function () { return this.kodowanie; }, get: function (url, parametry, fn) { return this.request("GET", url + (url.indexOf("?") + 1 ? "&" : "?") + this.formatujParametry(parametry), null, fn, null); }, post: function (url, parametry, fn) { return this.request("POST", url, parametry = this.formatujParametry(parametry), fn, { "Connection": "close", "Content-Length": parametry.length, "Method": "POST " + url + " HTTP/1.1", "Content-Type": "application/x-www-form-urlencoded; charset=" + this.kodowanie }); }, request: function (metoda, url, parametry, fn, naglowki) { var self = this, o = this.polaczenie(), f = fn instanceof Function, s, k; try { if ('start' in fn) { fn.start(); } o.open(metoda, url, !this.czySync); if (!this.czySync) { o.onreadystatechange = function () { s = self.zdarzenia[o.readyState]; if (f && s === "end") { fn(o); } if (s in fn) { fn[s](o); } }; } o.setRequestHeader("HTTP_USER_AGENT", "XMLHttpRequest"); try { for (k in naglowki) { if ('function' !== typeof naglowki[k]) { o.setRequestHeader(k, naglowki[k]); } } if ('utf-8' !== this.kodowanie) { o.overrideMimeType('text/html; charset=' + this.kodowanie); } } catch (ex) {} o.send(parametry); if (this.czySync) { if (f) { fn(o); } else { fn.end(o); } } this.anuluj = function () { if ('function' === typeof o.abort) { o.abort(); } }; return true; } catch (ex3) { return false; } }, anuluj: function () { } }; var oAjax = new HTTPRequest(); cGR.rozszerz('SWF', function (plik, szerokosc, wysokosc, param, oid) { if (!oid) { if (!this.flash) { this.flash = 0; } this.flash += 1; oid = 'flash-' + this.flash; GR('wpisz', '
'); } GR('DOMReady', function () { GR('oSwfInicjalizuj', { src: plik, szerokosc: szerokosc, wysokosc: wysokosc, param: param, oid: oid }); }); }); (function () { var readyBound = false, isReady = false, readyList = [], DOMContentLoaded; function domReady() { if (isReady) { return; } var ln = readyList.length, i = 0; isReady = true; if (readyList) { for (i = 0; i < ln; i += 1) { readyList[i].call(window, []); } readyList = []; } } function doScrollCheck() { if (isReady) { return; } try { document.documentElement.doScroll('left'); } catch (ex) { setTimeout(doScrollCheck, 1); return; } domReady(); } if (document.addEventListener) { DOMContentLoaded = function () { document.removeEventListener('DOMContentLoaded', DOMContentLoaded, false); domReady(); }; } else if (document.attachEvent) { DOMContentLoaded = function () { if (document.readyState === "complete") { document.detachEvent("onreadystatechange", DOMContentLoaded); domReady(); } }; } // does the heavy work of working through the browsers idiosyncracies (let's call them that) to hook onload. function bindReady() { if (readyBound) { return; } readyBound = true; if ('complete' === document.readyState) { return domReady(); } if (document.addEventListener) { document.addEventListener('DOMContentLoaded', function () { document.removeEventListener('DOMContentLoaded', DOMContentLoaded, false); domReady(); }, false); window.addEventListener('load', domReady, false); } else if (document.attachEvent) { document.attachEvent("onreadystatechange", DOMContentLoaded); window.attachEvent("onload", domReady); var toplevel = false; try { toplevel = window.frameElement === null; } catch (ex) {} if (document.documentElement.doScroll && toplevel) { doScrollCheck(); } } } cGR.prototype.DOMReady = function (fn) { bindReady(); if (isReady) { fn.call(window, []); } else { readyList.push(function () { return fn.call(window, []); }); } }; cGR.prototype.dodajWykonajNaKoncu = cGR.prototype.DOMReady; })(); /** * @todo - usunac jak zniknie ze wszystkich szablonow */ function wykonajNaKoncu() { return; } GR('DOMReady', function () { if (!/centrala/.test(oG_OSA.serwis) && !/prasa/.test(oG_OSA.serwis)) { if ((!/gd/.test(oG_OSA.serwis) || oG_OSA.czyBot === false) && oG_OSA.typAnalytics !== 'UA') { GR('oTrackGoogleanalytics'); } } GR('dodajCssClass', document.body, 'js'); // Uruchomienie chmurek (function () { var chmurki = GR("$$", "chmurki"); if (!chmurki.length) { return; } setTimeout(function () { GR("o_chmurki_inicjalizuj", chmurki); }, 10); })(); // Przetworzenie rel linkow (function () { GR("przetworzLinki"); var external = GR('$$', 'external'), ln = external.length, i = 0; for (i = 0; i < ln; i += 1) { if (/A|FORM/.test(external[i].tagName.toUpperCase())) { external[i].target = '_blank'; } } })(); if (/polskatimes|nm/.test(oG_OSA.serwis)) { var url = document.createElement('a'); url.href = location.href; var path = url.pathname.replace(/^\/|\/$/g, ''); var czy_nto = (url.hostname == 'www.nto.pl'); var czy_echodnia = (url.hostname == 'www.echodnia.eu' && (path == 'swietokrzyskie' || path == 'radomskie' || path == 'podkarpackie')); if (path == '' || czy_nto || czy_echodnia) { (function () { try { window.ghmxy_align = 'center'; window.ghmxy_type = 'absolute'; window.ghmxy_identifier = 'bOtLa5QakD3ll8BxlHcT6Je.rtEsAcMm2rn093IxryX.m7'; GR("zaladujPlikJS", "//pro.hit.gemius.pl/hmapxy.js"); } catch (ex) {} })(); } } if ('undefined' === typeof JSON) { window.JSON = undefined; GR('zaladujPlikJS', oG_OSA.sUrl + '/o/js/json.js'); } }); /** * Pozycja tymczasowo w tym pliku * * @todo Usunac */ function Pozycja(x, y) { this.X = x; this.Y = y; } Pozycja.prototype.dodaj = function (val) { var nowaPozycja = new Pozycja(this.X, this.Y); if (val !== null) { if (!isNaN(val.X)) { nowaPozycja.X += val.X; } if (!isNaN(val.Y)) { nowaPozycja.Y += val.Y; } } return nowaPozycja; }; Pozycja.prototype.odejmij = function (val) { var nowaPozycja = new Pozycja(this.X, this.Y); if (val !== null) { if (!isNaN(val.X)) { nowaPozycja.X -= val.X; } if (!isNaN(val.Y)) { nowaPozycja.Y -= val.Y; } } return nowaPozycja; }; Pozycja.prototype.min = function (val) { var nowaPozycja = new Pozycja(this.X, this.Y); if (val === null) { return nowaPozycja; } if (!isNaN(val.X) && this.X > val.X) { nowaPozycja.X = val.X; } if (!isNaN(val.Y) && this.Y > val.Y) { nowaPozycja.Y = val.Y; } return nowaPozycja; }; Pozycja.prototype.max = function (val) { var nowaPozycja = new Pozycja(this.X, this.Y); if (val === null) { return nowaPozycja; } if (!isNaN(val.X) && this.X < val.X) { nowaPozycja.X = val.X; } if (!isNaN(val.Y) && this.Y < val.Y) { nowaPozycja.Y = val.Y; } return nowaPozycja; }; Pozycja.prototype.ograniczenie = function (lower, upper) { var nowaPozycja = this.max(lower); return nowaPozycja.min(upper); }; Pozycja.prototype.sprawdz = function () { var nowaPozycja = new Pozycja(this.X, this.Y); if (isNaN(nowaPozycja.X)) { nowaPozycja.X = 0; } if (isNaN(nowaPozycja.Y)) { nowaPozycja.Y = 0; } return nowaPozycja; }; Pozycja.prototype.zastosuj = function (element) { element = $(element); if (element === null) { return; } if (!isNaN(this.X)) { element.style.left = this.X + 'px'; } if (!isNaN(this.Y)) { element.style.top = this.Y + 'px'; } }; // koniec pozycja /** * Funkcje wlasne alert i confirm wyswietlane na warstwie * * @todo - usunac (przeniesc) podczas porzadkow na poczatku lutego */ (function () { var zaslona, kontener, html; function init() { zaslona = GR('zaslona'); kontener = GR('generujHTML', [{ 'zmienna': 'pojemnik', 'tag': 'div', 'atrybuty': { 'class': 'zaslonaPojemnik schowaj' }, 'struktura': [{ 'tag': 'div', 'atrybuty': { 'class': 'komunikatBlok'}, 'struktura': [{ 'tag': 'div', 'atrybuty': { 'class': 'komunikatNaglowek' }, 'struktura': [{ 'zmienna': 'naglowek', 'tag': 'p', 'atrybuty': { 'class': 'komunikatTytul ikonka' } }] }, { 'tag': 'div', 'atrybuty': { 'class': 'komunikatTresc' }, 'struktura': [{ 'zmienna': 'komunikat', 'tag': 'p' }, { 'tag': 'div', 'atrybuty': { 'class': 'przyciski' }, 'struktura': [{ 'zmienna': 'btTak', 'tag': 'button', 'atrybuty': { 'type': 'button', 'class': 'button tak' }, wstawTekst: 'OK' }, { 'zmienna': 'btNie', 'tag': 'button', 'atrybuty': { 'type': 'button', 'class': 'button nie' }, wstawTekst: 'Anuluj' }] }] }] }] }]); html = kontener.zmienne; document.body.appendChild(kontener.fragment); } function klik(wykonaj, akcja) { return function (e) { e = Zdarzenia.pobierz(e); if ('function' === typeof wykonaj) { wykonaj(); } zaslona.ukryj(function () { GR('ustawCssClass', html.pojemnik, 'zaslonaPojemnik schowaj'); }); Zdarzenia.anuluj(e); }; } function ustaw(dane, akcja) { if (!html) { init(); } zaslona.pokaz('', '', function () { if (dane.cssClass) { GR('ustawCssClass', html.pojemnik, 'zaslonaPojemnik schowaj'); GR('dodajCssClass', html.pojemnik, dane.cssClass); } html.naglowek.innerHTML = dane.naglowek || ''; html.komunikat.innerHTML = dane.komunikat || ''; html.btTak.innerHTML = dane.guzikTakTekst || 'OK'; html.btNie.innerHTML = dane.guzikNieTekst || 'Anuluj'; GR('dodajCssClass', html.pojemnik, akcja); GR('usunCssClass', html.pojemnik, 'schowaj'); zaslona.ustawPojemnik(html.pojemnik); }); } cGR.prototype.confirm = function (dane, fn) { fn = fn || {}; ustaw(dane, 'confirm'); if (!zaslona) { if (window.confirm(dane.komunikat)) { if ('function' === typeof fn.ok) { fn.ok(); } } else { if ('function' === typeof dane.fn.anuluj) { fn.anuluj(); } } return; } GR('usunCssClass', html.btNie, 'schowaj'); html.btNie.style.display = ''; html.btTak.onclick = klik(fn.ok, 'confirm'); html.btNie.onclick = klik(fn.anuluj, 'confirm'); }; cGR.prototype.alert = function (dane, fn) { ustaw(dane, 'alert'); if (!zaslona) { window.alert(dane.komunikat); return; } GR('dodajCssClass', html.btNie, 'schowaj'); html.btNie.style.display = 'none'; html.btTak.onclick = klik(fn.ok, 'alert'); }; })();