/// /// if (typeof (Sys.Browser.WebKit) === "undefined") { Sys.Browser.WebKit = {}; //Safari 3 is considered WebKit if (navigator.userAgent.indexOf('WebKit/') > -1) { Sys.Browser.agent = Sys.Browser.WebKit; Sys.Browser.version = parseFloat(navigator.userAgent.match(/WebKit\/(\d+(\.\d+)?)/)[1]); Sys.Browser.name = 'WebKit'; } } function myreset(node) { var inputs = node.getElementsByTagName("input"); for (var i = 0; i < inputs.length; i++) { var o = inputs[i]; if (o.type == "text") o.value = ""; else if (o.type == "checkbox") o.checked = false; } var selects = node.getElementsByTagName("select"); for (var i2 = 0; i2 < selects.length; i2++) { var s = selects[i2]; var a = $(s).attr("canreset"); if (a != null) if (a == "false") continue; s.value = ""; } alert("Poništen izbor."); } //// function myscroll2(id) { var prm = Sys.WebForms.PageRequestManager.getInstance(); if (prm && prm._postBackSettings) return; var n = $get(id); if (typeof (n) === "undefined") return; if (n) { if (Sys.Browser.agent === Sys.Browser.Opera) { var ele = n, x = ele.offsetLeft, y = ele.offsetTop; while (ele.offsetParent) { ele = ele.offsetParent; x += ele.offsetLeft; y += ele.offsetTop; } window.scrollTo(x, y); } else n.scrollIntoView(true); } } //// var myPostbackElement = null; function mychangeHref(srcElement) { if (!srcElement) return; if (typeof (srcElement.tagName) == "undefined") return; myPostbackElement = srcElement; var tagName = myPostbackElement.tagName.toLowerCase(); if (tagName == "img") { myPostbackElement = myPostbackElement.parentNode; if (myPostbackElement) tagName = myPostbackElement.tagName.toLowerCase(); } if (tagName == "label") { if (myPostbackElement.attributes.getNamedItem('for')) { var src = myPostbackElement.attributes['for'].value; var pbe = document.getElementById(src); if (pbe) { myPostbackElement = pbe; tagName = myPostbackElement.tagName.toLowerCase(); } } } else if (tagName == "option") { myPostbackElement = myPostbackElement.parentNode; tagName = myPostbackElement.tagName.toLowerCase(); if (tagName == "optgroup") { myPostbackElement = myPostbackElement.parentNode; } } } if (document.attachEvent) document.attachEvent("onclick", function () { mychangeHref(window.event.srcElement) }); else document.onclick = function (e) { mychangeHref(e.target) }; //firefox function mybeginRequest(sender, args) { if (myPostbackElement == null) { var prm = Sys.WebForms.PageRequestManager.getInstance(); if (prm._postBackSettings && prm._postBackSettings.async) myPostbackElement = prm._postBackSettings.sourceElement; } mythrob(myPostbackElement); } function mythrob(e) { if (e == null || e.parentNode == null) return; for (var i = 0; i < document.images.length; i++) { var img = document.images.item(i); var src = img.attributes.getNamedItem("src"); if (src == null) continue; if (src.nodeValue.indexOf("throbber") >= 0) { img.style.display = "none"; //if (e.style.display == 'none') return; img = img.cloneNode(false); img.style.display = "inline"; if (e.nextSibling) e.parentNode.insertBefore(img, e.nextSibling); else e.parentNode.appendChild(img); break; } } } function myendRequest(sender, args) { if (myPostbackElement == null) return; var img = myPostbackElement.nextSibling; myPostbackElement = null; if (img) { if (img.attributes) { var src = img.attributes.getNamedItem("src"); if (src && src.nodeValue.indexOf("throbber") >= 0) { img.style.display = "none"; img.parentNode.removeChild(img); } } } } function mybpcl2(containerID) { var url = ""; var container = document.getElementById(containerID); if (!container) return url; var inputs = container.getElementsByTagName("input"); for (var i = 0; i < inputs.length; i++) { var input = inputs[i]; if (input.type == "button" || input.type == "submit" || input.type == "hidden") continue; if (input.type == "radio" || input.type == "checkbox") { if (input.checked == true) { url += "&" + input.name; if (input.value != "") url += "=" + input.value; } continue; } if (input.name != "" && input.value != "" && input.getAttribute("skip") == null) url += "&" + input.name + "=" + encodeURIComponent(input.value); } ///// var url2 = ""; var selects = container.getElementsByTagName("select"); for (var i = 0; i < selects.length; i++) { var select = selects[i]; for (var j = 0; j < select.options.length; j++) { var option = select.options[j]; if (option.selected == true && option.value != "-1" && option.value != "") { url2 += "&" + select.name + "=" + option.value; break; } } } return url + url2; } function mybpcl(url, containersIDs, validationGroup, event) { if (typeof (Page_ClientValidate) == 'function') { if (Page_ClientValidate(validationGroup) == false) return false; } if (document.attachEvent) mychangeHref(event.srcElement); else mychangeHref(event.target); //firefox mybeginRequest(null, null); var url2 = ''; for (var i = 0; i < containersIDs.length; i++) { if (containersIDs[i] != null) url2 += mybpcl2(containersIDs[i]); } window.open(url + url2, "_self"); return false; } if (typeof (Sys) !== "undefined" && typeof (Sys.WebForms) !== "undefined") { Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(mybeginRequest); Sys.WebForms.PageRequestManager.getInstance().add_endRequest(myendRequest); Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded( function (sender, args) { var updatedPanels = args.get_panelsUpdated(); for (i = 0; i < updatedPanels.length; i++) { var scripts = updatedPanels[i].getElementsByTagName("script"); for (var j = 0; j < scripts.length; j++) eval(scripts[j].innerHTML); } }); } function addBookmark() { var title = document.title; if (!title || !document.location) return; var url = document.location.href; if (!url) return; if (window.sidebar) { window.sidebar.addPanel(title, url, ""); } else if (window.external) { window.external.AddFavorite(url, title); } else if (Sys.Browser.agent === Sys.Browser.Opera) {//window.opera && window.print var a = document.createElement('a'); a.setAttribute('rel', 'sidebar'); a.setAttribute('href', url); a.setAttribute('title', title); a.click(); } else alert("Failed."); } function setHomePage() { var uri = document.location.href; if (!uri) return; if (window.sidebar); else if (window.external) { document.body.style.behavior = "url(#default#homepage)"; document.body.setHomePage(uri); return; } alert("Failed."); } function dynamicP(id, ck, validationGroup) { if (typeof (Page_ClientValidate) == 'function') { if (Page_ClientValidate(validationGroup) == false) { $find(id).set_ContextKey(''); return false; } } $find(id).set_ContextKey(ck); return false; } function srLat(tbId, a) { var tb = document.getElementById(tbId); if (tb != null) { tb.value = tb.value + a.innerHTML; tb.focus(); } return false; } function myonsubmit() { var prm = Sys.WebForms.PageRequestManager.getInstance(); if (prm._postBackSettings && prm._postBackSettings.async) return true; mybeginRequest(null, null); return true; } function myfunc(sender, arg, context) { myPostbackElement = sender; mybeginRequest(null, null); __theFormPostData = ""; __theFormPostCollection = new Array(); WebForm_InitCallback(); WebForm_DoCallback(context.replace(/_/g, "$"), arg.replace(/_/g, "$"), myfunc1, context, myfunc1, true) } function myfunc1(arg, context) { var i = arg.indexOf("= 0) arg = arg.substring(0, i - 1); var ctx = $get(context); ctx.innerHTML = arg; if (ctx.childNodes.length == 1) ctx.innerHTML = ctx.childNodes[0].innerHTML; var scripts = ctx.getElementsByTagName("script"); for (var i = 0; i < scripts.length; i++) eval(scripts[i].innerHTML); } function onSilverlightError(sender, args) { var appSource = ""; if (sender != null && sender != 0) { appSource = sender.getHost().Source; } var errorType = args.ErrorType; var iErrorCode = args.ErrorCode; if (errorType == "ImageError" || errorType == "MediaError") { return; } var errMsg = "Unhandled Error in Silverlight Application " + appSource + "\n"; errMsg += "Code: " + iErrorCode + " \n"; errMsg += "Category: " + errorType + " \n"; errMsg += "Message: " + args.ErrorMessage + " \n"; if (errorType == "ParserError") { errMsg += "File: " + args.xamlFile + " \n"; errMsg += "Line: " + args.lineNumber + " \n"; errMsg += "Position: " + args.charPosition + " \n"; } else if (errorType == "RuntimeError") { if (args.lineNumber != 0) { errMsg += "Line: " + args.lineNumber + " \n"; errMsg += "Position: " + args.charPosition + " \n"; } errMsg += "MethodName: " + args.methodName + " \n"; } throw new Error(errMsg); } var sliders = []; var slidersInitialized=false; function addslider(images, containers, maximages, canPause) { sliders[sliders.length] = new slider(images, containers, maximages, canPause); if (!slidersInitialized) { slidersInitialized = true; window.setInterval(function (sliders) { for (var i = 0; i < sliders.length; i++) { var slider = sliders[i]; if (slider.canPause && slider.pause); else slider.show(true); } }, canPause ? 3200 : 2200, sliders); } } function slider(images, containers, maximages, canPause) { this.pause = false; this.canPause = canPause; this.maximages = maximages; this.images = new Array(images.length); for (var i = 0; i < images.length; i++) { var img = $get(images[i]); img.slider = this; images[i] = img; this.images[i] = { img: img, avail: true, loaded: false }; img.p = this.images[i]; img.onload = function () { this.p.loaded = true; for (var i = 0; i < this.slider.activeimages.length; i++) { if (this.slider.activeimages[i] >= 0) return; } this.slider.show(true); } img.onerror = function () { onimgerr(this); } } this.containers = containers; for (var i = 0; i < containers.length; i++) { containers[i] = $get(containers[i]); } this.activeimages = new Array(maximages); for (var i = 0; i < maximages; i++) this.activeimages[i] = -1; if (canPause) { var btnNext = document.createElement("input"); btnNext.type = "button"; btnNext.value = ">"; btnNext.style.position = "absolute"; btnNext.style.marginLeft = "10mm"; btnNext.style.display = "none"; btnNext.slider = this; btnNext.onclick = function () { this.slider.show(true); } btnNext.onmouseenter = function () { this.slider.pause = true; } btnNext.onmouseleave = function () { this.slider.pause = false; window.setTimeout(function (slider) { if (!slider.pause) { slider.btnNext.style.display = "none"; slider.btnPrev.style.display = "none"; } }, 500, this.slider); } this.btnNext = btnNext; var btnPrev = document.createElement("input"); btnPrev.type = "button"; btnPrev.value = "<"; btnPrev.style.position = "absolute"; btnPrev.style.display = "none"; btnPrev.slider = this; btnPrev.onclick = function () { this.slider.show(false); } btnPrev.onmouseenter = btnNext.onmouseenter; btnPrev.onmouseleave = btnNext.onmouseleave; this.btnPrev = btnPrev; } this.show = function (bNext) { for (var i = 0; i < this.images.length; i++) { this.images[i].avail = true; var img = this.images[i].img; if (!this.images[i].loaded) { img.src = img.src; } } for (var i = 0; i < this.activeimages.length; i++) { var start = this.activeimages[i]; var j=start; while (true) { if (bNext) { j++; if (j == this.containers.length) { if (start < 0) break; j = 0; } } else { j--; if (j < 0) { if (start < 0) break; j = this.containers.length - 1; } } if (j == start) break; if (this.images[j].avail && this.images[j].loaded) { var container = this.containers[j]; container.style.display = "inline-block"; if(start>=0) this.containers[start].style.display = "none"; this.images[j].avail = false; this.activeimages[i] = j; if (this.btnNext) { var child = container.firstChild; container.insertBefore(this.btnPrev, child); container.insertBefore(this.btnNext, child); } break; } } } } } function onimgerr(img) { if (img.src.indexOf("www.", 0) >= 0) img.src = img.src.replace("www.", ""); } function onimgload(img) { var $img = $(img); if (img.style.width == "") { var imgw = $img.width(); var $node = $img.parent(); var w = $node.innerWidth(); if (imgw > w) { if (w < imgw * 0.2) { w = imgw * 0.2; if (w < 200) w = 200; } else if (w < 150) w = 150; $img.css({ maxWidth: w }); } else if ($img.css("maxWidth") == "0px") $img.css({ maxWidth: "" }); } else $img.css({ maxWidth: "" }); $img.css({ display: 'inline' }); $img.removeAttr("title"); $img.removeAttr("alt"); if (img.myimg) { img.myimg.src = $img.attr("src"); return; } img.onclick = function (event) { if (this.slider && this.slider.canPause) { for (var i = 0; i < this.slider.containers.length; i++) { if (this.slider.containers[i].firstChild === this) { this.slider.show(true); return; } } } } img.onmouseenter = function (event) { if (this.slider && this.slider.canPause) { this.slider.pause = true; this.slider.btnNext.style.display = "inline"; this.slider.btnPrev.style.display = "inline"; return; } if (event.relatedTarget === this.myimg || event.relatedTarget === this) return; if (this.myimg) { this.myimg.style.display = "block"; return; } var img2 = document.createElement("img"); this.myimg = img2; img2.myimg = this; img2.onload = function () { var $img = $(this); $img.css({ top: Math.max(0, $(window).height() - $img.outerHeight()) / 2, left: Math.max(0, $(window).width() - $img.outerWidth()) / 2, position: 'fixed' }); } img2.onmouseleave = function (event) { this.myimg.onmouseleave(event); } img2.onclick = img2.onmouseleave; img2.src = $(this).attr("src"); document.body.appendChild(img2); } img.onmouseleave = function (event) { if (this.slider && this.slider.canPause) { this.slider.pause = false; window.setTimeout(function (slider) { if (!slider.pause) { slider.btnNext.style.display = "none"; slider.btnPrev.style.display = "none"; } }, 500, this.slider); return; } if (this.myimg && event.relatedTarget !== this && event.relatedTarget !== this.myimg) { this.myimg.style.display = "none"; } } } function myinit() { if (typeof (AniJS) !== "undefined") { var ah = AniJS.getHelper(); ah.myremove = function (e, ac) { ah.fireOnce(e, ac); ah.removeAnim(e, ac); } } } function myaffix(affixobj) { affixobj.stickyNav(); $(window).scroll(function () { affixobj.stickyNav(); }); } function myaffixobj(id) { this.elem = $("#" + id); this.elemTop = this.elem.offset().top; this.stickyNav = function () { var scrollTop = $(window).scrollTop(); if (scrollTop > this.elemTop) this.elem.addClass('sticky'); else this.elem.removeClass('sticky'); }; } function myonload(id) { var node = $get(id); if (!node) return; var w = $(node.parentNode).innerWidth(); if (w > 0) { if (w < 100) w = 100; $(node).css({ maxWidth: w }); } node.style.display = 'block'; } function mygoto(url) { window.open(url, "_self"); } function mybtnCl(id) { document.getElementById(id).click(); } function mytabc(ids, id) { for (var i = 0; i < ids.length; i += 2) { var e = document.getElementById(ids[i]); var btn = document.getElementById(ids[i + 1]); if (e === null || btn === null) continue; if (ids[i] == id) { e.style.display = "block"; btn.style.borderBottom = "0mm solid white"; } else { e.style.display = "none"; btn.style.borderBottom = "1mm solid lightblue"; } } } function mymnuexp(li) { for (var i = 0; i < li.childNodes.length; i++) { var node = li.childNodes[i]; if (node.tagName == "DIV") { var n = node; var l = 0; var h = 0; if (node.offsetLeft) l += node.offsetLeft; if (li.offsetTop) h += li.offsetTop; var w = 0; var hLast = 0; while (node) { if (node.tagName == "UL") { if (node.offsetWidth) w = node.offsetWidth; if (node.offsetLeft) l += node.offsetLeft; if (node.offsetTop) { hLast = node.offsetTop; h += node.offsetTop; } } node = node.parentNode; } if (w > l) n.style.width = (w - l) + "px"; h -= hLast; n.style.minHeight = h + "px"; return; } } } function mymergeup(uplist, v4) { var a = []; var prm = Sys.WebForms.PageRequestManager.getInstance(); if (prm && prm._updatePanelIDs) for (var i = 0; i < prm._updatePanelIDs.length; i++) { a.push('t' + prm._updatePanelIDs[i]); if (v4) a.push(""); } for (var i = 0; i < uplist.length; i++) { var e = uplist[i]; if (e == null || e.length == 0) { if (v4) a.push(""); continue; } if (document.getElementById(e.substring(1))) { var exist = false; for (var j = 0; j < a.length; j++) { var e2 = a[j]; if (e2.length == 0) continue; if (e2 === e) { exist = true; break; } } if (!exist) { a.push(e); continue; } } if (v4) i++; } return a; } function myonscroll(id, id2) { var e = document.getElementById(id); if (e == null) return; var e2 = document.getElementById(id2); if (e2 == null) return; if (window.pageYOffset > 0) { if (e.style.display == '') { e.style.display = 'none'; e2.style.position = 'sticky'; e2.style.top = 0; e2.style.zIndex = 1; } else { //document.documentElement.scrollTop += e2.scrollHeight; } } else { if (e.style.display == 'none') { e.style.display = ''; e2.style.zIndex = 0; } } } function NewWS(url, buttonID, panelID) { if ("WebSocket" in window) { this.button = document.getElementById(buttonID); if ((this.button == null) || (typeof (this.button) === "undefined")) return; this.panel = document.getElementById(panelID); this.url = url; this.create = function () { this.ws = new WebSocket(this.url); this.ws.button = this.button; this.ws.obj = this; this.ws.onerror = function (evt) { //if (typeof (evt.message) === "undefined") { // return; //} //const errorCode = evt.message.match(/\d{3}/)[0]; //alert("onerror-"+errorCode); setTimeout(function (ws) { ws.close(); }, 500, this); } this.ws.onopen = function () { this.obj.panel.style.display = "none"; this.send(""); }; this.ws.onmessage = function (evt) { if (evt.data == "") this.send(evt.data); else { this.button.value = evt.data; this.button.click(); } }; this.ws.onclose = function (event) { var reason; // See https://www.rfc-editor.org/rfc/rfc6455#section-7.4.1 if (event.code == 1000) reason = "Normal closure, meaning that the purpose for which the connection was established has been fulfilled."; else if (event.code == 1001) reason = "An endpoint is \"going away\", such as a server going down or a browser having navigated away from a page."; else if (event.code == 1002) reason = "An endpoint is terminating the connection due to a protocol error"; else if (event.code == 1003) reason = "An endpoint is terminating the connection because it has received a type of data it cannot accept (e.g., an endpoint that understands only text data MAY send this if it receives a binary message)."; else if (event.code == 1004) reason = "Reserved. The specific meaning might be defined in the future."; else if (event.code == 1005) reason = "No status code was actually present."; else if (event.code == 1006) reason = "The connection was closed abnormally, e.g., without sending or receiving a Close control frame"; else if (event.code == 1007) reason = "An endpoint is terminating the connection because it has received data within a message that was not consistent with the type of the message (e.g., non-UTF-8 [https://www.rfc-editor.org/rfc/rfc3629] data within a text message)."; else if (event.code == 1008) reason = "An endpoint is terminating the connection because it has received a message that \"violates its policy\". This reason is given either if there is no other sutible reason, or if there is a need to hide specific details about the policy."; else if (event.code == 1009) reason = "An endpoint is terminating the connection because it has received a message that is too big for it to process."; else if (event.code == 1010) // Note that this status code is not used by the server, because it can fail the WebSocket handshake instead. reason = "An endpoint (client) is terminating the connection because it has expected the server to negotiate one or more extension, but the server didn't return them in the response message of the WebSocket handshake.
Specifically, the extensions that are needed are: " + event.reason; else if (event.code == 1011) reason = "A server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request."; else if (event.code == 1015) reason = "The connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified)."; else reason = "Unknown reason"; this.obj.panel.style.display = "block"; setTimeout(function (obj) { obj.create(); }, 500, this.obj); }; }; this.create(); } else { // The browser doesn't support WebSocket console.error("WebSocket NOT supported by your Browser!"); } } function mycbSelect(cb,ids) { for (var i = 0; i < ids.length; i++) { var c = $get(ids[i]); if (c) c.checked = cb.checked; } } function myhlclick(e) { mythrob(e); }