times&×!==0)||fn.call(element,counter)===false)
jQuery.timer.remove(element,label,fn);};handler.timerID=fn.timerID;if(!timers[label][fn.timerID])
timers[label][fn.timerID]=window.setInterval(handler,interval);this.global.push(element);},remove:function(element,label,fn){var timers=jQuery.data(element,this.dataKey),ret;if(timers){if(!label){for(label in timers)
this.remove(element,label,fn);}else if(timers[label]){if(fn){if(fn.timerID){window.clearInterval(timers[label][fn.timerID]);delete timers[label][fn.timerID];}}else{for(var fn in timers[label]){window.clearInterval(timers[label][fn]);delete timers[label][fn];}}
for(ret in timers[label])break;if(!ret){ret=null;delete timers[label];}}
for(ret in timers)break;if(!ret)
jQuery.removeData(element,this.dataKey);}}}});jQuery(window).bind("unload",function(){jQuery.each(jQuery.timer.global,function(index,item){jQuery.timer.remove(item);});});;(function($){var ph="PLACEHOLDER-INPUT";var phl="PLACEHOLDER-LABEL";var boundEvents=false;var default_options={labelClass:'placeholder'};var input=document.createElement("input");if('placeholder'in input){$.fn.placeholder=$.fn.unplaceholder=function(){};delete input;return;};delete input;$.fn.placeholder=function(options){bindEvents();var opts=$.extend(default_options,options)
this.each(function(){var rnd=Math.random().toString(32).replace(/\./,''),input=$(this),label=$('');if(!input.attr('placeholder')||input.data(ph)===ph)return;if(!input.attr('id'))input.attr('id','input_'+rnd);label.attr('id',input.attr('id')+"_placeholder").data(ph,'#'+input.attr('id')).attr('for',input.attr('id')).addClass(opts.labelClass).addClass(opts.labelClass+'-for-'+this.tagName.toLowerCase()).addClass(phl).text(input.attr('placeholder'));input.data(phl,'#'+label.attr('id')).data(ph,ph).addClass(ph).after(label);itemIn.call(this);itemOut.call(this);});};$.fn.unplaceholder=function(){this.each(function(){var input=$(this),label=$(input.data(phl));if(input.data(ph)!==ph)return;label.remove();input.removeData(ph).removeData(phl).removeClass(ph);});};function bindEvents(){if(boundEvents)return;$('.'+ph).live('click',itemIn).live('focusin',itemIn).live('focusout',itemOut);bound=true;boundEvents=true;};function itemIn(){var input=$(this),label=$(input.data(phl));label.css('display','none');};function itemOut(){var that=this;setTimeout(function(){var input=$(that);$(input.data(phl)).css('top',input.position().top+'px').css('left',input.position().left+'px').css('display',!!input.val()?'none':'block');},200);};}(jQuery));;function showMsg(msg,type){if(typeof type==='undefined')
type='info';var options={duration:2500,sticky:true,type:type};$.toast(msg,options);}
function updateWorkingCopiesCount(){$.get(baseUrl+'kopia-robocza/liczba',function(result){$('#DocumentsDraftCount').text(result.data.count);$('#DocumentsToSuperviseCount').text(result.data.toSuperviseCount);$('#DocumentsSentToSupervisionCount').text(result.data.sentToSupervisionCount);})}
function addUserBarMessage(message,type){var alt='';switch(type){case'warning':alt='Ostrzeżenie';type='';break;case'failure':alt='Operacja zakończona niepowodzeniem';type='danger';break;case'success':alt='Operacja zakończona sukcesem';type='success';break;case'information':default:type='info';alt='Informacja';}
var options={duration:4000,sticky:false,type:type};$.toast.config={width:430,align:'right',closeForStickyOnly:false}
$.toast(message,options);}
$.each($('.toast-msg'),function(){var message=$(this).text();var type=$(this).data('type');addUserBarMessage(message,type);});function bipDefaultAjaxErrorHandler(e,xhr,settings,exception){var error='';error=xhr.responseText;try{result=jQuery.parseJSON(error);}catch(e){result=jQuery.parseJSON('{"data":{},"success":false,"errors":{"default":"'+error+'"}}');}
error=result.errors['default'];var message='';message+='Operacja nie powiodła się
';message+='Przepraszamy, wykonanie tej operacji nie powiodło się. Zanotuj komunikat poniżej, a następnie sprawdź, czy połączenie z Internetem jest dostępne i spróbuj ponownie.
';message+='Przyczyna problemu: '+error+'
';$.msgbox(message,{type:"error",buttons:[{type:"submit",value:"OK",classes:"sexybutton sexysimple"}]});}
function bipFatalAjaxErrorHandler(e,xhr,settings){var error='';error=xhr.responseText;var found=error.search(/(fatal\ error|strict\ standards|warning|notice):/i);if(found!=-1){var message='';message+='Operacja nie powiodła się
';message+='Przepraszamy, wykonanie tej operacji nie powiodło się. Zanotuj komunikat poniżej, a następnie sprawdź, czy połączenie z Internetem jest dostępne i spróbuj ponownie.
';message+='Przyczyna problemu: '+error+'
';$.msgbox(message,{type:"error",buttons:[{type:"submit",value:"OK",classes:"sexybutton sexysimple"}]});return true;}}
function show_hide_ph(el,force){var isSafari=!!navigator.userAgent.match(/Version\/[\d\.]+.*Safari/);if($.browser.firefox){return true;}
if(isSafari){$('#'+el).datepicker("destroy");}
if(force==1){$('#'+el).addClass("hidePlaceholder");return true;}
if(force==2){$('#'+el).removeClass("hidePlaceholder");return true;}
if($('#'+el).val()==''){$('#'+el).removeClass("hidePlaceholder");}
else{$('#'+el).addClass("hidePlaceholder");}}
$(document).ready(function(){$('#external-link-show-input').live('click',function(){$('.create-menu-item-button').addClass("buttons_dn");$('.menu_change_url_input').show();return false;});$('#list-show-input').live('click',function(){$('.create-menu-item-button').addClass("buttons_dn");$('.menu_change_template_input').show();return false;});$("#Category-create").live('submit',function(){if($('#Category-create-name').val()==""){$.msgbox("Muisz podać nazwę pozycji.",{type:"info"});return false;}});var $body=$('body');var button="";$(button).prependTo($('#Container'));$('.navbar-toggle').click(function(e){if($body.hasClass('openNav')){$body.removeClass('openNav');}else{$body.addClass('openNav');}});$('.pageheader').click(function(e){if($body.hasClass('openNav')){$body.removeClass('openNav');}});$('#Page').click(function(e){if($body.hasClass('openNav')){$body.removeClass('openNav');}});$(document).ajaxError(bipDefaultAjaxErrorHandler);$(document).ajaxComplete(bipFatalAjaxErrorHandler);$('.removable-icon').click(function(){$(this).parent().remove();});$('#has_signature_file').change(function(){$('#sig-label').slideToggle();$('#sig').slideToggle();});$("#has_signature_file:checked").change();$("#sb").addClass("sexybutton sexysimple sexyxxl");$(".add_new_user_form input#submit").addClass("sexybutton sexysimple sexyxxl");$('.user_profile_form_message').delay(3000).slideUp("slow");if($.fancybox){var fancyOptions={'autoDimensions':false,'width':'auto','height':'auto','titleShow':false,'transitionIn':'elastic','transitionOut':'elastic'};$(".fancy-link").fancybox(fancyOptions);}
$(".datepicker").datepicker({dateFormat:'yy-mm-dd',onSelect:function(date){show_hide_ph($(this).attr('id'))},});$(".confirmable-link").click(function(){return confirm('Czy na pewno?');});$('input[type="date"], input[type="datetime"], input[type="datetime-local"], input[type="month"], input[type="time"], input[type="week"]').each(function(){var el=this
var el_id=$(el).attr('id');if($.browser.webkit||$.browser.opera||$.browser.safari){show_hide_ph(el_id);$(el).bind('focus, blur',function(){show_hide_ph(el_id);});}});var jsTreeConfig={"core":{"open_parents":false},"plugins":["themes","html_data","dnd","cookies","crrm"],"themes":{"theme":"apple","dots":false,"icons":false},"crrm":{"move":{"check_move":function(m){if(Bip.permissionEnable==true&&Bip.hasRootPermission==false){if($(m.o).parents('li[allowed=yes]').length==0){return false;}
if($(m.np).attr('allowed')!='yes'){return false;}}
if(m.np.is('.menu-category-directory, .menu-category-list')){return true;}else if(m.r.is('.menu-category-directory, .menu-category-filter, .menu-category-link, .menu-category-list, .menu-category-externallink')&&m.np.hasClass('menu')){return true;}else{return false;}}}},"dnd":{drag_check:function(data){if(Bip.permissionEnable==true&&Bip.hasRootPermission==false){if($(data.r).attr('allowed')=='yes'&&$(data.r).parents('li[allowed=yes]').length==0){return{after:false,before:false,inside:true}}else if($(data.r).parents('li[allowed=yes]').length==0){return false;}}
if($(data.o).hasClass('new-menu-icon')){if(data.r.hasClass('menu-category-directory')){return{after:true,before:true,inside:true};}else if(data.r.hasClass('menu-category-list')||data.r.hasClass('menu-category-link')){return{after:true,before:true,inside:false};}else{return false;}}else if($(data.o).hasClass('document-title')){if(data.r.hasClass('menu-category-list')||data.r.hasClass('menu-category-link')){if(data.r.attr('data-id')==$(data.o).attr('data-category-id')){return false;}else{return{after:false,before:false,inside:true};}}else{return false;}}else{return false;}},drag_finish:function(data){var categoryId=$(data.r).attr('data-id');var categoryElement=$(data.r);if($(data.o).hasClass('new-menu-icon')){var a=$('.new-menu-icon').parent();if(!a.attr('data-href')){a.attr('data-href',a.attr('href'));}
a.attr('href',a.attr('data-href')+categoryId+'/'+data.p);a.trigger('click');}else{var documentId=$(data.o).attr('data-id');var documentElement=$(data.o);var message='';message+='Potwierdź przeniesienie dokumentu
';message+='Przeniesienie tego dokumentu spowoduje jego publikację we wskazanej kategorii. Czy na pewno chcesz przenieść ten dokument?
';$.msgbox(message,{type:"confirm",buttons:[{type:"submit",value:"Tak",classes:"sexybutton sexysimple sexyred"},{type:"cancel",value:"Nie",classes:"sexybutton sexysimple"}]},function(result){if(result==="Tak"){$.get(baseUrl+'dokument/przenies/'+documentId+'/do/'+categoryId,function(data){documentElement.parents('li').eq(0).remove();addUserBarMessage('Dokument został przeniesiony','success');if(categoryElement.hasClass('menu-category-link')){categoryElement.children('a').attr('href','/'+data.data.slug+'/edycja');}});}});}}}};if(jQuery.jstree){jQuery.jstree.defaults.themes.url=baseUrl+"css/jstree/apple.css";var menu=$("nav.aside-menu .menu");var licz=0;menu.jstree(jsTreeConfig);menu.bind('loaded.jstree',function(){if(Bip&&Bip.permissionEnable==true){if(Bip.hasRootPermission==false){$(Bip.allowedCategoryList).each(function(index,catId){var id='#menuelement_'+catId;$(id).attr('allowed','yes');$(id+' li').attr('allowed','yes');});$('li[allowed!=yes] > a').removeClass('editable-icon');}}
menu_otw=$(this);ile=$('#Container').find(".js_do_otwarcia").length;if(ile>0){$.each($(".js_do_otwarcia"),function(){licz++;otwieramy=$(this).attr('open_node');menu_otw.jstree("open_node","#menuelement_"+otwieramy+"");if(ile==licz){$("#menuelement_"+otwieramy+"").css('font-weight','bold');}else{$("#menuelement_"+otwieramy+"").css('font-weight','normal');}});}});menu.bind("move_node.jstree",function(event,data){var node=$(data.rslt.o.get(0));var destination=$(data.rslt.r.get(0));var moveType=data.rslt.p;var nodeId=node.attr('id').split('_')[1];var destinationId=destination.attr('id').split('_')[1];if(data.rslt.np.hasClass('menu-category-list')){$.jstree.rollback(data.rlbk);$.get(baseUrl+'dokumenty/przenies/'+nodeId+'/do/'+destinationId,function(data){addUserBarMessage('Dokumenty zostały przeniesione','success');});}else{$.get(baseUrl+'menu/przenies/'+nodeId+'/do/'+destinationId+'/'+moveType,function(data){addUserBarMessage('Pomyślnie przeniesiono kategorię','success');});}});menu.delegate("a.category","click",function(e){$("nav.aside-menu .menu").jstree("toggle_node",this);e.preventDefault();return false;});menu.slideDown();$('#Category-create-type').live('change',function(e){if($(this).val()=='externallink'){$('.menu_change_url_input').show();}else{$('.menu_change_url_input').hide();}});$('#Category-edit').live('submit',function(e){var element=$('#menuelement_'+window.categoryId);$.fancybox.showActivity();$(this).ajaxSubmit({success:function(response){menu.jstree('rename_node',element,response.data.name);if(element.hasClass('menu-category-list')){element.children('a').eq(0).attr('href',baseUrl+'lista/'+response.data.slug);}else if(element.hasClass('menu-category-externallink')){element.children('a').eq(0).attr('href',response.data.url);}
$.fancybox.close();}});return false;});$('#Category-edit-delete').live('click',function(){var element=$('#menuelement_'+window.categoryId);var href=this.href;var message='';message+='Potwierdź usunięcie kategorii
';message+='Usunięcie kategorii spowoduje przeniesienie wszystkich jej dokumentów do kopii roboczych. Czy na pewno chcesz usunąć tę kategorię?
';$.msgbox(message,{type:"confirm",buttons:[{type:"submit",value:"Tak",classes:"sexybutton sexysimple sexyred"},{type:"cancel",value:"Nie",classes:"sexybutton sexysimple"}]},function(result){if(result==="Tak"){$.fancybox.showActivity();$.ajax({url:href,success:function(response){$.fancybox.close();addUserBarMessage('Kategoria została usunięta','success');element.remove();updateWorkingCopiesCount();},error:function(){$.fancybox.close();}});}});return false;});}
$('#f-category-supervisor').live('submit',function(){$(this).ajaxSubmit({success:function(){$.msgbox("Ustawienia nadzoru zostały zaktualizowane",{type:"info",buttons:[{type:"submit",value:"OK",classes:"sexybutton sexysimple"}]});},error:function(){$.fancybox.close();}});return false;});$('#isSupervisionEnabled').live('change',function(){if($(this).is(':checked'))
$('#supervisorUser').attr('disabled',null);else
$('#supervisorUser').attr('disabled','disabled');});$('#f-category-allow').live('submit',function(){var option=$(this).find('option:selected');$(this).ajaxSubmit({success:function(){var li=''+$(option).text()+' [x]';$('ul.perm').append(li);$(option).remove();},error:function(){$.fancybox.close();}});return false;});$('#f-category-allow a.permDel').live('click',function(){var li=$(this).parents('li[user_id]');$.ajax({url:'/kategoria/odrzuc',type:'post',data:{user_id:$(this).parents('li[user_id]').attr('user_id'),category_id:$('#f-category-allow input[type=hidden]').val()},success:function(){$(li).children('a').remove();var optVal=$(li).attr('user_id');var optName=$.trim($(li).text());var opt='';$(li).remove();$('#f-category-allow select').append(opt);},error:function(){$.fancybox.close();}});return false;});$('.sortable').sortable();$('input.placeholder[placeholder],textarea.placeholder[placeholder]').placeholder();$('.clearOnFocus').live('focus',function(){$(this).val('');});if($.jBreadCrumb)$("#breadCrumb1").jBreadCrumb();if($.fancybox){$("a#single_image").fancybox();$("#AuthAnchor").fancybox({'hideOnContentClick':false,'onComplete':function(){$('#AuthLogin').focus();}});$("a.group").fancybox({'transitionIn':'elastic','transitionOut':'elastic','speedIn':600,'speedOut':200,'overlayShow':false});$('#unpublish-anchor').fancybox({'hideOnContentClick':false});$('#publish-again-anchor').fancybox({'hideOnContentClick':false});}
var filterForm=$('#Filter');var filterType=$('#Filter input[name=type]');var filterQuery=$('#Filter input[name=query]');var type=filterType.val();$('a.document-type-switch[href=#'+type+']').removeClass('sexysmall');$('a.document-type-switch').click(function(){filterType.val(this.href.split('#')[1]);filterForm.submit();return false;});$('a.print_button').click(function(){window.print();return false;});$("#Tell_everyone_button").mouseover(function(){$("#Tell_everyone").slideDown(400);});$("#Tell_everyone_button").mouseout(function(){$("#Tell_everyone").show();});$("#Tell_everyone").mouseover(function(){$("#Tell_everyone").show();});$("#Tell_everyone").mouseout(function(){$("#Tell_everyone").hide();});$("#bigger_A").click(function(){$(".document").css("font-size","120%");$("body").addClass("big-font")});$("#small_A").click(function(){$(".document").css("font-size","100%");$("body").removeClass("big-font")});$('.history tr:odd').css("background-color","#fafafa");$('.history tr:even').css("background-color","#f7f7f7");$("#Case_status_results tr:odd").css("background","#f7f7f7");});$(function(){$('#menuZapisz').click(function(){$.ajax({type:"POST",cache:false,url:"/menu/zapisz/",success:function(){$.msgbox("Cache został wyczyszczony i wygenerowany.",{type:"info",buttons:[{type:"submit",value:"OK",classes:"sexybutton sexysimple"}]});}});});if(Bip.permissionEnable==true){$('#perm_root_category-label > label').removeClass('dn');$('#perm_root_category-element').removeClass('dn');$('#permSave').click(function(){$.ajax({type:"POST",cache:false,url:"/kategoria/zezwol",params:{category_id:window.categoryId,user_id:$('#permUser').val()},success:function(){$.msgbox("Cache został wyczyszczony i wygenerowany.",{type:"info",buttons:[{type:"submit",value:"OK",classes:"sexybutton sexysimple"}]});}});});}
$('#unpublish button.cancel, #publish-again button.cancel, ').click(function(e){$.fancybox.close();e.preventDefault();})});function getCookie(cname){var name=cname+"=";var ca=document.cookie.split(';');for(var i=0;i0){$("body").removeClass("text_height");}else{$("body").addClass("text_height");}});$("#text_width").click(function(){if($("body.text_width").length>0){$("body").removeClass("text_width");}else{$("body").addClass("text_width");}});$("#contrast").click(function(){if($("body.contrast").length>0){$("html").css('background',$("body").css('background'));$("body").removeClass("contrast");$("#contrast").html('');document.cookie="contrast=false;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/";}else{$("html").css('background','#626262');$("body").addClass("contrast");$("#contrast").html('');document.cookie="contrast=true;expires=Fri, 31 Dec 9999 23:59:59 GMT;path=/";}});