(function(){$(document).ready(function(){if($(".dlgError").find(".bd").text()!=""){$(".dlgError").fadeIn("slow").delay("5400").fadeOut("slow")}$(".dlgError").ajaxError(function(i,h,f,g){dlgWait(false);$(this).text("Chyba systému. Požadavek na data se nezdařil.");$(this).show("slow").delay("5400").hide("slow")});$(".nele-module-sortable").sortable({connectWith:".nele-module-sortable"});$(".nele-module .close").click(function(){$(this).parents(".nele-module").hide("slow")});$(".nele-module .min").click(function(){var f=$(this).parents(".nele-module").attr("id");if($(this).hasClass("min")){$(this).removeClass("min").addClass("max").parents(".hd").next().hide("slow");$.yuicookie.setSub("panels",f,"minimized",{path:"/",domain:"levicek.net"})}else{$(this).removeClass("max").addClass("min").parents(".hd").next().show("slow");$.yuicookie.removeSub("panels",f,{path:"/",domain:"levicek.net"})}});$(".nele-module").each(function(){var f=$(this).attr("id");if($.yuicookie.getSub("panels",f)=="minimized"){$(this).find(".min").trigger("click")}$("button",this).button()});$("#loginPanel").each(function(){$("label",this).overlabel()});$("#btnForgotPwd").click(c);$("#modulesPanel").each(function(){});var e=$("#configPanel");if(e.length>0){$("input[type=text]",e).after('<img src="/gallova/images/color-picker.gif" width="10" />').siblings("img").click(b).end().blur(a);$("#btnLoad",e).click(d);$("#btnSave",e).click(function(){var f=function(m){try{var k=$.parseJSON(m.responseText);if(k.no=="0"){if(k.description!=""){setError(k.description)}else{setError("OK: Změny uloženy.")}}else{if(k&&k.description){setError(k.description)}else{setError("Chyba: Neznámá chyba systému.")}}}catch(l){setError("Chyba: Neznámá chyba systému.")}};var j={success:f,failure:handleAjaxFailure};var h=$("#frmConfigPanel").serialize();if(typeof css_new[0]=="undefined"){css_new[0]={name:"default",cfg:h}}else{css_new[0].cfg=h}h=$.toJSON(css_new);var g="a=json&m=gallova&f=saveConfig&cfg="+encodeURIComponent(h);var i="/index.php";YAHOO.util.Connect.asyncRequest("POST",i,j,g)});d()}$("button").button().hover(function(){$(this).addClass("ui-state-hover")},function(){$(this).removeClass("ui-state-hover")})});var c=function(){var g=$(this).parents("form");var e=$("input[name=email]",g);var f=function(){$(this).dialog("close");var i="a=json&f=userForgotPwd&email="+e.val();var h="index.php";$.ajax({context:this,type:"POST",url:h,data:i,dataType:"json",success:function(j){if(j.no=="0"){setError("OK: Heslo Vám bylo zasláno emailem. Prosím, přihlašte se.")}else{if(j&&j.description){setError(j.description)}else{setError("Chyba: Neznámá chyba systému.")}}}})};if(e.val()==""){e.addClass("ui-state-error");setError("Chyba: Zadejte jméno uživatele")}else{e.removeClass("ui-state-error");dlgAlert("Skutečně chcete vygenerovat a zaslat nové heslo?",ALERT_YESNO,f)}};var b=function(f){b.target=$(f.target).siblings("input");if(typeof b.dlg=="undefined"){b.handleSubmit=function(){var e=b.picker.get("hex");b.target.val(e);this.hide();a(b.target[0])};b.handleCancel=function(){this.hide()};b.dlg=new YAHOO.widget.Dialog("colorpicker",{width:"430px",close:true,fixedcenter:true,visible:false,constraintoviewport:true,buttons:[{text:"Submit",handler:b.handleSubmit,isDefault:true},{text:"Cancel",handler:b.handleCancel}]});b.dlg.render();b.dlg.setBody('<div id="picker" style="position:relative;height:220px;"></div>');if(typeof b.picker=="undefined"){b.picker=new YAHOO.widget.ColorPicker("picker",{images:{PICKER_THUMB:"/libs/yui-2.8.0b4/colorpicker/assets/picker_thumb.png",HUE_THUMB:"/libs/yui-2.8.0b4/colorpicker/assets/hue_thumb.png"}})}}b.dlg.show()};var d=function(){var e=function(q){var n,m,r;try{var l=$.parseJSON(q.responseText);if(l.no=="0"){css_new=l.result;n=css_new[0].cfg.split("&");for(var k in n){m=n[k].split("=");r=m[0].substr(0,m[0].indexOf("--"));$("#configPanel #"+m[0]).val(m[1]);if(typeof css_old[m[0]]=="undefined"){css_old[m[0]]=$("."+m[0].replace(r+"--","")).css(r)}if(/[0-9,a-f]{6}/i.test(m[1])){$("."+m[0].replace(r+"--","")).css(r,"#"+m[1])}}}else{if(l&&l.description){setError(l.description)}else{setError("Chyba: Neznámá chyba systému.")}}}catch(p){setError("Chyba: Neznámá chyba systému.")}};var h={success:e,failure:handleAjaxFailure};var f="a=json&m=gallova&f=loadConfig";var g="/index.php";YAHOO.util.Connect.asyncRequest("POST",g,h,f)};var a=function(f){if(typeof f.target=="undefined"){f.target=f}var g=f.target.id.substr(0,f.target.id.indexOf("--"));if(/[0-9,a-f]{6}/i.test(f.target.value)){if(typeof css_old[f.target.id]=="undefined"){css_old[f.target.id]=$("."+f.target.id.replace(g+"--","")).css(g)}$("."+f.target.id.replace(g+"--","")).css(g,"#"+f.target.value)}else{if(typeof css_old[f.target.id]!="undefined"){$("."+f.target.id.replace(g+"--","")).css(g,css_old[f.target.id])}}}})();function getData(a,c,b,f){if(typeof(c)=="string"&&c!=""&&typeof(f)=="object"&&typeof(f.draw)=="function"){var e={a:"json",m:a,f:c};if(typeof(b)=="string"){e.w=encodeURIComponent(b)}$.ajax({url:"index.php",data:e,dataType:"json",success:function(g){for(var d in g.result){if(g.result[d]){f.draw(g.result[d])}}if(typeof(f.finish)=="function"){f.finish()}}})}}function handleAjaxFailure(b){if(b.responseText){var a=ajaxParseRsp(b.responseText);if(a[1]){setError(a[1])}}else{setError("Chyba: Změny se nepodařilo uložit")}}function setError(a){if(setError.t!="undefined"){clearTimeout(setError.t);$(".dlgError").hide()}$(".dlgError").find(".bd").html("<p>"+a+"</p>").end().fadeIn("slow");setError.t=setTimeout('$(".dlgError").fadeOut("slow")',5400)}function dlgWait(a){if(typeof dlgWait.dlg=="undefined"){$('<div id="dlgWait"><img src="/config/images/loading.gif" /></div>').dialog({bgiframe:false,draggable:false,resizable:false,closeOnEscape:false,notitle:true,width:250,minHeight:20,modal:true});dlgWait.dlg=true}if(typeof a=="string"){$("#dlgWait").dialog("option","title",a)}if(a){$("#dlgWait").dialog("open")}else{$("#dlgWait").dialog("close")}}var ALERT_CLOSE={buttons:{"Zrušit":function(){$(this).dialog("close")}}};var ALERT_YESNO={buttons:{Ano:function(){$(this).dialog("close")},Ne:function(){$(this).dialog("close")}}};function dlgAlert(a,c,b){if(typeof dlgAlert.dlg=="undefined"){dlgAlert.dlg=$('<div id="dlgAlert"></div>').dialog({autoOpen:false,modal:true,resizable:false,title:"Pozor"})}if(c===ALERT_CLOSE||(c===ALERT_YESNO&&typeof(b)=="function")){if(c===ALERT_YESNO&&typeof(b)=="function"){c.buttons.Ano=b}dlgAlert.dlg.text(a).dialog("option","buttons",c.buttons).dialog("open")}}function dlgZoom(b,d,c,a){if(typeof a!="object"){a={}}if(typeof a.width!="number"){a.width=400}if(typeof a.style!="string"){a.style=""}if(typeof dlgZoom.dlg=="undefined"){dlgZoom.dlg=new YAHOO.widget.Panel("dlgZoom",{width:a.width+"px",effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25},fixedcenter:true,modal:true,visible:false,draggable:true,close:true,constraintoviewport:true,underlay:"none"});dlgZoom.dlg.render(document.body);if(a.style){$(dlgZoom.dlg.element).children().addClass("rounded").prepend('<div class="tl '+a.style+'"></div><div class="tr '+a.style+'"></div><div class="bl '+a.style+'"></div><div class="br '+a.style+'"></div>')}}dlgZoom.dlg.cfg.setProperty("width",a.width+"px");if(jQuery.isArray(a.position)&&a.position.length==2){dlgZoom.dlg.cfg.setProperty("fixedcenter",false);dlgZoom.dlg.cfg.setProperty("xy",a.position)}else{dlgZoom.dlg.cfg.setProperty("fixedcenter",true)}if(typeof d=="string"&&d!=""){dlgZoom.dlg.setHeader(d)}if(typeof c=="string"&&c!=""){dlgZoom.dlg.setFooter(c)}dlgZoom.dlg.setBody('<div class="center nele-zoom">'+b+"</div>");dlgZoom.dlg.show()};