$(function(){$("#sidebar").prepend('<a href="#" id="fixed" title="Włącz/wyłącz przewijanie menu"></a><a href="#" id="right" title="Przenieś menu na drugą stronę"></a>');$("#fixed").click(function(c){c.preventDefault();if($("#sidebar").hasClass("nofixed")){$("#sidebar").removeClass("nofixed");eraseCookie("nofixed")}else{$("#sidebar").addClass("nofixed");createCookie("nofixed","nofixed",9999)}});$("#right").click(function(c){c.preventDefault();if($("body").hasClass("right")){$("body").removeClass("right");eraseCookie("right")}else{$("body").addClass("right");createCookie("right","right",9999)}});$("#sidebar form.search input.keywords,#sidebar form.login input[name=req_username],#sidebar form.login input[name=req_password]").focus(function(){if($(this).val()==$(this).attr("title")){$(this).val("")}}).blur(function(){if($(this).val()==""){$(this).val($(this).attr("title"))}});var a=$("#topics-list td.tcl");a.find("a.title").after(' <a href="" class="more">ostatni post</a>');var f=a.find("a.more");$(f).click(function(c){c.preventDefault();$(this).next("p").slideToggle("fast");$(f).not(this).next("p:visible").slideUp("fast")});if($("#chat").length>0){$("#chat form").submit(function(){var g=$("#chat .text");var c=$("#chat .user");if(g.attr("value")!=""){$.post("chat.php",{text:g.attr("value"),user:c.attr("value")},function(h){displayChat(h)},"json");g.attr("value","")}return false});$("#chat div.content").resizable({handles:"s",minHeight:$("#chat .inbox").height(),alsoResize:"#chat .inbox",stop:function(){createCookie("chat-height",$("#chat .inbox").height(),99999)}});$("#chat").show();updateChat()}$("#"+readCookie("box_show")+" .content").show();var b=$("#sidebar .slideable");b.find("h2").append('<a href="" class="switcher">+</a>');b.has(".content:visible").find("a.switcher").text("-");b.find("a.switcher").click(function(j){j.preventDefault();var i=$(this);var h=i.parents(".slideable");var g=h.find(".content");if(g.is(":visible")){g.slideUp();i.text("+");eraseCookie("box_show")}else{g.slideDown();var c=b.not(h);c.find(".content").slideUp();c.find("a.switcher").text("+");i.text("-");createCookie("box_show",h.attr("id"),30)}});if(readCookie("chat-height")){$("#chat .inbox").height(readCookie("chat-height"))}$("#messages div.rate a").click(function(){$.post("rate.php",{rate:$(this).attr("class"),id:$(this).closest(".message").attr("id")},function(g){var c=$('<div class="dialog"></div>').html(g.result).dialog({resizable:false,title:g.title,hide:"fade",show:"fade",draggable:false,minHeight:10,modal:true});if(g.type=="info"){c.dialog("option","buttons",[{text:"Ok",click:function(){$(this).dialog("close")}}])}else{c.dialog("option","buttons",[{text:g.confirm,click:function(){$.post("rate.php",$(this).find("form").serialize(),function(h){c.html(h.result).dialog("option","buttons",[{text:"Ok",click:function(){$(this).dialog("close")}}])},"json")}},{text:"Anuluj",click:function(){$(this).dialog("close")}}])}},"json");return false});var e;$("#sidebar form.search input.keywords").focus(function(){if(null==e){$.getJSON("suggest.json",function(c){e=c;$(".search .keywords").autocomplete("option","source",c)})}}).autocomplete({source:e,select:function(c,g){$(this).val(g.item.label);$(this).closest("form").submit()}});$("#post div.row :input").focus(function(){$(this).nextAll(".message-box:hidden").slideDown()}).blur(function(){$(this).nextAll(".message-box:visible").slideUp()});$("#sidebar form.search input.search").click(function(){if($(this).prev().val().length<=2){return false}return $(this).prev().val()!=$(this).prev().attr("title")});$("#req_subject").keyup(function(){var c=$(this).val();if(c.length>2){$.post("suggest-topics.php",{q:c},function(g){var h="";$.each(g,function(i,j){h='<a href="t'+i+'.html">'+j+"</a> "+h});if(h!=""){h="Podobne, istniejące tematy: "+h}$("#subject-suggest").html(h)},"json")}});var d=$("#messages div.author");d.find(":has(li:hidden)").append('<a href="" class="more">więcej</a>');d.find("a.more").click(function(c){c.preventDefault();$(this).closest(".author").find("li:hidden").slideDown();$(this).hide()});$("#sidebar p.box.wizard").click(function(h){h.preventDefault();var g=$("#wizard-modal");var c=g.find("form").hide();var i=g.find("div.choose-forum").show();g.dialog({resizable:false,hide:"fade",show:"fade",draggable:false,minHeight:10,modal:true,width:345})});(function(){var c=function(j){var l=function(m){return"http://www.youtube.com/v/"+m+"&amp;fs=1&amp;color1=0xFFFFFF&amp;color2=0xFFFFFF&amp;rel=0&amp;autoplay=1"};var i=j.width();var g=j.height();var k=j.attr("name");var h='<object width="'+i+'" height="'+g+'"><param name="movie" value="'+l(k)+'"></param><param name="wmode" value="transparent"></param><param name="allowFullScreen" value="true"></param><embed src="'+l(k)+'" type="application/x-shockwave-flash" wmode="transparent" allowfullscreen="true" width="'+i+'" height="'+g+'"></embed></object>';return h};$("#messages div.video.youtube div.play").click(function(){var g=$(this).hide().next("img");g.before(c(g)).remove()})})()});function createCookie(c,d,e){if(e){var b=new Date();b.setTime(b.getTime()+(e*24*60*60*1000));var a="; expires="+b.toGMTString()}else{var a=""}document.cookie=c+"="+d+a+"; path=/"}function readCookie(b){var e=b+"=";var a=document.cookie.split(";");for(var d=0;d<a.length;d++){var f=a[d];while(f.charAt(0)==" "){f=f.substring(1,f.length)}if(f.indexOf(e)==0){return f.substring(e.length,f.length)}}return null}function Linkify(e){var d=/(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;var b=e.replace(d,'<a href="$1" target="_blank">$1</a>');var c=/(^|[^\/])(www\.[\S]+(\b|$))/gim;b=b.replace(c,'$1<a href="http://$2" target="_blank">$2</a>');var a=/(\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,6})/gim;b=b.replace(a,'<a href="mailto:$1">$1</a>');return b}function loadChat(){$.getJSON("chat.json?"+Math.random(),function(a){$("#chat .inbox").text("");displayChat(a)})}function displayChat(a){$.each(a,function(c,b){b.text=Linkify(b.text);$("#chat .inbox").append("<span><b>"+b.user+"</b> <i>"+b.date+"</i></span><br />"+b.text+"<br />")})}function eraseCookie(a){createCookie(a,"",-1)}function updateChat(){loadChat();setTimeout("updateChat()",6000)};
