(function(jQuery){
    "use strict";

    jQuery(document).ready(function(){
        /* Mobile navigation - Scotch panel */
        /*jQuery('a.toggle-nav').on('click', function() {
            jQuery('body').toggleClass("scotch-is-showing");
        });

        var easyPanel = jQuery('.make-me-a-panel').scotchPanel({
            containerSelector: '.site',
            direction: 'right',
            duration: 300,
            transition: 'ease',
            distanceX: '301px',
            enableEscapeKey: true,
            beforePanelOpen: function() {
                jQuery('.header-row').css({
                    '-moz-transform': 'translate3d(-301px, 0, 0)',
                    '-ms-transform': 'translate3d(-301px, 0, 0)',
                    '-o-transform': 'translate3d(-301px, 0, 0)',
                    '-webkit-transform': 'translate3d(-301px, 0, 0)',
                    'transform': 'translate3d(-301px, 0, 0)'
                });
            },
            beforePanelClose: function() {
                jQuery('.header-row').css({
                    '-moz-transform': 'translate3d(0, 0, 0)',
                    '-ms-transform': 'translate3d(0, 0, 0)',
                    '-o-transform': 'translate3d(0, 0, 0)',
                    '-webkit-transform': 'translate3d(0, 0, 0)',
                    'transform': 'translate3d(0, 0, 0)'
                });
            }
        });
        jQuery('a.toggle-nav').click(function() {
            easyPanel.toggle();
            return false;
        });*/

        jQuery('.challenge-admin-panel').scotchPanel({
            direction: 'right',
            duration: 300,
            transition: 'ease',
            distanceX: '40%',
            enableEscapeKey: true
        });

        jQuery('.hashtag a').on('click', function(){
            return false;
        });

        jQuery('#write-your-idea').toggle(
            function(e) {
                e.preventDefault();
                var whats_new_field = jQuery('#whats-new');

                jQuery('html,body').animate({
                    scrollTop: (jQuery("#write-your-idea").offset().top-60)},
                'slow');

                jQuery('#write-your-idea').html('Cancel');
                jQuery('#whats-new-form').show();
                whats_new_field.blur().focus().val(whats_new_field.val());
                return false;
            },
            function(e) {
                e.preventDefault();
                jQuery('#write-your-idea').html('Write your Idea');
                jQuery('#whats-new-form').hide();
                return false;
            }
        );
        jQuery('#message img').on('click', function() {
            jQuery('#write-your-idea').trigger('click');
        });

        jQuery('#cancel-whats-new').on('click', function(e){
            jQuery('#whats-new-content').removeClass('active');
            jQuery('#whats-new-textarea').removeClass('active');
            jQuery('#whats-new-options').hide();
            jQuery(this).hide();
            return false;
        });

        jQuery('.show-all a').on('click', function() {
            jQuery('.activity-comments').find('.hidden').removeClass('hidden');
        });

    });

})(jQuery);