var resetLoginBox = function() {
    $(".btn_login").removeClass("btn_login_open");
    $("#login-email, #login-password, #reemail").val("").removeClass("error");
    $("#login-error-text").remove();
    $("#password-error-text").remove();
    $("#boxLogin").show();
    $("#boxForgotPass").hide();
    $("#login_box").hide();
}

var showLoginBox = function() {
    $("#login_box").fadeToggle(200);
    $(".btn_login").toggleClass("btn_login_open");
    if (!$(".btn_login").hasClass("btn_login_open"))
        resetLoginBox();

    return false;
}

$(function() {
    $('ul.sf-menu').superfish({
        pathClass: 'current',
        autoArrows: false,
        disableHI: false
    });

    // jQuery fadeToggle plugin
    jQuery.fn.fadeToggle = function(s, fn) {
        return (this.is(":visible"))
	        ? this.fadeOut(s, fn)
	        : this.fadeIn(s, fn);
    };

    // ============
    // = Loginbox =
    // ============


    $(".btn_login, .btn_press_login").bind("click", showLoginBox);

    $("#login_box").mouseup(function() {
        return false;
    });

    $(document).mouseup(function(e) {
        if ($(e.target).hasClass('btn_login') == false) {
            resetLoginBox();
        }
    });



    // ===============================
    // = Functions for calendar page =
    // ===============================

    $('.genre_select').click(function() {
        $('#drop_genre').slideToggle(300);
    });
    $(document).mouseup(function(e) {

        if ($(e.target).hasClass('genre_select') == false) {
            $('#drop_genre').hide()
        }
    });

    $('.calendar_item').hover(function() {
        $(this).addClass('calendar_item_hover')
    }, function() {
        $(this).removeClass('calendar_item_hover')
    });

    $(".calendar_item").click(function() {
        window.location = $(this).find("a").attr("href");
        return false;
    });


    // anim menu item

    $("a.dinle, #drop_dinle").hover(
      function() {
          $(".anim_radio").show();
      },
      function() {
          $(".anim_radio").hide();
      }
    );


// bottotmSidePanel
    $("#bottomSideClose").click(function() {
        $("#bottomSidePanel").hide();
    });



});