/**Author: lolek # Copyright: Bajkitv.pl**/
$.fn.resize_simg=function(){return this.each(function(){var a=$(this);var d=a.width();if(d>fl_width){var c=Math.max(a.height()/d);var b=Math.round(fl_width*c);a.height(b).width(fl_width)}})};(function(b){b.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color"],function(e,d){b.fx.step[d]=function(f){if(f.state==0){f.start=c(f.elem,d);f.end=a(f.end)}f.elem.style[d]="rgb("+[Math.max(Math.min(parseInt((f.pos*(f.end[0]-f.start[0]))+f.start[0]),255),0),Math.max(Math.min(parseInt((f.pos*(f.end[1]-f.start[1]))+f.start[1]),255),0),Math.max(Math.min(parseInt((f.pos*(f.end[2]-f.start[2]))+f.start[2]),255),0)].join(",")+")"}});function a(e){var d;if(e&&e.constructor==Array&&e.length==3){return e}if(d=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(e)){return[parseInt(d[1]),parseInt(d[2]),parseInt(d[3])]}if(d=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(e)){return[parseFloat(d[1])*2.55,parseFloat(d[2])*2.55,parseFloat(d[3])*2.55]}if(d=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(e)){return[parseInt(d[1],16),parseInt(d[2],16),parseInt(d[3],16)]}if(d=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(e)){return[parseInt(d[1]+d[1],16),parseInt(d[2]+d[2],16),parseInt(d[3]+d[3],16)]}return e}function c(f,d){var e;do{e=b.curCSS(f,d);if(e!=""&&e!="transparent"||b.nodeName(f,"body")){break}d="backgroundColor"}while(f=f.parentNode);return a(e)}})($);$.fn.tip=function(){var b=$(document).width()/2;var c=$("<div id='tip'></div>");c.appendTo("body").css({opacity:0.8});return this.live("mouseenter",function(f){var d=$(this);var g=this.title;d.attr({title:"",alt:""});c.html(g).show();a(f);d.bind("mousemove",a).mouseleave(function(){c.hide();d.unbind("mousemove",a).attr("title",g)})});function a(d){if(b<d.pageX){c.css({top:(d.pageY+15)+"px",left:(d.pageX-c.width()-45)+"px"})}else{c.css({top:(d.pageY+15)+"px",left:(d.pageX+15)+"px"})}}};$.fn.slider=function(b){var a=$.extend({first:"first_page",prev:"prev_page",next:"next_page",last:"last_page",vert:true,speed:600,auto:true,bull:false,bullv:false,bullp:"controls",bullr:"",runit:null},b);this.each(function(){var l=$(this);var m=l.children("ul");var u=m.children("li");var x=u.length;var r=l.width();var k=l.height();var v=0;var n=x-1;var o=true;var e=a.vert?"":"v";a.bullr+="c_";if(a.vert){m.prepend(u.filter(":last-child").clone().css("margin-top","-"+k+"px"));m.append(u.filter(":nth-child(2)").clone());m.height((x+1)*k)}else{if(a.auto){m.prepend(u.filter(":last-child").clone().css("margin-left","-"+r+"px"));m.append(u.filter(":nth-child(2)").clone())}m.width((x+1)*r)}if(a.bull){var j="<span>";var d="<a id='"+a.bullr;var g="'></a>";for(i=0;i<x;i++){j+=d+i+g;if(a.bullv){j+="<br/>"}}j+="</span>";$("#"+a.bullp).html(j);$("a[id^="+a.bullr+"]").click(function(){var h=parseInt(this.id.replace(a.bullr,""));f(h);return false})}if(a.runit!=null){f(a.runit)}if(a.next){$("#"+a.next+e).click(function(){f("next");return false});$("#"+a.prev+e).click(function(){f("prev");return false});$("#"+a.first+e).click(function(){f("first");return false});$("#"+a.last+e).click(function(){f("last");return false})}function q(){if(v>n){v=0}if(v<0){v=n}if(a.bull){c(v)}if(a.vert){m.css("margin-top",(v*k*-1))}else{m.css("margin-left",(v*r*-1))}o=true}function f(h,s){if(o){o=false;switch(h){case"next":v=(v>=n)?(a.auto?v+1:n):v+1;break;case"prev":v=(v<=0)?(a.auto?v-1:0):v-1;break;case"first":v=0;break;case"last":v=n;break;default:v=parseInt(h);break}var t;if(a.vert){t=(v*k*-1);m.animate({marginTop:t},{queue:false,duration:a.speed,complete:q})}else{t=(v*r*-1);m.animate({marginLeft:t},{queue:false,duration:a.speed,complete:q})}if(!s&&p){clearInterval(p)}}}var p;if(a.auto){p=setInterval(function(){f("next",true)},a.speed+2000)}if(a.bull){if(a.runit!=null){c(a.runit)}else{c(0)}}});function c(d){$("a[id^="+a.bullr+"]").removeClass("active");$("#"+a.bullr+parseInt(d)).addClass("active")}};$.fn.flybox=function(e){var d=$.extend({type:"img",img_array:new Array,img_length:0,activ_img:0,slide_new:0,slide_old:-1},e);var f='<div id="fl_overlay"></div><div id="bt_flybox"><div id="fl_out"><div id="fl_load"></div></div></div>';if(d.type=="form"){var d=$.extend({form:"",ajax:true,title:"Potwierd&#378;",msg:"cf_msg",cb:function(){return true},off:true},d);var g='<table class="lh rh lf rf forumline"><tr><th class="th lh rh"><a class="close_wn" href="#" style="right:6px"></a></th></tr><tr><td class="row1 lf rf gen" align="center" style="height:90px"><br/><br/><div class="prt"></div><input type="submit" id="cf_s" value="Tak" class="btnmain"/>&nbsp; <input type="button" id="cf_c" value="Nie" class="btnlite"/>';return this.each(function(){var h=$(this);h.click(function(){if(!d.off){return true}if(!d.cb.call(this)){return false}c();$("#bt_flybox").css("bottom","0");$("#fl_out").prepend(g).addClass("lh rh lf rf").css({top:"30%",width:"600px",height:"auto"});$("#fl_out table").hide().click(function(){return false});$("#fl_out th").prepend(d.title);$(document).bind("keydown",{opcja:d},function(k){var j=(k.keyCode?k.keyCode:k.which);switch(j){case 27:case 88:a();break;case 13:case 9:return false;break}});$("#fl_out td.row1").prepend($("#"+d.msg).html());if(!d.form){$("body").append('<form name="cf" id="cf" action="'+h.attr("href")+'" method="post"></form>');d.form="cf"}if(d.ajax&&$("#cf_inp").text().length<1){$.ajax({url:"/ajax.php?get=4",timeout:10000,type:"GET",error:function(){a();return false},success:function(j){if(j){$("#"+d.form).append('<div id="cf_inp">'+j+"</div>")}$("#fl_load").hide();$("#fl_out table").show()}})}else{$("#fl_load").hide();$("#fl_out table").show()}$("#cf_c").click(function(){a();return false});$("#fl_out a.close_wn").click(function(){a();return false});$("#cf_s").click(function(){d.off=false;a();if(d.form=="cf"){$("#"+d.form).submit()}else{h.trigger("click")}});return false})})}return this.each(function(){var h=$(this);h.click(function(){var l=this.rel;if(!l){return false}var n=this.href;if(!d.img_array.length){$("a[rel^="+l+"]").each(function(){if($.inArray(this.href,d.img_array)==-1){d.img_array.push(this.href)}})}d.img_length=d.img_array.length;var k;if(l!="framebox"){k='<img id="fl_img"/>'}else{k='<iframe id="fl_img"></iframe>'}c();$("#fl_out").prepend('<a id="fl_close" href="#"></a>');$("#fl_close").after(k);$("#fl_img").hide().click(function(){return false});if(l!="framebox"){if(d.img_length>1){$("#bt_flybox").append('<div id="fl_panel"><div id="fl_stat_det"><a id="fl_prev" class="activ" href="#"></a><a class="activ" id="fl_next" href="#"></a>Obraz <span id="fl_nr"></span><a href="#" id="fl_fast_close">zamknij</a></div><div id="fl_list"></div><div class="navi" id="controls_fl"></div></div>');var j="<ul><li>";for(i=0;i<d.img_length;i++){if(i>0&&i%5===0){j+="</li><li>"}if(d.img_array[i]===n){d.activ_img=i}j+='<a href="'+d.img_array[i]+'" id="fl_t'+i+'"><img src="'+d.img_array[i]+'"/></a>'}$("#fl_list").html(j+"</li></ul>")}$(document).bind("keydown",{opcja:d},function(q){var r=q.data.opcja;var p=(q.keyCode?q.keyCode:q.which);switch(p){case 80:case 37:if(d.img_length>1&&r.activ_img!=0){b(r.activ_img-1)}break;case 78:case 39:if(d.img_length>1&&r.activ_img!=(r.img_array.length-1)){b(r.activ_img+1)}break;case 70:if($("#fl_panel").is(":visible")){$("#bt_flybox").css("bottom","0")}else{$("#bt_flybox").css("bottom","100px")}$("#fl_panel").toggle();break;case 27:case 88:a();break;case 13:case 9:return false;break}});if(d.img_length>1){$("#fl_list a").click(function(){if(!$(this).hasClass("active")){var o=parseInt(this.id.replace("fl_t",""));b(o)}return false});$("#fl_panel").click(function(){return false}).fadeIn();$("#fl_prev").click(function(){if(!$(this).hasClass("activ")){b(d.activ_img-1)}return false});$("#fl_next").click(function(){if(!$(this).hasClass("activ")){b(d.activ_img+1)}return false});$("#fl_fast_close").click(function(){a();return false})}else{$("#bt_flybox").css("bottom","0")}b(d.activ_img,true)}else{$("#bt_flybox").css("bottom","0");var m=/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;if(!m.test(this.href)){alert("Wybrana strona nie istnieje.");a();return false}$("#fl_img").attr("src",n).show();$("#fl_load").hide();$("#fl_close").show()}return false})});function b(h,j){$("#fl_t"+d.activ_img).removeClass("active");d.activ_img=h;$("#fl_t"+d.activ_img).addClass("active");if(!j){$("#fl_close").hide();$("#fl_img").hide()}$("#fl_load").show();iP=new Image();iP.onload=function(){$("#fl_load").hide();$("#fl_img").attr("src",d.img_array[d.activ_img]).show();var k=iP.width;var l=iP.height;if(k>80&&l>80){$("#fl_close").show()}$("#fl_out").width(k+6).height(l+6);if(d.img_length>1){$("#fl_nr").text((d.activ_img+1)+"/"+d.img_length);if(d.activ_img!=0){$("#fl_prev").removeClass("activ")}else{$("#fl_prev").addClass("activ")}if(d.activ_img!=(d.img_length-1)){$("#fl_next").removeClass("activ")}else{$("#fl_next").addClass("activ")}d.slide_new=Math.floor(d.activ_img/5);if(d.img_length>5&&d.slide_new!=d.slide_old){d.slide_old=d.slide_new;$("#fl_list").slider({next:"nan",vert:false,auto:false,bull:true,bullp:"controls_fl",bullr:"fl_",runit:d.slide_new})}}};iP.src=d.img_array[d.activ_img]}function c(){var h=$.scroll_width();$("body").append(f).css({overflow:"hidden","margin-left":"-"+h+"px"});$("#fl_overlay").click(function(){a();return false}).css("opacity","0.6").show();$("#bt_flybox").click(function(){a();return false})}function a(){d.slide_old=-1;$(document).unbind("keydown");$("#bt_flybox").remove();$("#fl_overlay").remove();$("body").removeAttr("style")}};$.scroll_width=function(){if(!$._scroll_width){var a=$("body");var b=a.css("overflow","hidden").width();a.css("overflow","scroll");b-=a.width();if(!b){b=a.width()-a[0].clientWidth}a.css("overflow","");$._scroll_width=b}return $._scroll_width};$.cookie=function(b,k,e){if(typeof k!="undefined"){e=e||{};if(k===null){k="";e.expires=-1}var f="";if(e.expires&&(typeof e.expires=="number"||e.expires.toUTCString)){var g;if(typeof e.expires=="number"){g=new Date();g.setTime(g.getTime()+(e.expires*24*60*60*1000))}else{g=e.expires}f="; expires="+g.toUTCString()}var m=e.path?"; path="+(e.path):"";var h=e.domain?"; domain="+(e.domain):"";var a=e.secure?"; secure":"";document.cookie=[b,"=",encodeURIComponent(k),f,m,h,a].join("")}else{var d=null;if(document.cookie&&document.cookie!=""){var l=document.cookie.split(";");for(var j=0;j<l.length;j++){var c=jQuery.trim(l[j]);if(c.substring(0,b.length+1)==(b+"=")){d=decodeURIComponent(c.substring(b.length+1));break}}}return d}};var pageTracker;$.gaTracker=function(a){var b="http://www.google-analytics.com/ga.js";$.ajax({url:b,type:"GET",dataType:"script",cache:true,timeout:5000,success:function(){pageTracker=_gat._getTracker(a);pageTracker._trackPageview();$('a:not("[href^=#]")').click(function(){var c=(this.hostname==location.hostname)?"internal":"external";pageTracker._trackEvent(c,"click",this.href)})}})};$(function(){var f,h,e,d;$("li","#btmenu").bind("mouseenter",function(){d=true;c();$(this).addClass("hover_icon").mouseleave(function(){h=$(this);d=false;f=setTimeout(function(){c(true)},1500);$(document).click(function(){d=false;c()})}).children("div").show()}).children("a").bind("focus blur",function(k){e=(k.type=="focus")?true:false;if($(this).hasClass("tab")){var j=$(this).parent("li");if(k.type=="focus"){c();j.addClass("hover_icon");if(!d){j.children("div").hide()}$(this).keypress(function(m){var l=m.keyCode?m.keyCode:m.which;if(l==13&&j.children("div").is(":hidden")){j.children("div").show().find("a:first").focus();return false}return true})}else{h=j}if(!j.children("div").length||j.children("div").is(":hidden")){c()}}});function c(j){if(!h||(j&&e)){return}if(f){clearTimeout(f)}if(h){h.unbind("mouseleave").removeClass("hover_icon").children("div").hide();h.children("a").unbind("keypress")}e=false;h=""}$("tr.h").hover(function(){$("td",this).addClass("rowhow")},function(){$("td",this).removeClass("rowhow")});$("[id^=m_]").click(function(){$("#tg_"+this.id).slideToggle("fast");return false});var b;$("#search").hover(function(){clearTimeout(b);$("#search_btn").slideDown(50);$("#search_btn li").click(function(){$("#sr").val(this.id);$("#search_btn li").removeClass("activ");$(this).addClass("activ");return false})},function(){b=setTimeout(function(){if(b){$("#search_btn li").unbind("click");clearTimeout(b);$("#search_btn").slideUp(50)}},1500)});$("a","#toggle").click(function(){var j=this.id;var k=(j=="open")?1:0;$.cookie("bt_mtab",k,{expires:10,path:"/"});$("#panel").slideToggle(300);$("#toggle a").slideToggle(100);return false});var a=0,g=0;$("#open_chat").click(function(){if($("#simple_chat").is(":hidden")){$("#simple_chat").fadeIn("slow");g=setTimeout(function(){if(g){clearTimeout(g);$("#chatData").load("/chat.php?mode=read");$.getScript("/styles/js/bt_chat.js");if(!in_parsing){$.getScript("/styles/js/parsed.js")}}},a);$("#chatMessage").attr("spellcheck","true").focus()}else{j()}$("#close_chat").click(function(){j();return false});function j(){$("#simple_chat").fadeOut();a=1500;window.clearInterval(interval);clearTimeout(g)}return false});$("a[id^=emo_]").click(function(){var k=$("#cont_"+this.id);if(k.is(":empty")){var j="/styles/js/bt_emo.js";$.getScript(j,function(){k.emoticons({vert:false}).slideDown("fast")})}else{k.slideToggle("fast")}return false});$(".post").focus(function(){$(this).addClass("post_active")}).blur(function(){$(this).removeClass("post_active")});if($("#checking").length){$("#select_all").click(function(){$("#checking input:checkbox").prop("checked",this.checked);if($(this).is(":checked")){$("#checking tr td[class]").addClass("rowhow")}else{$("#checking tr td[class]").removeClass("rowhow")}});$("#checking input:checkbox").each(function(){if($(this).filter(":checked").length){$(this).closest("tr").children("td").addClass("rowhow")}}).click(function(){var k=$("#checking input:checkbox");var j=(k.length==k.filter(":checked").length)?true:false;$("#select_all").prop("checked",j);$(this).closest("tr").children("td").toggleClass("rowhow")})}inp_block("subsz_1","sz_1","Szukaj",true)});function desc(c){var a=$("#desc");a.html(c)}function inp_block(b,c,d,a){b=$("#"+b);$("#"+c).click(function(){var e=b.val();if(e==d||e==""){return false}});if($.trim(b.val())==""||b.val()==d){if(!a){b.addClass("mactiv")}b.val(d)}b.focus(function(){if(b.val()==d){if(!a){b.removeClass("mactiv")}b.val("")}}).blur(function(){if($.trim(b.val())==""){if(!a){b.addClass("mactiv")}b.val(d)}})}function bt_block(b,a){setTimeout(function(){$(b).prop("disabled","disabled").val(a)},0)}function switch_tabs(k,h,j,e,d){var a=k.attr("id");if($("#"+j+"_"+a).is(":hidden")){$("#"+h).removeClass("activ");if(d){$.cookie("bt_"+j,a,{expires:10,path:"/"})}if(e==1){$("[id^="+j+"_]").hide();$("#"+j+"_"+a).fadeIn()}else{if(e==2){$("[id^="+j+"_]").slideUp();$("#"+j+"_"+a).slideDown()}else{$("[id^="+j+"_]").hide();$("#"+j+"_"+a).show()}}k.addClass("activ")}}function selectcode(b){var f=$(b).parent("div").parent("div").children("code")[0];var c,d;if(window.getSelection){c=window.getSelection();if(c.setBaseAndExtent){c.setBaseAndExtent(f,0,f,f.innerText.length-1)}else{d=document.createRange();d.selectNodeContents(f);c.removeAllRanges();c.addRange(d)}}else{if(document.getSelection){c=document.getSelection();d=document.createRange();d.selectNodeContents(f);c.removeAllRanges();c.addRange(d)}else{if(document.selection){d=document.body.createTextRange();d.moveToElementText(f);d.select()}}}}function get_ajax(a,b){if(a==1){if(!time_inter){return}window.clearInterval(time_inter)}$.ajax({url:"/ajax.php?get="+a,type:"POST",timeout:5000,success:function(c){if(c!=""){$("#"+b).html(c)}},complete:function(){if(a==1){time_inter=setInterval("get_ajax(1,'czas')",58000);pageTracker._trackPageview()}}})};
