// JavaScript Document

jQuery.fn.fadeToggle = function(speed, easing, callback) {
   return this.animate({opacity: 'toggle'}, speed, easing, callback);
};

jQuery(document).ready(function($) {
	
    jQuery('.profile-bars .bp-widget-title').addClass("bp-widget-title collapsed").attr("title", "Развернуть").css("cursor","pointer").click(
      function (){ 
	jQuery(this).toggleClass('collapsed').toggleClass('opened').next(".bp-widget:first").fadeToggle("normal"); 
      }).nextAll(".bp-widget").hide();

    jQuery('.profile-bars .tertiary span').css("cursor","pointer").toggle(
      function () {
		    jQuery(this).html("Свернуть все");				
		    jQuery('.profile-bars .bp-widget-title').attr("title", "Свернуть").removeClass("collapsed").addClass("opened").nextAll(".bp-widget").fadeToggle();				
      },
      function () {
		    jQuery(this).html("Развернуть все");
		    jQuery('.profile-bars .bp-widget-title').attr("title", "Развернуть").removeClass("opened").addClass("collapsed").nextAll(".bp-widget").fadeToggle();
      });

    if( $("#bp-adminbar-notifications-menu").length != 0 )
    {
      jQuery('#bp-adminbar-notifications-menu').menu({minWidth: 220}, '#bp-adminbar-notifications-menu-list');
    }

    //Domolink Team tips
    if( $("#domolink_team").length != 0 ){
	    $("#domolink_team").jTipster({
	      'width': 300,
	      'popup': '.popup2',
	      'marker': '.marker',
	      'offset': 300
	    });		
    }
});