Repetitive event handler for a toggling UI control I feel like this bit of code could have been written more elegantly, especially with the huge if/else statements. Can somebody help me break this down? It would really help me out in the future.

// Contact
var c = 0;
var contactHeight = $('#contact-keebs').outerHeight();
$('#mail-wrap').click(function (e) {

    e.preventDefault();

    if (c++ % 2 == 0) {

        $('#contact-button').addClass('project-button').css('width', '71px').text('Projects');
        $('.mail-icon').attr('src', site.theme_path + '/img/icon-projects.png');
        $('#contact-button').shuffleLetters({callback:function(){
            if ($(window).scrollTop() != 0) {
                $('html, body').animate({
                    scrollTop : 0
                },200, function() {
                    $('#contact-keebs').fadeIn(200);
                    $('body').css({
                        height   : contactHeight,
                        overflow : 'hidden'
                    });
                    $('#contact-info, #clients').addClass('animated fadeInUp');
                });
            } else {
                $('#contact-keebs').fadeIn(200);
                $('body').css({
                    height   : contactHeight,
                    overflow : 'hidden'
                });
                $('#contact-info, #clients').addClass('animated fadeInUp');
            }
        }
        });

    } else {

        $('#contact-button').removeClass('project-button').css('width', '96px').text('Get in touch');
        $('.mail-icon').attr('src', site.theme_path + '/img/icon-contact.png');
        $('#contact-button').shuffleLetters({callback:function(){
            if ($(window).scrollTop() != 0) {
                $('html, body').animate({
                    scrollTop : 0
                },200, function() {
                    $('#contact-info, #clients').removeClass('animated fadeInUp');
                    $('body').css({
                        height   : '',
                        overflow : ''
                    });
                    $('#contact-keebs').fadeOut(200);
                });
            } else {
                $('#contact-info, #clients').removeClass('animated fadeInUp');
                $('body').css({
                    height   : '',
                    overflow : ''
                });
                $('#contact-keebs').fadeOut(200);
            }
        }
        });
    }
});


HTML

// Button

&lt;div id="mail-wrap"&gt;
    &lt;div class="icon-wrap"&gt;
        &lt;img class="mail-icon" src="img/icon-contact.png" alt="Contact" height="26" width="24"&gt;
    &lt;/div&gt;
    &lt;a id="contact-button" href="#"&gt;Get in touch&lt;/a&gt;
&lt;/div&gt;


// Contact section

&lt;div id="contact-keebs"&gt;
    &lt;span class="contact-overlay"&gt;&lt;/span&gt;
    &lt;div id="contact-wrapper"&gt;
        &lt;div id="contact-info"&gt;
            &lt;h1&gt;Title statement&lt;/h1&gt;
            &lt;h2&gt;Email&lt;/h2&gt;
        &lt;/div&gt;
        &lt;div id="clients"&gt;
            &lt;h2&gt;Clients &amp;amp; Partners&lt;/h2&gt;
            &lt;ul id="client-list"&gt;
                &lt;li&gt;Client 1&lt;/li&gt;
                &lt;li&gt;Client 2&lt;/li&gt;
                &lt;li&gt;Client 3&lt;/li&gt;
                &lt;li&gt;Client 4&lt;/li&gt;
                &lt;li&gt;Client 5&lt;/li&gt;
                &lt;li&gt;Client 6&lt;/li&gt;
                &lt;li&gt;Client 7&lt;/li&gt;
                &lt;li&gt;Client 8&lt;/li&gt;
            &lt;/ul&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
// Contact
var contactHeight = $('#contact-keebs').outerHeight();

function in_keebs() {
    $('#contact-keebs').fadeIn(200);
    $('body').css({
        height   : contactHeight,
        overflow : 'hidden'
    });
    $('#contact-info, #clients').addClass('animated fadeInUp');
}

function out_keebs() {
    $('#contact-info, #clients').removeClass('animated fadeInUp');
    $('body').css({
        height   : '',
        overflow : ''
    });
    $('#contact-keebs').fadeOut(200);
}

function show_project_button(e) {
    e.preventDefault();

    $('#contact-button').addClass('project-button').css('width', '71px').text('Projects');
    $('.mail-icon').attr('src', site.theme_path + '/img/icon-projects.png');
    $('#contact-button').shuffleLetters({callback:function(){
        if ($(window).scrollTop() != 0) {
            $('html, body').animate({
                scrollTop : 0
            },200, in_keebs);
        } else {
            in_keebs();
        }
    }
    });

    $('#mail-wrap').click(hide_project_button);
}

function hide_project_button(e) {
    e.preventDefault();

    $('#contact-button').removeClass('project-button').css('width', '96px').text('Get in touch');
    $('.mail-icon').attr('src', site.theme_path + '/img/icon-contact.png');
    $('#contact-button').shuffleLetters({callback:function(){
        if ($(window).scrollTop() != 0) {
            $('html, body').animate({
                scrollTop : 0
            },200, out_keebs);
        } else {
            out_keebs();
        }
    }
    });

    $('#mail-wrap').click(show_project_button);
}

$('#mail-wrap').click(show_project_button);


First, I'm not at all convinced that these are the right function names, but I needed names and these at least seem somewhat related.  Part of the problem is that I don't really understand what you're doing, as I don't know what the underlying HTML is.  

The insight to get rid of the outer if/else is that you are simply alternating between them.  Instead of using a variable for tracking, we change the onclick behavior at the end of each variant.  We pick one and start with it.  This gives us the same alternating behavior as the if/else did.  We can also get rid of c.  

We're still stuck with the inner if/else blocks, but we can remove the repeated code into their own functions.  

Note that I haven't tested this, as I don't have enough context to run it.