var FW={globals:{},start:function(){jQuery("html").addClass("js");jQuery.ajaxSetup({cache:true});this.user.openExternalLinks();this.global.addSearchPlugin();this.global.sendPageToFriend();this.load.all();this.stats.googleAnalytics();this.bindConfirmWithPost()},global:{addSearchPlugin:function(){if((typeof window.sidebar=="object")&&(typeof window.sidebar.addSearchEngine=="function")){var a=jQuery('<li><a href="">Firefox Search Plugin</a></li>');a.appendTo("#sitemap dd:last ul").find("a").bind("click",function(b){window.sidebar.addSearchEngine("http://gfx.filmweb.pl/gf/mozilla/filmweb.src","http://gfx.filmweb.pl/gf/mozilla/filmweb.png","filmweb.pl","Web");b.preventDefault()})}},sendPageToFriend:function(){jQuery("#sitemap dd:eq(4) ul").append('<li><a href="/SendToFriend?pageUrl='+escape(document.location.href)+'">Wyślij tą stronę znajomemu</a></li>')}},user:{information:function(){var e=(jQuery.cookie("_artuser_sessionId")||jQuery.cookie("_artuser_rememberMe"))?true:false,b="/pagePieces/user/header";if(e){var c=jQuery("#dashboard"),a=jQuery('<div class="dashboard-loading">Ładowanie…</div>'),d=c.height();c.empty();c.append(a);jQuery.ajax({url:b,cache:false,dataType:"html",type:"GET",success:function(f){a.remove();c.append(f)},complete:function(){FW.user.adminMode()},error:function(f){}})}},adminMode:function(){option=jQuery("#admin-mode"),$target=jQuery("#sitemap"),prefs=(jQuery.cookie("mode"))?true:false;if(prefs||option){option.find("select option").each(function(a){var c=$(this).value,b=jQuery.cookie("mode");if(prefs&&(c==b)){this.selected=true}else{this.selected=false}});option.appendTo($target)}},openExternalLinks:function(){jQuery("a.external").bind("click",function(d){var a=this.href,g="";if(a.indexOf("?")>-1){var b=a.split("?")[1].split("&");for(var e=0;e<b.length;e++){var c=b[e].split("=");if(c[0]=="size"){if(c[1].indexOf("x")>-1){var f=c[1].split("x");g+="width="+f[0]+", height="+f[1]}}}}window.open(this.href,"_blank",g);d.preventDefault()})}},stats:{googleAnalytics:function(){var b="UA-4052507-1",a=(location.protocol=="http:"?"http://www.":"https://ssl.")+"google-analytics.com/ga.js";jQuery.getScript(a,function(){if(typeof _gat!="undefined"){var c=_gat._getTracker(b);if(typeof c!="undefined"){c._initData();c._trackPageview();FW.globals.googleAnalytics=_gat._getTracker(b)}}})}},load:{file:function(a,b){jQuery.getScript(a,b)},all:function(){var b=FW.globals.urlJS,a=["popup.js","stored-messages.js"];a.each(function(c){FW.load.file(b+c,function(){})});if(FW.globals.highlightHash||FW.globals.highlightReferer){FW.load.file(b+"highlight.js",function(){if(FW.globals.highlightHash){highlightHash()}else{if(FW.globals.highlightReferer){var c=""+document.referrer;if(document.referrer&&c!=""){highlightReferer(document.referrer)}}}})}}},makePostLinks:function(c){c=jQuery.extend({links:"a.postLink"},c);var b=jQuery(c.links);if(b.length<1){return}var a=jQuery('<form method="post"></form>').hide().appendTo(jQuery("body"));b.each(function(){jQuery(this).bind("click",function(f){f.preventDefault();var d=jQuery(this);if(typeof d.attr("title")!="string"||d.attr("title")==""||window.confirm(d.attr("title"))){a.attr("action",jQuery(this).attr("href")).trigger("submit")}d=null;return false})});jQuery(window).bind("unload",function(){b=null;a=null})},bindConfirmWithPost:function(){jQuery(".confirmWithPost").each(function(a,b){jQuery(b).bind("click",function(d){var c=jQuery.cookie("_artuser_token");if(c!=""&&typeof c!="undefined"){d.preventDefault();FW.confirmWithPost(this,jQuery(this).attr("title"),c)}})})},confirmWithPost:function(e,h,d){var a=h;var c=confirm(a);if(c==true){var g=setTimeout(f,1000);jQuery.ajax({type:"POST",url:jQuery(e).attr("href"),data:{token:d},success:function(){window.location.reload()},error:function(){alert("Wystąpił błąd!")},complete:function(){clearTimeout(g);b()}})}function f(k,m){var i=jQuery("<div id='loaderLayer'></div>");var j=jQuery("body").height();var n=jQuery(window).height();var l=(n/2)+"px";i.css({backgroundColor:"#000",backgroundImage:"url('/gf/beta/ic/al_big.gif')",backgroundRepeat:"no-repeat",backgroundPosition:"center "+l,opacity:"0.5",width:"100%",height:j,position:"absolute","z-index":"9999",top:"0",left:"0","text-align":"center",margin:"auto"});i.appendTo(jQuery("body"))}function b(){jQuery("#loaderLayer").remove()}}};jQuery(function(){FW.makePostLinks();FW.start()});