jQuery.fn.extend({everyTime:function(b,c,d,e,a){return this.each(function(){jQuery.timer.add(this,b,c,d,e,a)})},oneTime:function(a,b,c){return this.each(function(){jQuery.timer.add(this,a,b,c,1)})},stopTime:function(a,b){return this.each(function(){jQuery.timer.remove(this,a,b)})}});(function(c){c.ui=c.ui||{};c.extend(c.ui,{plugin:{add:function(e,f,h){var g=c.ui[e].prototype;for(var d in h){g.plugins[d]=g.plugins[d]||[];g.plugins[d].push([f,h[d]])}},call:function(d,e,g){var h=d.plugins[e];if(!h){return}for(var f=0;f<h.length;f++){if(d.options[h[f][0]]){h[f][1].apply(d.element,g)}}}},cssCache:{},css:function(d){if(c.ui.cssCache[d]){return c.ui.cssCache[d]}var f=c('<div class="ui-resizable-gen">').addClass(d).css({position:"absolute",top:"-5000px",left:"-5000px",display:"block"}).appendTo("body");c.ui.cssCache[d]=!!((!/auto|default/.test(f.css("cursor"))||(/^[1-9]/).test(f.css("height"))||(/^[1-9]/).test(f.css("width"))||!(/none/).test(f.css("backgroundImage"))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(f.css("backgroundColor"))));try{c("body").get(0).removeChild(f.get(0))}catch(g){}return c.ui.cssCache[d]},disableSelection:function(d){d.unselectable="on";d.onselectstart=function(){return false};if(d.style){d.style.MozUserSelect="none"}},enableSelection:function(d){d.unselectable="off";d.onselectstart=function(){return true};if(d.style){d.style.MozUserSelect=""}},hasScroll:function(h,f){var d=/top/.test(f||"top")?"scrollTop":"scrollLeft",g=false;if(h[d]>0){return true}h[d]=1;g=h[d]>0?true:false;h[d]=0;return g}});c.each(["Left","Top"],function(e,d){if(!c.fn["scroll"+d]){c.fn["scroll"+d]=function(f){return f!=undefined?this.each(function(){this==window||this==document?window.scrollTo(d=="Left"?f:c(window)["scrollLeft"](),d=="Top"?f:c(window)["scrollTop"]()):this["scroll"+d]=f}):this[0]==window||this[0]==document?self[(d=="Left"?"pageXOffset":"pageYOffset")]||c.boxModel&&document.documentElement["scroll"+d]||document.body["scroll"+d]:this[0]["scroll"+d]}}});var b=c.fn.remove;c.fn.extend({position:function(){var f=this.offset();var e=this.offsetParent();var d=e.offset();return{top:f.top-a(this[0],"marginTop")-d.top-a(e,"borderTopWidth"),left:f.left-a(this[0],"marginLeft")-d.left-a(e,"borderLeftWidth")}},offsetParent:function(){var d=this[0].offsetParent;while(d&&(!/^body|html$/i.test(d.tagName)&&c.css(d,"position")=="static")){d=d.offsetParent}return c(d)},mouseInteraction:function(d){return this.each(function(){new c.ui.mouseInteraction(this,d)})},removeMouseInteraction:function(d){return this.each(function(){if(c.data(this,"ui-mouse")){c.data(this,"ui-mouse").destroy()}})},remove:function(){jQuery("*",this).add(this).trigger("remove");return b.apply(this,arguments)}});function a(d,e){return parseInt(c.curCSS(d.jquery?d[0]:d,e,true))||0}c.ui.mouseInteraction=function(f,e){var d=this;this.element=f;c.data(this.element,"ui-mouse",this);this.options=c.extend({},e);c(f).bind("mousedown.draggable",function(){return d.click.apply(d,arguments)});if(c.browser.msie){c(f).attr("unselectable","on")}c(f).mouseup(function(){if(d.timer){clearInterval(d.timer)}})};c.extend(c.ui.mouseInteraction.prototype,{destroy:function(){c(this.element).unbind("mousedown.draggable")},trigger:function(){return this.click.apply(this,arguments)},click:function(g){if(g.which!=1||c.inArray(g.target.nodeName.toLowerCase(),this.options.dragPrevention||[])!=-1||(this.options.condition&&!this.options.condition.apply(this.options.executor||this,[g,this.element]))){return true}var f=this;var d=function(){f._MP={left:g.pageX,top:g.pageY};c(document).bind("mouseup.draggable",function(){return f.stop.apply(f,arguments)});c(document).bind("mousemove.draggable",function(){return f.drag.apply(f,arguments)});if(!f.initalized&&Math.abs(f._MP.left-g.pageX)>=f.options.distance||Math.abs(f._MP.top-g.pageY)>=f.options.distance){if(f.options.start){f.options.start.call(f.options.executor||f,g,f.element)}if(f.options.drag){f.options.drag.call(f.options.executor||f,g,this.element)}f.initialized=true}};if(this.options.delay){if(this.timer){clearInterval(this.timer)}this.timer=setTimeout(d,this.options.delay)}else{d()}return false},stop:function(d){var f=this.options;if(!this.initialized){return c(document).unbind("mouseup.draggable").unbind("mousemove.draggable")}if(this.options.stop){this.options.stop.call(this.options.executor||this,d,this.element)}c(document).unbind("mouseup.draggable").unbind("mousemove.draggable");this.initialized=false;return false},drag:function(d){var f=this.options;if(c.browser.msie&&!d.button){return this.stop.apply(this,[d])}if(!this.initialized&&(Math.abs(this._MP.left-d.pageX)>=f.distance||Math.abs(this._MP.top-d.pageY)>=f.distance)){if(this.options.start){this.options.start.call(this.options.executor||this,d,this.element)}this.initialized=true}else{if(!this.initialized){return false}}if(f.drag){f.drag.call(this.options.executor||this,d,this.element)}return false}})})(jQuery);(function(a){a.fn.extend({slider:function(c){var b=Array.prototype.slice.call(arguments,1);if(c=="value"){return a.data(this[0],"slider").value(arguments[1])}return this.each(function(){if(typeof c=="string"){var d=a.data(this,"slider");if(d){d[c].apply(d,b)}}else{if(!a.data(this,"slider")){new a.ui.slider(this,c)}}})}});a.ui.slider=function(d,c){var b=this;this.element=a(d);a.data(d,"slider",this);this.element.addClass("ui-slider");this.options=a.extend({},a.ui.slider.defaults,c);var e=this.options;a.extend(e,{axis:e.axis||(d.offsetWidth<d.offsetHeight?"vertical":"horizontal"),max:!isNaN(parseInt(e.max,10))?{x:parseInt(e.max,10),y:parseInt(e.max,10)}:({x:e.max&&e.max.x||100,y:e.max&&e.max.y||100}),min:!isNaN(parseInt(e.min,10))?{x:parseInt(e.min,10),y:parseInt(e.min,10)}:({x:e.min&&e.min.x||0,y:e.min&&e.min.y||0})});e.realMax={x:e.max.x-e.min.x,y:e.max.y-e.min.y};e.stepping={x:e.stepping&&e.stepping.x||parseInt(e.stepping,10)||(e.steps&&e.steps.x?e.realMax.x/e.steps.x:0),y:e.stepping&&e.stepping.y||parseInt(e.stepping,10)||(e.steps&&e.steps.y?e.realMax.y/e.steps.y:0)};a(d).bind("setData.slider",function(g,f,h){b.options[f]=h}).bind("getData.slider",function(g,f){return b.options[f]});this.handle=a(e.handle,d);if(!this.handle.length){b.handle=b.generated=a(e.handles||[0]).map(function(){var f=a("<div/>").addClass("ui-slider-handle").appendTo(d);if(this.id){f.attr("id",this.id)}return f[0]})}a(this.handle).mouseInteraction({executor:this,delay:e.delay,distance:e.distance!=undefined?e.distance:1,dragPrevention:e.prevention?e.prevention.toLowerCase().split(","):["input","textarea","button","select","option"],start:this.start,stop:this.stop,drag:this.drag,condition:function(g,f){if(!this.disabled){if(this.currentHandle){this.blur(this.currentHandle)}this.focus(f,1);return !this.disabled}}}).wrap('<a href="javascript:void(0)" style="cursor:default;"></a>').parent().bind("focus",function(f){b.focus(this.firstChild)}).bind("blur",function(f){b.blur(this.firstChild)}).bind("keydown",function(f){if(/(37|38|39|40)/.test(f.keyCode)){b.moveTo({x:/(37|39)/.test(f.keyCode)?(f.keyCode==37?"-":"+")+"="+b.oneStep(1):null,y:/(38|40)/.test(f.keyCode)?(f.keyCode==38?"-":"+")+"="+b.oneStep(2):null},this.firstChild)}});this.actualSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.element.bind("mousedown.slider",function(f){b.click.apply(b,[f]);b.currentHandle.data("ui-mouse").trigger(f);b.firstValue=b.firstValue+1});a.each(e.handles||[],function(f,g){b.moveTo(g.start,f,true)});if(!isNaN(e.startValue)){this.moveTo(e.startValue,0,true)}if(this.handle.length==1){this.previousHandle=this.handle}if(this.handle.length==2&&e.range){this.createRange()}};a.extend(a.ui.slider.prototype,{plugins:{},createRange:function(){this.rangeElement=a("<div></div>").addClass("ui-slider-range").css({position:"absolute"}).appendTo(this.element);this.updateRange()},updateRange:function(){var c=this.options.axis=="vertical"?"top":"left";var b=this.options.axis=="vertical"?"height":"width";this.rangeElement.css(c,parseInt(a(this.handle[0]).css(c),10)+this.handleSize(0,this.options.axis=="vertical"?2:1)/2);this.rangeElement.css(b,parseInt(a(this.handle[1]).css(c),10)-parseInt(a(this.handle[0]).css(c),10))},getRange:function(){return this.rangeElement?this.convertValue(parseInt(this.rangeElement.css(this.options.axis=="vertical"?"height":"width"),10)):null},ui:function(b){return{instance:this,options:this.options,handle:this.currentHandle,value:this.options.axis!="both"||!this.options.axis?Math.round(this.value(null,this.options.axis=="vertical"?2:1)):{x:Math.round(this.value(null,1)),y:Math.round(this.value(null,2))},range:this.getRange()}},propagate:function(c,b){a.ui.plugin.call(this,c,[b,this.ui()]);this.element.triggerHandler(c=="slide"?c:"slide"+c,[b,this.ui()],this.options[c])},destroy:function(){this.element.removeClass("ui-slider ui-slider-disabled").removeData("slider").unbind(".slider");this.handle.removeMouseInteraction();this.generated&&this.generated.remove()},enable:function(){this.element.removeClass("ui-slider-disabled");this.disabled=false},disable:function(){this.element.addClass("ui-slider-disabled");this.disabled=true},focus:function(b,c){this.currentHandle=a(b).addClass("ui-slider-handle-active");if(c){this.currentHandle.parent()[0].focus()}},blur:function(b){a(b).removeClass("ui-slider-handle-active");if(this.currentHandle&&this.currentHandle[0]==b){this.previousHandle=this.currentHandle;this.currentHandle=null}},value:function(d,b){if(this.handle.length==1){this.currentHandle=this.handle}if(!b){b=this.options.axis=="vertical"?2:1}var c=((parseInt(a(d!=undefined&&d!==null?this.handle[d]||d:this.currentHandle).css(b==1?"left":"top"),10)/(this.actualSize[b==1?"width":"height"]-this.handleSize(null,b)))*this.options.realMax[b==1?"x":"y"])+this.options.min[b==1?"x":"y"];var e=this.options;if(e.stepping[b==1?"x":"y"]){c=Math.round(c/e.stepping[b==1?"x":"y"])*e.stepping[b==1?"x":"y"]}return c},convertValue:function(c,b){if(!b){b=this.options.axis=="vertical"?2:1}return this.options.min[b==1?"x":"y"]+(c/(this.actualSize[b==1?"width":"height"]-this.handleSize(null,b)))*this.options.realMax[b==1?"x":"y"]},translateValue:function(c,b){if(!b){b=this.options.axis=="vertical"?2:1}return((c-this.options.min[b==1?"x":"y"])/this.options.realMax[b==1?"x":"y"])*(this.actualSize[b==1?"width":"height"]-this.handleSize(null,b))},handleSize:function(c,b){if(!b){b=this.options.axis=="vertical"?2:1}return a(c!=undefined&&c!==null?this.handle[c]:this.currentHandle)[b==1?"outerWidth":"outerHeight"]()},click:function(c){var d=[c.pageX,c.pageY];var b=false;this.handle.each(function(){if(this==c.target){b=true}});if(b||this.disabled||!(this.currentHandle||this.previousHandle)){return}if(this.previousHandle){this.focus(this.previousHandle,1)}this.offset=this.element.offset();this.moveTo({y:this.convertValue(c.pageY-this.offset.top-this.currentHandle.outerHeight()/2),x:this.convertValue(c.pageX-this.offset.left-this.currentHandle.outerWidth()/2)},null,true)},start:function(c,b){var d=this.options;if(!this.currentHandle){this.focus(this.previousHandle,true)}this.offset=this.element.offset();this.handleOffset=this.currentHandle.offset();this.clickOffset={top:c.pageY-this.handleOffset.top,left:c.pageX-this.handleOffset.left};this.firstValue=this.value();this.propagate("start",c);return false},stop:function(b){this.propagate("stop",b);if(this.firstValue!=this.value()){this.propagate("change",b)}this.focus(this.currentHandle,true);return false},oneStep:function(b){if(!b){b=this.options.axis=="vertical"?2:1}return this.options.stepping[b==1?"x":"y"]?this.options.stepping[b==1?"x":"y"]:(this.options.realMax[b==1?"x":"y"]/this.actualSize[b==1?"width":"height"])*5},translateRange:function(d,b){if(this.rangeElement){if(this.currentHandle[0]==this.handle[0]&&d>=this.translateValue(this.value(1),b)){d=this.translateValue(this.value(1,b)-this.oneStep(b),b)}if(this.currentHandle[0]==this.handle[1]&&d<=this.translateValue(this.value(0),b)){d=this.translateValue(this.value(0,b)+this.oneStep(b))}}if(this.options.handles){var c=this.options.handles[this.handleIndex()];if(d<this.translateValue(c.min,b)){d=this.translateValue(c.min,b)}else{if(d>this.translateValue(c.max,b)){d=this.translateValue(c.max,b)}}}return d},handleIndex:function(){return this.handle.index(this.currentHandle[0])},translateLimits:function(c,b){if(!b){b=this.options.axis=="vertical"?2:1}if(c>=this.actualSize[b==1?"width":"height"]-this.handleSize(null,b)){c=this.actualSize[b==1?"width":"height"]-this.handleSize(null,b)}if(c<=0){c=0}return c},drag:function(f,d){var g=this.options;var b={top:f.pageY-this.offset.top-this.clickOffset.top,left:f.pageX-this.offset.left-this.clickOffset.left};if(!this.currentHandle){this.focus(this.previousHandle,true)}b.left=this.translateLimits(b.left,1);b.top=this.translateLimits(b.top,2);if(g.stepping.x){var c=this.convertValue(b.left,1);c=Math.round(c/g.stepping.x)*g.stepping.x;b.left=this.translateValue(c,1)}if(g.stepping.y){var c=this.convertValue(b.top,2);c=Math.round(c/g.stepping.y)*g.stepping.y;b.top=this.translateValue(c,2)}b.left=this.translateRange(b.left,1);b.top=this.translateRange(b.top,2);if(g.axis!="vertical"){this.currentHandle.css({left:b.left})}if(g.axis!="horizontal"){this.currentHandle.css({top:b.top})}if(this.rangeElement){this.updateRange()}this.propagate("slide",f);return false},moveTo:function(f,e,g){var h=this.options;if(e==undefined&&!this.currentHandle&&this.handle.length!=1){return false}if(e==undefined&&!this.currentHandle){e=0}if(e!=undefined){this.currentHandle=this.previousHandle=a(this.handle[e]||e)}if(f.x!==undefined&&f.y!==undefined){var b=f.x;var i=f.y}else{var b=f,i=f}if(b&&b.constructor!=Number){var d=/^\-\=/.test(b),c=/^\+\=/.test(b);if(d){b=this.value(null,1)-parseInt(b.replace("-=",""),10)}else{if(c){b=this.value(null,1)+parseInt(b.replace("+=",""),10)}}}if(i&&i.constructor!=Number){var d=/^\-\=/.test(i),c=/^\+\=/.test(i);if(d){i=this.value(null,2)-parseInt(i.replace("-=",""),10)}else{if(c){i=this.value(null,2)+parseInt(i.replace("+=",""),10)}}}if(h.axis!="vertical"&&b){if(h.stepping.x){b=Math.round(b/h.stepping.x)*h.stepping.x}b=this.translateValue(b,1);b=this.translateLimits(b,1);b=this.translateRange(b,1);this.currentHandle.css({left:b})}if(h.axis!="horizontal"&&i){if(h.stepping.y){i=Math.round(i/h.stepping.y)*h.stepping.y}i=this.translateValue(i,2);i=this.translateLimits(i,2);i=this.translateRange(i,2);this.currentHandle.css({top:i})}if(this.rangeElement){this.updateRange()}if(!g){this.propagate("start",null);this.propagate("stop",null);this.propagate("change",null);this.propagate("slide",null)}}});a.ui.slider.defaults={handle:".ui-slider-handle"}})(jQuery);jQuery.extend({timer:{guid:1,global:{},regex:/^([0-9]+)\s*(.*s)?$/,powers:{ms:1,cs:10,ds:100,s:1000,das:10000,hs:100000,ks:1000000},timeParse:function(c){if(c==undefined||c==null){return null}var a=this.regex.exec(jQuery.trim(c.toString()));if(a[2]){var b=parseInt(a[1],10);var d=this.powers[a[2]]||1;return b*d}else{return c}},add:function(e,c,d,g,h,b){var a=0;if(jQuery.isFunction(d)){if(!h){h=g}g=d;d=c}c=jQuery.timer.timeParse(c);if(typeof c!="number"||isNaN(c)||c<=0){return}if(h&&h.constructor!=Number){b=!!h;h=0}h=h||0;b=b||false;if(!e.$timers){e.$timers={}}if(!e.$timers[d]){e.$timers[d]={}}g.$timerID=g.$timerID||this.guid++;var f=function(){if(b&&this.inProgress){return}this.inProgress=true;if((++a>h&&h!==0)||g.call(e,a)===false){jQuery.timer.remove(e,d,g)}this.inProgress=false};f.$timerID=g.$timerID;if(!e.$timers[d][g.$timerID]){e.$timers[d][g.$timerID]=window.setInterval(f,c)}if(!this.global[d]){this.global[d]=[]}this.global[d].push(e)},remove:function(c,b,d){var e=c.$timers,a;if(e){if(!b){for(b in e){this.remove(c,b,d)}}else{if(e[b]){if(d){if(d.$timerID){window.clearInterval(e[b][d.$timerID]);delete e[b][d.$timerID]}}else{for(var d in e[b]){window.clearInterval(e[b][d]);delete e[b][d]}}for(a in e[b]){break}if(!a){a=null;delete e[b]}}}for(a in e){break}if(!a){c.$timers=null}}}}});if(jQuery.browser.msie){jQuery(window).one("unload",function(){var d=jQuery.timer.global;for(var a in d){var c=d[a],b=c.length;while(--b){jQuery.timer.remove(c[b],a)}}})}jQuery.cookie=function(b,j,m){if(typeof j!="undefined"){m=m||{};if(j===null){j="";m.expires=-1}var e="";if(m.expires&&(typeof m.expires=="number"||m.expires.toUTCString)){var f;if(typeof m.expires=="number"){f=new Date();f.setTime(f.getTime()+(m.expires*24*60*60*1000))}else{f=m.expires}e="; expires="+f.toUTCString()}var l=m.path?"; path="+(m.path):"";var g=m.domain?"; domain="+(m.domain):"";var a=m.secure?"; secure":"";document.cookie=[b,"=",encodeURIComponent(j),e,l,g,a].join("")}else{var d=null;if(document.cookie&&document.cookie!=""){var k=document.cookie.split(";");for(var h=0;h<k.length;h++){var c=jQuery.trim(k[h]);if(c.substring(0,b.length+1)==(b+"=")){d=decodeURIComponent(c.substring(b.length+1));break}}}return d}};(function(b){if(typeof a!="object"||a==null){var a={}}a.ajax={};a.ajax.commonErrorMesage=function(e,c,d){var f=c;if(typeof(e)=="object"&&e!=null){if(typeof(e.status)!="undefined"&&e.status!=""){f+=": "+e.status}if(typeof(e.statusText)!="undefined"&&e.statusText!=""){f+=", "+e.statusText}if(typeof(e.responseText)!="undefined"&&e.responseText!=""){f+="<br />"+e.responseText}}return f};a.extendClass=function(d,c){var e=function(){};e.prototype=d.prototype;c.prototype=b.extend(new e,c.prototype,{constructor:c})};a.Destructable=(function(){var c=function(){var d=this;this.__unload=function(f){if(typeof d=="object"&&d!=null){d.destructor();d=null}};b(window).bind("unload",this.__unload)};c.prototype={destructor:function(){b(window).unbind("unload",this.__unload)}};return c})();a.VoteStarsLight=(function(){var d=a.Destructable;var c={mark:'<div class="mark" style="width:0px;"></div>',state:".state",starWidth:11,method:"post",url:"#",data:{},idSep:"-",loadinfo:'<div class="loadinfo">Zapisuję...</div>'};var e=function(g,f){if(typeof g.get(0).__votestarslight!="undefined"&&g.get(0).__votestarslight instanceof e){return g.get(0).__votestarslight}d.apply(this);this.settings=f;this.jSet=g;this.jSet.get(0).__votestarslight=this;return this};e.prototype={init:function(){if(typeof this.inited!="undefined"&&this.inited==true){return}this.settings=b.extend({},c,this.settings);this.xhr=null;this.LoadInfo=null;this.currentVote=null;this.width=this.jSet.width();this.jMark=b(this.settings.mark).appendTo(this.jSet);var f=this;var g=null;this.jSet.bind("mouseover mousemove",function(i){var h=i.pageX-f.jSet.offset().left;f.jMark.width(h>f.width?f.width:h)}).bind("mouseout",function(h){f.jMark.width(0)}).bind("click",function(h){if(typeof h.pageX!="number"){h.pageX=f.pageX}h.preventDefault();var i=f.getNum(h);if(i==f.currentVote){return false}if(f.xhr!=null){f.xhr.abort()}f.jMark.width(0);f.showLoadInfo();f.xhr=b.ajax({url:f.settings.url+f.getId()+f.settings.idSep+i,type:f.settings.method,data:f.settings.data,success:function(j){f.hideLoadInfo();f.mark(i);f.xhr=null},error:function(l,j,k){f.hideLoadInfo();f.xhr=null;alert(a.ajax.commonErrorMesage(l,j,k))}});return false});this.inited=true},destroy:function(){this.jSet.unbind();if(typeof this.jMark=="object"&&this.jMark!=null){this.jMark.remove();this.jMark=null}if(typeof this.LoadInfo=="object"&&this.LoadInfo!=null){this.LoadInfo.remove();this.LoadInfo=null}if(typeof this.settings.state!="undefined"){this.jSet.find(this.settings.state).width(0)}this.inited=false},getId:function(){return((typeof this.id=="number")?(this.id):(this.id=+this.jSet.attr("className").match(/\d+/)))},getNum:function(g){var h=Math.ceil((g.pageX-this.jSet.offset().left)/this.settings.starWidth);var f=this.jSet.width();return h>f?f:h},readCurrentVote:function(){this.currentVote=Math.round(this.jSet.find(this.settings.state).width()/this.settings.starWidth)},mark:function(f){if(this.currentVote==f){return}this.currentVote=f;this.jSet.find(this.settings.state).width(f*this.settings.starWidth)},reset:function(){this.mark(0)},showLoadInfo:function(){if(this.LoadInfo==null){this.LoadInfo=b(this.settings.loadinfo).appendTo(this.jSet)}this.jSet.find(this.settings.state).hide();this.LoadInfo.show()},hideLoadInfo:function(){this.jSet.find(this.settings.state).show();this.LoadInfo.hide()},destructor:function(){d.prototype.destructor.apply(this);if(typeof this.jSet=="object"&&this.jSet instanceof b&&typeof this.jSet.get(0).__votestarslight=="object"&&this.jSet.get(0).__votestarslight instanceof a.VoteStarsLight){this.jSet.get(0).__votestarslight=null;this.jSet.get(0).__votestarslight}this.jSet=null;this.jMark=null;this.LoadInfo=null;if(this.xhr!=null){this.xhr.abort();this.xhr=null}}};e.setEnv=function(){switch(arguments.length){case 1:if(typeof arguments[0]=="object"){b.extend(c,arguments[0])}case 2:if(typeof arguments[0]=="string"){c[arguments[0]]=arguments[1]}}};a.extendClass(d,e);return e})();a.VoteBoxLight=(function(){var d=a.Destructable;var c={votes:".vote:first",votesSettings:{},disableUrlSuffix:"delete",enableUrlSuffix:"0",method:"post",data:{},url:"#",idSep:"-",checkbox:"input:first",label:"label span:first",loadinfo:"Zapisuję..."};var e=function(h,g){if(typeof h.get(0).__voteboxlight!="undefined"&&h.get(0).__voteboxlight instanceof e){return h.get(0).__voteboxlight}d.apply(this);this.settings=g;var f=this;(this.jSet=h).bind("mouseover",function(i){f.init();if(f.jSet.find(f.settings.checkbox).attr("checked")&&(typeof f.votes.inited=="undefined"||f.votes.inited===false)){f.votes.init()}});this.jSet.get(0).__voteboxlight=this;return this};e.prototype={init:function(){if(typeof this.inited!="undefined"&&this.inited==true){return}this.xhr=null;this.settings=b.extend({},c,this.settings);this.votes=new a.VoteStarsLight(this.jSet.find(this.settings.votes),this.settings.votesSettings);this.votes.id=this.getId();var f=this;this.jSet.find(this.settings.checkbox).bind("click",function(g){switch(f.jSet.find(f.settings.checkbox).attr("checked")){case true:f.enable();break;case false:f.disable();break}});this.inited=true},getId:function(){return((typeof this.id=="number")?(this.id):(this.id=+this.jSet.attr("className").match(/\d+/)))},enable:function(){if(typeof this.votes.inited!="undefined"&&this.votes.inited==true){return}if(this.xhr!=null){this.xhr.abort()}this.showLoadInfo();var f=this;this.xhr=b.ajax({url:this.settings.url+this.getId()+this.settings.idSep+this.settings.enableUrlSuffix,type:this.settings.method,data:this.settings.data,success:function(){f.votes.init();f.hideLoadInfo();f.xhr=null},error:function(i,g,h){f.hideLoadInfo();f.xhr=null;alert(a.ajax.commonErrorMesage(i,g,h))}})},disable:function(){if(typeof this.votes.inited=="undefined"||this.votes.inited==false){return}if(this.xhr!=null){this.xhr.abort()}this.showLoadInfo();var f=this;this.xhr=b.ajax({url:this.settings.url+this.getId()+this.settings.idSep+this.settings.disableUrlSuffix,type:this.settings.method,data:this.settings.data,success:function(){f.hideLoadInfo();f.destroyVotes();f.xhr=null},error:function(i,g,h){f.hideLoadInfo();f.xhr=null;alert(a.ajax.commonErrorMesage(i,g,h))}})},showLoadInfo:function(){if(typeof this.labelText=="undefined"){this.labelText=this.jSet.find(this.settings.label).text()}this.jSet.find(this.settings.label).text(this.settings.loadinfo)},hideLoadInfo:function(){if(typeof this.labelText!="undefined"){this.jSet.find(this.settings.label).text(this.labelText)}},destroyVotes:function(){if(typeof this.votes!="object"||!(this.votes instanceof a.VoteStarsLight)||typeof this.votes.inited=="undefined"||this.votes.inited==false){return}var f=this;this.votes.destroy()},destructor:function(){d.prototype.destructor.apply(this);this.jSet=null}};e.setEnv=function(){switch(arguments.length){case 1:if(typeof arguments[0]=="object"){b.extend(c,arguments[0])}case 2:if(typeof arguments[0]=="string"){c[arguments[0]]=arguments[1]}}};a.extendClass(d,e);return e})();b.voteStarsLightSetEnv=function(c){a.VoteStarsLight.setEnv(c)};b.voteBoxLightSetEnv=function(c){a.VoteBoxLight.setEnv(c)};b.fn.voteStarsLight=function(c){if(this.length==1){new a.VoteStarsLight(this,c);return this}return this.each(function(){b(this).voteStarsLight(c)})};b.fn.voteBoxLight=function(c){if(this.length==1){new a.VoteBoxLight(this,c);return this}return this.each(function(){b(this).voteBoxLight(c)})};b.fn.initVoteGroups=function(e){e=b.extend({initUrl:"#",initMethod:"post",voteSettings:{},boxSettings:{},seasonUrl:"#",seasonMethod:"post",seasonRemoveSuffix:"delete",seasonCheckSuffix:"0",idSep:"-",votebox:".votebox",groupSplitKey:"\\a",splitKey:"\\c",starWidth:11,loadinfo:"Zapisuję..."},e);var c=this;b.voteStarsLightSetEnv(e.voteSettings);b.voteBoxLightSetEnv(e.boxSettings);var d=this.find(e.votebox);b.ajax({url:e.initUrl,type:e.initMethod,data:{},success:function(n){var k=n.split(e.groupSplitKey);var j=[],m={},g={};for(var h=0;h<k.length;h++){j[h]=k[h].split(e.splitKey)}if(j.length>0){for(var h=0,f=j[0].length;h<f;h+=2){if(typeof j[0][h+1]!="undefined"){g[j[0][h]]=+j[0][h+1]}}}if(j.length>1){for(var h=0,f=j[1].length;h<f;h+=2){if(typeof j[1][h+1]!="undefined"){m[j[1][h]]=+j[1][h+1]}}}d.each(function(){var i=+b(this).attr("className").match(/\d+/);if(typeof g[i]=="number"){b(this).find("input:first").attr("checked","checked").end().find(".state:first").width(g[i]*e.starWidth)}});d.voteBoxLight()},error:function(h,f,g){d.voteBoxLight();alert(a.ajax.commonErrorMesage(h,f,g))}})}})(jQuery);