var boozurkScripts;(function(a){boozurkScripts={init:function(b){var c=b.split(",");for(i in c){switch(c[i]){case"postexpander":boozurkScripts.post_expander();break;case"thickbox":boozurkScripts.init_thickbox();break;case"tooltips":boozurkScripts.tooltips();boozurkScripts.cooltips(".minibutton,.share-item img,.tb_widget_categories a,#bz-quotethis,.tb_widget_latest_commentators li,.tb_widget_social a,.post-format-item.compact img,a.bz-tipped-anchor",true,"");boozurkScripts.cooltips(".pmb_comm",true,boozurk_l10n.comments_closed);break;case"plusone":gapi.plusone.go("posts_content");break;case"quotethis":boozurkScripts.init_quote_this();break;case"infinitescroll":boozurkScripts.infinite_scroll(boozurk_l10n.infinite_scroll_type);break;case"animatemenu":boozurkScripts.animate_menu();break;case"scrolltopbottom":boozurkScripts.scroll_top_bottom();break;case"commentvariants":boozurkScripts.comment_variants();break;default:alert(arguments[i]);break}}},post_expander:function(){return a("a.more-link").each(function(){a(this).click(function(){var b=a(this);a.ajax({type:"POST",url:b.attr("href"),beforeSend:function(c){b.html(boozurk_l10n.post_expander).addClass("ajaxed")},data:"bz_post_expander=1",success:function(c){b.parents(".storycontent").hide().html(a(c)).fadeIn(600)}});return false})})},infinite_scroll:function(b){a("#bz-page-nav").addClass("ajaxed");a("#bz-next-posts-button").fadeOut();a(".nb-nextprev").hide();return a(window).scroll(function(){if(a("#bz-page-nav").position().top-a(window).scrollTop()-a(window).height()<-150){var c=a("#bz-next-posts-link a");if(c.length>0){if(b=="auto"){boozurkScripts.AJAX_paged()}else{if(b=="manual"){a("#bz-next-posts-button").fadeIn()}}}else{a("#bz-next-posts-button").html(boozurk_l10n.infinite_scroll_end).fadeIn();return false}}})},animate_menu:function(){return a("#mainmenu").children("li").each(function(){var b=a(this).children("ul");if(b.size()!==0){a(this).children("a").append('»');b.css({opacity:0});a(this).mouseenter(function(){b.css({display:"block"}).animate({opacity:0.95})}).mouseleave(function(){b.stop().animate({opacity:0},200,"swing",function(){b.css({display:""})})})}})},tooltips:function(){return a(".bz-tooltip,.nb_tooltip").each(function(){var c=a(this).parent();var b=a(this);c.mouseenter(function(){b.css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:0.9})}).mouseleave(function(){b.stop().delay(100).fadeOut()})})},cooltips:function(b,c,d){return a(b).each(function(){a(this).hover(function(){a.data(this,"cancel.cooltips",true);var e=a.data(this,"active.cooltips");if(!e){e=a('
');e.css({position:"absolute",zIndex:100000});a.data(this,"active.cooltips",e)}if(a(this).attr("title")||typeof(a(this).attr("original-title"))!="string"){a(this).attr("original-title",a(this).attr("title")||"").removeAttr("title")}var h=a(this).attr("original-title");e.find(".cooltips-inner")["text"](h||d);var k=a.extend({},a(this).offset(),{width:this.offsetWidth,height:this.offsetHeight});e.get(0).className="cooltips";e.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).appendTo(document.body);var g=e[0].offsetWidth,j=e[0].offsetHeight;var f=(a(this).parents("#sidebar-secondary,#navbuttons.fixed").length)?"to_left":"";e.css({top:k.top-j,left:k.left+(k.width/2)}).addClass(f);if(c){e.css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:0.9})}else{e.css({visibility:"visible"})}},function(){a.data(this,"cancel.cooltips",false);var e=this;setTimeout(function(){if(a.data(this,"cancel.cooltips")){return}var f=a.data(e,"active.cooltips");if(c){f.stop().fadeOut(function(){a(this).remove()})}else{f.remove()}},100)})})},AJAX_paged:function(){var b=a("#bz-next-posts-link a").attr("href");var c=a("#bz-page-nav");a.ajax({type:"POST",url:b,beforeSend:function(d){a("#bz-page-nav-msg").addClass("loading").html(boozurk_l10n.infinite_scroll).animate({opacity:1})},data:"bz_infinite_scroll=1",success:function(d){c.replaceWith(a(d));boozurkScripts.init(boozurk_l10n.script_modules_afterajax);a("#bz-next-posts-button input").click(function(){boozurkScripts.AJAX_paged()})}});return false},init_thickbox:function(){a(".storycontent a img").parent('a[href$=".jpg"],a[href$=".png"],a[href$=".gif"]').addClass("thickbox");a(".storycontent .gallery").each(function(){a('a[href$=".jpg"],a[href$=".png"],a[href$=".gif"]',a(this)).attr("rel",a(this).attr("id"))})},scroll_top_bottom:function(){top_but=a(".minib_top");bot_but=a(".minib_bottom");top_but.click(function(){a("html, body").animate({scrollTop:0},{duration:400});return false});bot_but.click(function(){a("html, body").animate({scrollTop:a("#footer").offset().top-80},{duration:400});return false})},comment_variants:function(){a(".comment-variants label").click(function(){a("#comment").removeClass("style-default style-blue style-pink style-orange style-yellow style-green style-gray style-white");a("#comment").addClass(a("input",this).val());a("input",this).attr("checked",true)})},init_quote_this:function(){if(document.getElementById("reply-title")&&document.getElementById("comment")){bz_qdiv=document.createElement("small");bz_qdiv.innerHTML=' - '+boozurk_l10n.quote+"";bz_replink=document.getElementById("reply-title");bz_replink.appendChild(bz_qdiv)}},quote_this:function(){var b="";if(window.getSelection){b=window.getSelection()}else{if(document.getSelection){b=document.getSelection()}else{if(document.selection){b=document.selection.createRange().text}else{return true}}}b=b.toString().replace(/&/g,"&").replace(/"/g,""").replace(//g,">");if(b.length!==0){document.getElementById("comment").value=document.getElementById("comment").value+""+b+"
"}else{alert(boozurk_l10n.quote_alert)}}};a(document).ready(function(b){boozurkScripts.init(boozurk_l10n.script_modules)})})(jQuery);