$(document).ready(function(){
    
    
    $('#sidebar h3 a').click(function(){
        $('#sidebar ul').slideUp();
       $(this).parent().next().slideToggle();
    });
    
    // ask slidedown
    $('#list-ask h4 a').click(function(){
       $(this).parent().next().slideToggle(); 
    });
    

    // high light tr
    $('.tbl-border tr').mouseover(function(){
       $(this).css('background-color', '#FAD491');
    });
    $('.tbl-border tr').mouseout(function(){
       $(this).css('background-color', '#FFFFFF');
    });
    
    // submit btn
    $('.submit-btn').mouseover(function(){
       $(this).css('background-color', '#3BC92B')
        
    });
    $('.submit-btn').click(function(){
       $(this).css('background-color', '#EBAA39')
        
    });
    
    // slide login
    $("#login-link").click(function(){
        $("#login-panel").toggle();
        return false;
    })
    setInterval(whydisplay, 4000);
    
});

var max_why = 5;
var cur_why = 2;
    

function whydisplay()
{
    
    
    $('#why-content p').slideUp();
    $('#why'+cur_why).slideDown();
    
    if (cur_why == max_why) cur_why = 1; else cur_why++;
    
}

$(document).keydown(function(e) {
    if (e.keyCode == 27) {
        $("#login-panel").hide(0);
    }
});
