(function(window, $){

    LAMBERT.newWindow = function (e) {
        e.preventDefault();
        window.open(this.href);
    };

    LAMBERT.individualContact = (function ($) {
        return {
            init: function () {
                var hash = location.hash.toString().replace('#', '');
                if (LAMBERT.slug === "contact-us" && hash.length > 1) {
                    $('#to > option[value="' + hash + '"]').attr('selected', 'selected');
                }
            }
        };
    })($);

    LAMBERT.aboutTheSite = (function ($) {
        var credit = $('#footer > div.credit'),
            about = $('#about-the-site'),
            open = function (e) {
                e.preventDefault();
                !$.browser.msie ? about.fadeIn('slow') : about.show();
            },
            close = function (e) {
                e.preventDefault();
                !$.browser.msie ? about.fadeOut('fast') : about.hide();
            };
        return {
            init: function () {
                about.delegate('ul a', 'click', LAMBERT.newWindow);
                $('<a class="close" href="#">Close</a>').bind('click', close).prependTo(about);
                $('<a href="#about-the-site">About the Site</a>').bind('click', open).prependTo(credit);
            }
        };
    })($);

})(this, jQuery);

jQuery(function ($) {

    LAMBERT.individualContact.init();
    LAMBERT.aboutTheSite.init();

    $('#hero > div.cycler').cycle({
        fx      : 'fade',
        timeout : 4000,
        speed   : 2000,
        nowrap  : false
    });

    $('ul.gallery a').colorbox({
        opacity : 0.6
    });

});
