$(document).ready(function () {
    $(document).ready(function() {
	$('.fancybox-media').fancybox({
		openEffect  : 'none',
		closeEffect : 'none',
		helpers : {
			media : {},
			title : { type : 'inside' }
		}
	});
});
	$(".fancybox")
        .attr('rel', 'gallery')
        .fancybox({
        beforeLoad: function () {
            var el, id = $(this.element).data('cap-id');

            if (id) {
                el = $('#' + id);

                if (el.length) {
                    this.title = el.html();
                }
            }
        },
        helpers: {
            title: {
                type: 'inside'
            },
			minWidth: '250'
        }
    });

    $('.navwrap')
    // test the menu to see if all items fit horizontally
    .bind('testfit', function () {
        var nav = $(this),
            items = nav.find('a');

        $('body').removeClass('nav-menu');

        // when the nav wraps under the logo, or when options are stacked, display the nav as a menu              
        if ((nav.offset().top > nav.prev().offset().top) || ($(items[items.length - 1]).offset().top > $(items[0]).offset().top)) {

            // add a class for scoping menu styles
            $('body').addClass('nav-menu');

        }
    })

    // toggle the menu items' visiblity
    .find('h3#menu')
        .bind('click focus', function () {
        $(this).parent().toggleClass('expanded');
    });

    // ...and update the nav on window events
    $(window).bind('load resize orientationchange', function () {
        $('.navwrap').trigger('testfit');
    });

});