﻿function callFancy(href, caption) {
   var objLink = document.createElement('a');
   objLink.setAttribute('href',href);
   if(typeof caption != 'undefined') {
      objLink.setAttribute('title', caption);
   }
   $(objLink).fancybox();
   $(objLink).trigger('click');
}

function callFancyGroup(objid) {
	var obj = document.getElementById(objid);
	$(obj).trigger('click');
}

function callIframe(href){
	jQuery.fancybox({
				'width'				: '75%',
				'height'			: '75%',
				'autoScale'     	: false,
				'type'				: 'iframe',
					'href'			: href,
					'transitionIn'	: 'elastic',
					'transitionOut'	: 'elastic'
				});
}

function callFancyAjax(href){
	jQuery.fancybox({
				'autoScale'			: false,
				'autoDimensions'	: false,
				'width'				: 640,
				'height'			: 420,
				//'padding'			: '0',
				'overlayOpacity'	: '0.8',
				'overlayColor'		: '#000',
				'type'				: 'ajax',
				'href'			: href
				});
}

function callFancyGallery(imagesArray,imageIndex,callbackMovieID){
	jQuery.fancybox(imagesArray,
				{
					'index'				: imageIndex,
					'type'				: 'image',
						'cyclic'			: 'true',
						'overlayOpacity'	: '0.8',
						'overlayColor'		: '#000',
						'titlePosition' 	: 'inside',
						'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
													return (title.length ?'<span id="fancybox-title-inside">'+ title + '</span><br/>' : '') + '<span id="fancybox-title-inside-counter">Zdjęcie: ' + (currentIndex + 1) + ' / ' + currentArray.length + '</span>';
												},
						'onClosed'			: callbackMovieID?function() {
													var obj = document.getElementById(callbackMovieID);
													obj.startSlideshow();
												}:null
				});
}

function callFancyVideo(href,title){
	jQuery.fancybox({
															'autoScale'		: false,
															'title'			: this.title,
															'overlayShow'	:	true,
															'overlayOpacity': 0.80,
															'overlayColor'	: '#000',
															'hideOnOverlayClick': true,		
															'width'			: 680,
															'height'		: 495,
															'href'			: href,
															'title'			: title,
															'type'			: 'swf',
															'swf'			: {
																				'wmode'		: 'transparent',
																				'allowfullscreen'	: 'true',
																				'flashvars': 'hl=pl&afs=1&color1=0x83602F&color2=0x663205&fs=1'

																			}
															});
}
