/*  Extra javascript bits for Fancybox that I 
 *  don't want to add to every web page
 */

$(document).ready(function() {

	$("a#fancyImage1").fancybox({
		'titleShow'						: true,				// Show description
		'titlePosition'				: 'outside',	// The position of title. Can be set to 'outside', 'inside' or 'over'
		'titleFormat'					: formatTitleOuter,
		'padding'							: 1,					// Photo border
		'hideOnContentClick'	: true,
		'overlayOpacity'			: 0.8,				// Transparency
		'overlayColor'				: '#000',			// Colour over background
		'transitionIn'				: 'fade',			// The transition type. Can be set to 'elastic', 'fade' or 'none'
		'transitionOut'				: 'fade',
		'speedIn'							: 400,				// Speed of the fade and elastic transitions, in milliseconds
		'speedOut'						: 200,
		'changeFade'					: 'fast'			// Speed of the content fading while changing gallery items
	});

	$("a#fancyLightbox").fancybox({
		'titleShow'						: true,				// Show description
		'titlePosition'				: 'inside',		// The position of title. Can be set to 'outside', 'inside' or 'over'
		'titleFormat'					: formatTitleLightbox,
		'padding'							: 1,					// Photo border
		'hideOnContentClick'	: true,
		'overlayOpacity'			: 0.8,				// Transparency
		'overlayColor'				: '#000',			// Colour over background
		'transitionIn'				: 'fade',			// The transition type. Can be set to 'elastic', 'fade' or 'none'
		'transitionOut'				: 'fade',
		'speedIn'							: 400,				// Speed of the fade and elastic transitions, in milliseconds
		'speedOut'						: 200,
		'changeFade'					: 'fast'			// Speed of the content fading while changing gallery items
	});

	$("a#[rel=gallery1]").fancybox({
		'cyclic'							: true,				// Loops gallery
		'titleShow'						: true,				// Show description
		'titlePosition'				: 'outside',	// The position of title. Can be set to 'outside', 'inside' or 'over'
		'titleFormat'					: formatTitleOuter,
		'padding'							: 1,					// Photo border
		'hideOnContentClick'	: true,
		'overlayOpacity'			: 0.8,				// Transparency
		'overlayColor'				: '#000',			// Colour over background
		'transitionIn'				: 'fade',			// The transition type. Can be set to 'elastic', 'fade' or 'none'
		'transitionOut'				: 'fade',
		'speedIn'							: 400,				// Speed of the fade and elastic transitions, in milliseconds
		'speedOut'						: 200,
		'changeFade'					: 'fast'			// Speed of the content fading while changing gallery items
	});

	$("a.iframe").fancybox({
		'background'					: '#000',
		'titleShow'						: false,			// Show description
		'padding'							: 1,					// iframe border
		'width'								: 600,
		'height'							: 400,
		'hideOnContentClick'	: true,
		'overlayOpacity'			: 0.8,				// Transparency
		'overlayColor'				: '#000',			// Colour over background
		'transitionIn'				: 'fade',			// The transition type. Can be set to 'elastic', 'fade' or 'none'
		'transitionOut'				: 'fade',
		'speedIn'							: 400,				// Speed of the fade and elastic transitions, in milliseconds
		'speedOut'						: 200,
		'changeFade'					: 'fast'			// Speed of the content fading while changing gallery items
	});

});


function formatTitleLightbox(title, currentArray, currentIndex, currentOpts) {
    return '<div id="fancyImage2-title"><span><a href="javascript:;" onclick="$.fancybox.close();"><img src="http://www.martyphotography.com.au/lib/fancybox/fancybox/closelabel.gif" border="0"></a></span>' + (title && title.length ? '' + title + '' : '' ) + '</div>';
}

function formatTitleOuter(title, currentArray, currentIndex, currentOpts) {
    return '<div id="outer1-title">' + title + '</div>';
}

