jQuery(document).ready(function(){


     // Login Button
     /* OLD
    jQuery('.login-button').bind('mousedown',function(){
      jQuery('#login-popout').animate({
        opacity:1
      }); 
      jQuery('#login-popout').slideDown(50);  
    });
    jQuery('#login-popout').bind('mouseleave',function(){
        setTimeout( function(){
           jQuery('#login-popout').animate({
            opacity:0
          });
          jQuery('#login-popout').slideUp(50); 
        
        }, 2000)
   
    });
    
    */
    var login_box =   jQuery('#login-popout');
    var login_button = jQuery('.login-button');
    var login_button_text = login_button.html();
    
    jQuery('.login-button').bind('mousedown',function(){
    if(login_box.css('display') == 'none'){
    
      //login_button.fadeOut(400,function(){jQuery(this).html('Close')}).fadeIn(); 
      
      login_box.animate({
        opacity:1
      }); 
      login_box.slideDown(200,function(){login_button.addClass('login-button-alternative');});
      
    }

    else {
               //login_button.fadeOut(400,function(){jQuery(this).html(login_button_text)}).fadeIn(); 
               login_box.animate({
                opacity:0
              });
             login_box.slideUp(200,function(){login_button.removeClass('login-button-alternative');});

        }
    });

    // Sidebar Pretty...

    jQuery.easing.def = "easeInOutSine"; 

     jQuery('#sidebar .widget > ul > li').bind('mouseenter',function(){

      jQuery(this).stop().animate({
            backgroundColor: "#E3E3E3" }, 200)
      
    }).bind('mouseleave',function(){
    
        jQuery(this).stop().animate({
            backgroundColor: "#FFFFFF" }, 500)
    });
    
    
   //Back to top slider

	jQuery('#toTop').click(function() {  
		jQuery('body,html').animate({scrollTop:0},800);  
	}); 
   
});
