function blackbox_popup() {
	$('#bb_shadow').css({'height' : $(document).height() + 'px'});
	$('#bb_login .block_field input').animate({ opacity: 0.5 }, 0 );
}

$(document).ready(function () { 
 $(".fadein, #articles img, #popular img, #comments img").hover(
  function () { $(this).stop().animate({ opacity: 0.85 }, 175 ); }, 
  function () { $(this).stop().animate({ opacity: 1.0 }, 175 ); }  
 ); 
 
 $("#social a, #login").animate({ opacity: 0.8 }, 0 );
 $("#social a, #login").hover(
  function () { $(this).stop().animate({ opacity: 0.95 }, 175 ); }, 
  function () { $(this).stop().animate({ opacity: 0.8 }, 175 ); }  
 ); 
 
 // Menu toggle
 $("#navigation .nav li").hover(
   function () {
		if ($(this).hasClass("current-menu-item")) {} else { $(this).children('a').first().addClass("active"); }
		$(this).children("ul").fadeIn(175);
	}, 
   function () {
		$(this).children("ul").fadeOut(200);
		if ($(this).hasClass("current-menu-item")) {} else { $(this).children('a').first().removeClass("active"); }
	} 
 ); 
 
 // Black box
 $('#login, .show-login').click(
  function() {
   blackbox_popup();
   $('#bb_shadow, #bb_login').fadeIn(200);
  }
 );
 $('.comment-reply-login').click(
  function(event) {
   event.preventDefault();
   blackbox_popup();
   $('#bb_shadow, #bb_login').fadeIn(200);
  }
 );
 
 $('.button_login_close').click( function() { $('#bb_shadow, #bb_login').fadeOut(200); } );
 // End of Black box
 $("#popular .controls a").click( 
  function () {
   if (!($(this).hasClass("active"))) {
	$("#popular .controls a").removeClass("active");
    $(this).addClass("active");
   }
  }
 );
 $('#popular .controls').localScroll({ target:'#popular_container' });
});
