$(document).ready(function() {

	/* This is basic - uses default settings */

	$("a#single_image").fancybox();

	/* Using custom settings */

	$("a#inline").fancybox({
		'hideOnContentClick': true
	});

	/* Apply fancybox to multiple items */

	$("a.group").fancybox({
                'speedIn'                       :       600,
                'speedOut'                      :       200,
                'transitionIn'  : 'fade',
                'transitionOut' : 'fade',
                'overlayOpacity'        :       0.5,
                'overlayColor'          :       '#231f20',
                'titleShow'   :       true,
                'autoscale'     :       true
	});

        function formatTitle(title, currentArray, currentIndex, currentOpts) {
        return '<div id="tip7-title"><span><a href="javascript:;" onclick="$.fancybox.close();"><img src="/data/closelabel.gif" /></a></span>' + (title && title.length ? '<b>' + title + '</b>' : '' ) + 'Image ' + (currentIndex + 1) + ' of ' + currentArray.length + '</div>';
        }

        $(".tip7").fancybox({
                'showCloseButton'       : false,
                'titlePosition'                 : 'inside',
                'titleFormat'           : formatTitle
        });
        $("a.youtube").click(function() {
                $.fancybox({
                                'padding'               : 0,
                                'autoScale'             : false,
                                'overlayOpacity'        :       0.5,
                                'overlayColor'          :       '#231f20',
                                'transitionIn'  : 'fade',
                                'transitionOut' : 'fade',
                                'title'                 : this.title,
                                'width'         : 680,
                                'height'                : 495,
                                'href'                  : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
                                'type'                  : 'swf',
                                'swf'                   : {
                                        'wmode'                : 'transparent',
                                        'allowfullscreen'       : 'true'
                                }
                        });

                return false;
        });
});


