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)
    });
    
  
   // Info Popups
  jQuery('a.info').each(function(){
   var content = jQuery(this).attr('rel');
   jQuery(this).css('position','relative');
   jQuery(this).append('<div class="info-cloud" style="display:none;">' + content + '</div>');
  
   
   jQuery(this).hover(function(){
    jQuery('a.info').css('position','static'); // IE Bug fix   
    jQuery(this).css('position','relative');      
    
    jQuery(this).children('.info-cloud').show();
    jQuery(this).children('.info-cloud').stop().animate({
        opacity: 1,
        top: 20,
        left: -125
       
    },300)
   
   },function(){
     
     
     jQuery('a.info').fadeIn();  
     jQuery(this).children('.info-cloud').stop().animate({
        opacity: 0,
        top: 60,
        left: -135

    },20,function(){
        jQuery(this).hide();
        jQuery('a.info').css('position','static'); 
          
    })
    
   
   })
    });   
   
   //Back to top slider

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

//Preloader
jQuery(window).load(
    function() {
        jQuery('#intro-theme-slides').fadeIn('slow');   // Home Page
        jQuery('.theme-screenshot-content').fadeIn('slow');    // Themes Page 
		jQuery('.intro-theme-slider-button').fadeIn('slow'); 
        jQuery('.intro-theme-slider-button-view').fadeIn('slow'); 
		jQuery('.single-theme-slider-button').fadeIn('slow');
        });
        
