jQuery.fn.hint = function (blurClass) { if (!blurClass) { blurClass = 'blur'; } return this.each(function () { // get jQuery version of 'this' var $input = jQuery(this), // capture the rest of the variable to allow for reuse title = $input.attr('title'), $form = jQuery(this.form), $win = jQuery(window); function remove() { if ($input.val() === title && $input.hasClass(blurClass)) { $input.val('').removeClass(blurClass); } } // only apply logic if the element has the attribute if (title) { // on blur, set value to title attr if text is blank $input.blur(function () { if (this.value === '') { $input.val(title).addClass(blurClass); } }).focus(remove).blur(); // now change all inputs to title // clear the pre-defined text when form is submitted $form.submit(remove); $win.unload(remove); // handles Firefox's autocomplete } }); }; // TreeCollapse, TreeExpand function TreeExpandToogle(ID) { var ExpandButton = document.getElementById("tree_expand"+ID); var ExpandArea = document.getElementById("tree"+ID); if (ExpandArea) { if (ExpandArea.style.display == "") { if (ExpandButton) ExpandButton.innerHTML = ""; ExpandArea.style.display = "none"; } else { if (ExpandButton) ExpandButton.innerHTML = ""; ExpandArea.style.display = ""; } } } function PopupNewWindow(url, width, height, params) { if (params == "") params = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no'; var left = (screen.width - width) / 2; var top = (screen.height - height) / 2; params = params + ',width=' + width + ',height=' + height + ',screenX=' + left + ',screenY=' + top; window.open(url, '' ,params); } // Dynamic libraries window.Libs = new Array; function LoadModule(Name) { CallbackName = Name.replace(/\./g, "_") + "_construct"; Name = "/modules/" + Name.replace(/\./g, "/") + "/module.js"; if (typeof window.Libs[Name] == "undefined") { // alert('Loading '+Name); window.Libs[Name] = 0; $j.ajax({ url: Name, type: "POST", async: false, data: null, dataType: 'script', success: function() { initializeScript.apply(); window.Libs[Name] = 1; } }); //eval("if (typeof "+ CallbackName+" == 'function') "+CallbackName+'();'); } return true; } function SystemMsg(Message) { $j("
" + Message + "
").dialog({ title: 'Upozornenie', resizable: false, modal : true, overlay: { //backgroundColor: "#000", //opacity: 0.5 }, buttons: { "OK": function() { $j(this).dialog("close"); } }, close: function(ev, ui) { $j(this).remove(); } }); } var gsm7bitChars = "@£$¥èéùìòÇ\nØø\rÅåΔ_ΦΓΛΩΠΨΣΘΞÆæßÉ !\"#¤%&'()*+,-./0123456789:;<=>?¡ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÑܧ¿abcdefghijklmnopqrstuvwxyzäöñüà"; var gsm7bitExChar = "^{}\\[~]|€"; function SmsCharCount(message) { var gsm7bitUnits = 0; var utf16codeUnits = 0; for (var i = 0, len = message.length; i < len; i++) { if (gsm7bitUnits != null) { if (gsm7bitChars.indexOf(message.charAt(i)) > -1) { gsm7bitUnits++; } else if (gsm7bitExChar.indexOf(message.charAt(i)) > -1) { gsm7bitUnits += 2; } else { gsm7bitUnits = null; } } utf16codeUnits += message.charCodeAt(i) < 0x10000 ? 1 : 2; } return Math.max(gsm7bitUnits, utf16codeUnits); } var AjaxIsRunning = false; var AjaxURL = ""; // ------------------------------------------ // freemap ajax helper functions // ------------------------------------------ // Options: // TargetId - elementid // Callback // CallbackFailed // PostParams = name=111&help=abc // PostForm // BeforeHTML // AfterHTML // FailedHTML // NoProgress - true function Ajax(URL, Options) { var request = null; AjaxIsRunning = true; if (!Options['BeforeHTML']) Options['BeforeHTML'] = ""; if (!Options['AfterHTML']) Options['AfterHTML'] = ""; if (!Options['FailedHTML']) Options['FailedHTML'] = ""; if (!Options['TargetId']) Options['TargetId'] = ""; if (!Options['NoProgress']) Options['NoProgress'] = false; // if (Options['TargetId'] != "") { if (typeof ThemeOpenArea == 'function') { Options['TargetId'] = ThemeOpenArea(Options['TargetId'], URL, Options); } } // if (Options['PostForm']) { var f = document.getElementById(Options['PostForm']); var Params = ""; for( var i = 0; i < f.elements.length; i++ ) { if (f.elements[i].type == "checkbox") { if (f.elements[i].checked) { Params += ((Params == "") ? "":"&") + f.elements[i].name + '=' + encodeURI(f.elements[i].value); } } else { Params += ((Params == "") ? "":"&") + f.elements[i].name + '=' + encodeURI(f.elements[i].value); } } if (!Options['PostParams']) { Options['PostParams'] = ""; } Options['PostParams'] = ((Options['PostParams'] == "") ? "":"&") + Params; } if (Options['PostParams']) Method = "POST"; else Method = "GET"; // try { request = new XMLHttpRequest(); } catch(e) { try { request = new ActiveXObject('Microsoft.XMLHTTP'); } catch(e) { } } var Text = ""; if (request != null) { request.onreadystatechange = function() { if (request.readyState == 4) { if (request.status == 200) { Text = request.responseText; if (Options['Callback']) { Text = Options['Callback'](Text); } if (Options['TargetId'] != "") { document.getElementById(Options['TargetId']).innerHTML = Options['BeforeHTML'] + Text + Options['AfterHTML']; runScripts( document.getElementById(Options['TargetId'])); } if (Options['OnSuccess']) { Options['OnSuccess'](); } } else { if (Options['CallbackFailed']) { Text = Options['CallbackFailed']; } if (Options['TargetId'] != "") { document.getElementById(Options['TargetId']).innerHTML = Options['FailedHTML']; } else { alert("Problem retrieving XML data"); } } AjaxIsRunning = false; } } } if ((Options['TargetId'] != "") && (!Options['NoProgress'])) { document.getElementById(Options['TargetId']).innerHTML = ""; } AjaxURL = URL; request.open(Method, URL + ((URL.indexOf("?") == -1) ? "?":"&") + 'Ajax=' + Options['TargetId'], true); if (Options['PostParams']) { request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); request.setRequestHeader("Content-length", Options['PostParams'].length); request.setRequestHeader("Connection", "close"); request.send(Options['PostParams']); } else { request.send(null); } } function Sjax(URL, Options) { if (!Options['TargetId']) Options['TargetId'] = ""; if (window.XMLHttpRequest) { AJAX = new XMLHttpRequest(); } else { AJAX = new ActiveXObject("Microsoft.XMLHTTP"); } if (AJAX) { AJAX.open("GET", URL, false); AJAX.send(null); Text = AJAX.responseText; if (Options['TargetId'] != "") { if (typeof ThemeOpenArea == "function") { Options['TargetId'] = ThemeOpenArea(Options['TargetId'], URL, Options); } } if (Options['TargetId'] != "") { document.getElementById(Options['TargetId']).innerHTML = Text; runScripts(document.getElementById(Options['TargetId'])); } return Text; } else { return false; } } function runScripts(e) { if (e.nodeType != 1) return; //if it's not an element node, return if (e.tagName.toLowerCase() == 'script') { eval(e.text); //run the script } else { var n = e.firstChild; while ( n ) { if ( n.nodeType == 1 ) { runScripts( n ); //if it's an element node, recurse } n = n.nextSibling; } } } // first line contains DIV name .. function RefreshContent(input) { lines = input.split("#"); element = document.getElementById(lines[1]); if (element) { lines.splice(0, 2); element.innerHTML = lines.join("#"); } return ""; } // GalleryShow - display gallery window, set position.. function GalleryShowWindow() { var Control = document.getElementById("gallery"); if (Control) { Control.style.display = "block"; Control.style.position = "absolute"; window.scrollTo(0,0); // alert(pageYOffset); } } // GalleryHid - hide gallery window function GalleryHideWindow() { var Control = document.getElementById("gallery"); if (Control) { Control.style.display = "none"; } } // display gallery image function GalleryShowFromURL(ImageURL) { GalleryShowWindow(); Ajax('?Proc=gallery&ImageURL='+ImageURL+'', { TargetId: 'gallery' }); } function GalleryShowByGalleryID(GalleryID, AttachmentType) { GalleryShowWindow(); Ajax('?Proc=gallery&GalleryID=' + GalleryID + '&AttachmentType=' + AttachmentType, { TargetId: 'gallery' }); } function GalleryShowForAttachmentID(AttachmentID, AttachmentType) { GalleryShowWindow(); Ajax('?Proc=gallery&AttachmentID=' + AttachmentID + '&AttachmentType=' + AttachmentType, { TargetId: 'gallery' }); } function PreloadGalleryImage(URL) { var GS = document.getElementById('gallery'); var GSP = document.getElementById('gallery_picture_frame'); var GSN = document.getElementById('gallery_navigator'); var Pic = document.getElementById("gallery_picture"); var GalleryImage = new Image(); var ScreenWidth = 0; var ScreenHeight = 0; // height var theHeight = 0; if (window.innerHeight) { theHeight=window.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { theHeight=document.documentElement.clientHeight; } else if (document.body) { theHeight=document.body.clientHeight; } ScreenHeight = theHeight; // width var theWidth = 0; if (window.innerWidth) { theWidth=window.innerWidth; } else if (document.documentElement && document.documentElement.clientWidth) { theWidth=document.documentElement.clientWidth; } else if (document.body) { theWidth=document.body.clientWidth; } ScreenWidth = theWidth; function GalleryResize(NewWidth, NewHeight) { if (NewWidth == 0) { NewWidth = 400; } if (NewHeight == 0) { NewHeight = 400; } var toolbar; if (GSN == null) { toolbar = 0; } else { toolbar = 24; GSN.style.display = "block"; GSN.style.position = "absolute"; GSN.style.left = "16px"; GSN.style.top = "16px"; GSN.style.width = NewWidth + "px"; GSN.style.height = "24px"; } GSP.style.display = "block"; GSP.style.position = "absolute"; GSP.style.left = "16px"; GSP.style.top = (16+toolbar)+"px"; GSP.style.width = NewWidth + "px"; GSP.style.height = NewHeight + "px"; GS.style.left = ((ScreenWidth-NewWidth-32) / 2) + "px"; GS.style.top = ((ScreenHeight-NewHeight-32-toolbar) / 2) + "px"; GS.style.width = (NewWidth+32) + "px"; GS.style.height = (NewHeight+32+toolbar) + "px"; } function ImageLoaded() { // RESIZE WINDOW var NewWidth = GalleryImage.width; var NewHeight = GalleryImage.height; var Prop = 0; if (NewWidth == 0) NewWidth = 400; if (NewHeight == 0) NewHeight = 400; if ((NewWidth > ScreenWidth - 64) || (NewHeight > ScreenHeight - 88)) { if ((NewWidth / (ScreenWidth - 64)) <= (NewHeight / (ScreenHeight - 88))) { Prop = (NewHeight / (ScreenHeight - 88)); if (Prop > 0) { NewWidth = NewWidth / Prop; NewHeight = NewHeight / Prop; } } else { Prop = (NewWidth / (ScreenWidth - 64)); if (Prop > 0) { NewWidth = NewWidth / Prop; NewHeight = NewHeight / Prop; } } } // alert('G6'); Pic.src = GalleryImage.src; GalleryResize(NewWidth, NewHeight); Pic.width = NewWidth; Pic.height = NewHeight; } GalleryImage.onload = ImageLoaded; GalleryImage.src = URL; } function GallerySendMultipleFiles(Input, TargetId, GalleryID, AttachmentType) { Input.setAttribute("disabled", "true"); Target = document.getElementById(TargetId); SendMultipleFiles({ // list of files to upload files: Input.files, url: "/admin/core/gallery/upload&GalleryID="+GalleryID+"&AttachmentType="+AttachmentType, // clear the container onloadstart:function(){ Target.innerHTML = "Príprava súborov ..."; // sub.style.width = bar.style.width = "0px"; }, // do something during upload ... onprogress:function(rpe){ Target.innerHTML = [ "Odosielanie: " + this.file.fileName, "Odoslané: " + size(rpe.loaded) + " z " + size(rpe.total), "Celkom: " + size(this.sent + rpe.loaded) + " z " + size(this.total) ].join("
"); // sub.style.width = ((rpe.loaded * 200 / rpe.total) >> 0) + "px"; // bar.style.width = (((this.sent + rpe.loaded) * 200 / this.total) >> 0) + "px"; }, // fired when last file has been uploaded onload:function(rpe, xhr){ Target.innerHTML += ["", "Odpoveď od servera: " + xhr.responseText ].join("
"); // sub.style.width = bar.style.width = "200px"; Input.removeAttribute("disabled"); }, // if something is wrong ... (from native instance or because of size) onerror:function(){ Target.innerHTML = "Súbor " + this.file.fileName + " je príliš veľký [" + size(this.file.fileSize) + "]"; Input.removeAttribute("disabled"); } }); } var sendFile = 4096000; // maximum allowed file size // should be smaller or equal to the size accepted in the server for each file // function to upload a single file via handler SendFile = (function(toString, maxSize){ var isFunction = function(Function){ return toString.call(Function) === "[object Function]"; }, split = "onabort.onerror.onloadstart.onprogress".split("."), length = split.length; return function(handler){ if(maxSize && maxSize < handler.file.fileSize){ if(isFunction(handler.onerror)) handler.onerror(); return; }; var xhr = new XMLHttpRequest, upload = xhr.upload; for(var xhr = new XMLHttpRequest, upload = xhr.upload, i = 0; i < length; i++ ) upload[split[i]] = (function(event){ return function(rpe){ if(isFunction(handler[event])) handler[event].call(handler, rpe, xhr); }; })(split[i]); upload.onload = function(rpe){ if(handler.onreadystatechange === false){ if(isFunction(handler.onload)) handler.onload(rpe, xhr); } else { setTimeout(function(){ if(xhr.readyState === 4){ if(isFunction(handler.onload)) handler.onload(rpe, xhr); } else setTimeout(arguments.callee, 15); }, 15); } }; xhr.open("post", handler.url, true); xhr.setRequestHeader("If-Modified-Since", "Mon, 26 Jul 1997 05:00:00 GMT"); xhr.setRequestHeader("Cache-Control", "no-cache"); xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); xhr.setRequestHeader("X-File-Name", handler.file.fileName); xhr.setRequestHeader("X-File-Size", handler.file.fileSize); xhr.setRequestHeader("X-File-Type", handler.file.fileType); xhr.setRequestHeader("Content-Type", "multipart/form-data"); xhr.send(handler.file); return handler; }; })(Object.prototype.toString, sendFile); // function to upload multiple files via handler function SendMultipleFiles(handler){ var length = handler.files.length, i = 0, onload = handler.onload; handler.current = 0; handler.total = 0; handler.sent = 0; while(handler.current < length) handler.total += handler.files[handler.current++].fileSize; handler.current = 0; if(length){ handler.file = handler.files[handler.current]; SendFile(handler).onload = function(rpe, xhr){ if(++handler.current < length){ handler.sent += handler.files[handler.current - 1].fileSize; handler.file = handler.files[handler.current]; SendFile(handler).onload = arguments.callee; } else if(onload) { handler.onload = onload; handler.onload(rpe, xhr); } }; }; return handler; }; if(!this.JSON){this.JSON={};} (function(){function f(n){return n<10?'0'+n:n;} if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+ f(this.getUTCMonth()+1)+'-'+ f(this.getUTCDate())+'T'+ f(this.getUTCHours())+':'+ f(this.getUTCMinutes())+':'+ f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};} var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';} function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);} if(typeof rep==='function'){value=rep.call(holder,key,value);} switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';} gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i