function formatTitle(title, currentArray, currentIndex, currentOpts) {
	
	if(title.length > 0) {
		return '<span id="fancybox-title-over">' + (title && title.length ? title : titleArray[currentIndex]) + '</span>';
		//return '<span id="fancybox-title-over">' + title + '</span>';
	} else {
		return '';
	}
	//return '<span id="fancybox-title-over" style="position: relative;">' + (title && title.length ? title : titleArray[currentIndex]) + '<span style="position: absolute; right: 10px; top: 11px;">&copy; Molok Ltd.</span></span>';
}

jQuery(document).ready(function() {
	
	$("a[id=inline]").fancybox({
    		'transitionIn'		: 'none',
    		'transitionOut'		: 'none',
    		'titlePosition' 	: 'over'

    	});
	
    $("a[rel=gallery_images]").fancybox({
    		'transitionIn'		: 'none',
    		'transitionOut'		: 'none',
    		'titlePosition' 	: 'over',
    		'titleFormat'       : formatTitle

    	});
		
	$("area[rel=gallery_images]").fancybox({
    		'transitionIn'		: 'none',
    		'transitionOut'		: 'none',
    		'titlePosition' 	: 'over',
    		'titleFormat'       : formatTitle

    	});	
		
	$.fn.fancybox.defaults = {
		padding				:	10,
		margin				:	20,
		opacity				:	false,
		modal				:	false,
		cyclic				:	false,
		scrolling			:	'no',	// 'auto', 'yes' or 'no'

		width				:	560,
		height				:	340,

		autoScale			:	true,
		autoDimensions		:	true,
		centerOnScroll		:	false,

		ajax				:	{},
		swf					:	{ wmode: 'transparent' },

		hideOnOverlayClick	:	true,
		hideOnContentClick	:	false,

		overlayShow			:	true,
		overlayOpacity		:	0.6,
		overlayColor		:	'#000',

		titleShow			:	true,
		titlePosition		:	'outside',	// 'outside', 'inside' or 'over'
		titleFormat			:	null,

		transitionIn		:	'fade',	// 'elastic', 'fade' or 'none'
		transitionOut		:	'fade',	// 'elastic', 'fade' or 'none'

		speedIn				:	300,
		speedOut			:	300,

		changeSpeed			:	300,
		changeFade			:	'fast',

		easingIn			:	'swing',
		easingOut			:	'swing',

		showCloseButton		:	true,
		showNavArrows		:	true,
		enableEscapeButton	:	true,

		onStart				:	null,
		onCancel			:	null,
		onComplete			:	null,
		onCleanup			:	null,
		onClosed			:	null		
	};	

});

