$(document).ready(function() {
/*		(function($) { */
			/*
			*   Examples - images
			*/

			$("a#Fade").fancybox({
				'titleShow'		: false
			});

			$("a#Elastic").fancybox({
				'titleShow'		: false,
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic'
			});

			$("a#None").fancybox({
				'titleShow'		: false,
				'transitionIn'	: 'none',
				'transitionOut'	: 'none'
			});

			$("a#Outside").fancybox();

			$("a#Inside").fancybox({
				'titlePosition'	: 'inside'
			});

			$("a#Over").fancybox({
				'titlePosition'	: 'over'
			});

			$("a[rel=Gallery]").fancybox({
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'titlePosition' 	: 'inside',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-inside">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});

			/*
			*   Examples - various
			*/

			$("#inLine").fancybox({
				'titlePosition'		: 'inside',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'hideOnContentClick': true
			});

			$("#inLine90").fancybox({
				'width'				: '90%',
				'height'			: '75%',
				'titlePosition'		: 'inside',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'hideOnContentClick': true
			});
			
			$("a.inLine550").fancybox({
				'width'				: '550px',
				'height'			: '75%',
				'titlePosition'		: 'inside',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'hideOnContentClick': true
			});

			$("a.inLine").fancybox({
				'titlePosition'		: 'inside',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'hideOnContentClick': true
			});

			$("a.inLine90").fancybox({
				'width'				: '90%',
				'height'			: '75%',
				'titlePosition'		: 'inside',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'hideOnContentClick': true
			});

			$("#Ajax").fancybox();

			$("#iFrame").fancybox({
				'width'				: '90%',
				'height'			: '75%',
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe'
			});
			
			$("a.iFrame").fancybox({
				'width'				: '90%',
				'height'			: '75%',
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe'
			});

			$("a.iFrame460").fancybox({
				'width'				: 800,
				'height'			: 500,
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe'
			});

			$("#iFrame460").fancybox({
				'width'				: 800,
				'height'			: 500,
				'autoScale'			: true,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe'
			});
			
			$("#SWF").fancybox({
				'padding'			: 0,
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			});

			$(".pdf").click(function() { 
			$.fancybox({ 
				'width'				: '100%',
				'height'			: '100%',
				'autoDimensions': false, 
				'content': '<embed src="'+this.href+'#nameddest=self&page=1&view=FitH,0&zoom=80,0,0" type="application/pdf" height="100%" width="100%" />', 
				'onClosed': function() { 
				$("#fancybox-inner").empty(); } 
				}); 
				return false; 
			}); // pdf 

			$(".youtube").click(function() {
			$.fancybox({
				'padding'		: 0,
				'autoScale'		: false,
				'transitionIn'	: 'none',
				'transitionOut'	: 'none',
				'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;
			});
			
			$("#youtube").click(function() {
			$.fancybox({
				'padding'		: 0,
				'autoScale'		: false,
				'transitionIn'	: 'none',
				'transitionOut'	: 'none',
				'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;
			});
			
			// for PDF auto-detection
		   $('a[href$=".pdf"]').addClass('fancybox-pdf');
		   
		  // setup FB for PDF using onStart to alter content
		   // leaving transition effects intact !
		   $('a.fancybox-pdf').fancybox({
			   'type' : 'html',
			   'margin' : 0,
			   'titlePosition' : 'inside',
			   'transitionIn' : 'elastic',
			   'transitionOut' : 'fade', // for cross-browser compatibility
			   'onStart' : function(selectedArray, selectedIndex, selectedOpts) { selectedOpts.content = '<embed src="' + selectedArray[selectedIndex].href + '#nameddest=self&page=1&view=FitH,0&zoom=80,0,0" type="application/pdf" height="' + Math.round( $
			   (window).height() * 0.9 ) + '" width="' + Math.round( $
			   (window).width() * 0.9 ) + '" />' }
		   });

		});
/*				})(jQuery); */
