// JavaScript Document
		$(document).ready(function() {
			$("#example1-1").fancybox({
				'zoomSpeedIn'			: 300,
				'zoomSpeedOut'			: 300,
				'hideOnContentClick'	: true
			});

			$("#example1-2").fancybox({
				titlePosition			: 'inside',
				'zoomSpeedIn'			: 300,
				'zoomSpeedOut'			: 300,
			    'zoomOpacity'			: true,
				'hideOnContentClick'	: false
			});


			$("#example1-3").fancybox({
				titlePosition			: 'inside',
				padding					: 20,
				'zoomSpeedIn'			: 0,
				'zoomSpeedOut'			: 0,
				'hideOnContentClick'	: true
			});

			$("#example2-1, #example2-2").fancybox({
				margin					: 0,
				'zoomSpeedIn'			: 0,
				'zoomSpeedOut'			: 0,
				'overlayShow'			: true,
				'hideOnContentClick'	: true,
				'titlePosition'			: 'inside',
				'titleFormat'			: function(itemTitle, itemArray, itemIndex, itemOpts) {
					return itemTitle + '<span style="float:left"> Image ' + (itemIndex + 1) + ' of ' + itemArray.length + '</span>';
				}
			});
			
			$("a.zoom1").fancybox({
			    'overlayShow'	: false,
				'autoScale'     : false,
				titlePosition	: 'inside'
			});
			
			$("a.zoom2").fancybox({
				titlePosition		: 'inside',
			    //'autoScale'         : false,
				'zoomSpeedIn'		: 0,
				'zoomSpeedOut'		: 0
			});
				
			$("#custom4").fancybox({
				zoomSpeedIn			: 0,
            	zoomSpeedOut		: 0,
				hideOnContentClick	: false	
			});
			
			$("a.zoom3").click(function() {
				$.fancybox( this, {
					autoDimensions	: false,
					margin			: 0,
					frameWidth		: '100%',
					frameHeight		: '100%'
				});
				
				return false;
			});
			
			$("a.zoom4").fancybox({
				modal : true
			});
			
			$("a.zoom5").fancybox({
		    	frameWidth			: 750,
				frameHeight			: 450,
				hideOnContentClick	: false
				/*,
				autoDimensions		: false,
				autoScale           : false
				*/
			});
			
			$("#custom1").click(function() {
				$.fancybox({
				    //orig    : this,
					href	: 'http://farm4.static.flickr.com/3498/4006876523_289a8296ee.jpg',
					title   : 'Custom title'
				}, {
					frameWidth		: 300,
					frameHeight		: 200
				});
			});

			$("#custom5").click(function() {
				$.fancybox({
					href	: 'http://farm4.static.flickr.com/3498/4006876523_289a8296ee.jpg',
					title   : 'Custom title'
				}, {
					frameWidth			: 300,
					frameHeight			: 200,
					callbackOnStart		:	function() {
						return window.confirm('Continue?');
					},
					callbackOnCancel	:	function() {
						alert('Canceled!');
					},
					callbackOnComplete	:	function() {
                        alert('Completed!');
					},
					callbackOnClosing	:	function() {
                        return window.confirm('Close?');
					},
					callbackOnClosed	:	function() {
                        alert('Closed!');
					}
				});
			});


			$("#login_form").bind("submit", function() {
			    $.fancybox.showActivity();
			    
				var data = $(this).serializeArray();

				$.ajax({
					type	: "POST",
					cache	: false,
					url		: "./examples/login.php",
					data	: data,
					success: function(data) {
						$.fancybox(data);
					}
				});

				return false;
			});
			
			

			
			
			$("#manual1").fancybox({
				//content 		: $.trim( $("#inline1").html() ),
				href		: 'http://farm4.static.flickr.com/3498/4006876523_289a8296ee.jpg',
				title   		: 'Title',
				zoomSpeedIn		: 200,
				zoomSpeedOut	: 200,
				padding			: 0
			});
			
			$("#manual2").fancybox({
				href		: 'http://farm4.static.flickr.com/3498/4006876523_289a8296ee.jpg',
				title   	: 'Title',
				type		: 'image',
				padding		: 60
			});
			
			$("#manual3").click(function() {
				$.fancybox( {href: '#inline2', title: 'Title'} );
			});
			
			$("#manual4").click(function() {
				$.fancybox({
					content : $.trim( $("#inline1").html() )
				});
			});
			
			var opts = {
				'padding'			: 20,
				'zoomSpeedIn'		: 200,
				'zoomSpeedOut'		: 200,
				'autoDimensions'	: true,
				'frameWidth'		: 500,
				'type'              : 'image'
			}
			
			$("#manual5").click(function() {
				$.fancybox([
					'http://farm4.static.flickr.com/3498/4006876523_289a8296ee.jpg',
					'http://farm4.static.flickr.com/3068/3096463741_67b9979fd4.jpg',
					{
						href	: 'http://farm4.static.flickr.com/3498/4006876523_289a8296ee.jpg',
						padding	: 0
					}
				], opts);
			});
			

	/*		$("#ajax1").fancybox();
			$("#ajax2").fancybox();

			$("#ajax3").fancybox();
			$("#ajax4").fancybox();
			$("#ajax5").fancybox();
			$("#ajax6").fancybox();
			
	*/
			$("#ajax1, #ajax2, #ajax3, #ajax4, #ajax5, #ajax6").fancybox({
				'autoScale'     		: true,
				margin					: 0,
				'zoomSpeedIn'			: 0,
				'zoomSpeedOut'			: 0,
				'overlayShow'			: true,
					frameWidth		: 1010,
					frameHeight		: 500,
				'hideOnContentClick'	: true,
				'titlePosition'			: 'inside',
				'titleFormat'			: function(itemTitle, itemArray, itemIndex, itemOpts) {
					return itemTitle + '<span style="float:left"> Image ' + (itemIndex + 1) + ' of ' + itemArray.length + '</span>';
				}
			});

			
		$("#ajax2_det").fancybox({
			    overlayShow     : true,
			    overlayOpacity	: 0.5,
   				overlayColor	: '#101010',
					frameWidth		: 1010,
					frameHeight		: 450,
				ajax			: {
				    type	: "POST",
				    data	: 'b=2'
				}
			});
			$("#ajax3_det").fancybox({
			    overlayShow     : true,
			    overlayOpacity	: 0.5,
   				overlayColor	: '#101010',
					frameWidth		: 1010,
					frameHeight		: 450,
				ajax			: {
				    type	: "POST",
				    data	: 'b=2'
				}
			});		
			$("#ajax4_det").fancybox({
			    overlayShow     : true,
			    overlayOpacity	: 0.5,
   				overlayColor	: '#101010',
					frameWidth		: 1010,
					frameHeight		: 450,
				ajax			: {
				    type	: "POST",
				    data	: 'b=2'
				}
			});
			$("#ajax5_det").fancybox({
			    'overlayShow'     : true,
			    'overlayOpacity'	: 0.5,
   				'overlayColor'	: '#101010',
					frameWidth		: 1010,
					frameHeight		: 450,
				ajax			: {
				    type	: "POST",
				    data	: 'b=2'
				}
			});		

			
			$("#ajax1_det").fancybox({
			    'overlayShow'     : true,
			    'overlayOpacity'	: 0.5,
   				'overlayColor'	: '#101010',
					frameWidth		: 1010,
					frameHeight		: 450,
				ajax			: {
				    type	: "POST",
				    data	: 'b=2'
				}
			});		


			$("#sizing1_det").fancybox({
			    'overlayShow'     : true,
			    'overlayOpacity'	: 0.5,
   				'overlayColor'	: '#101010',
					frameWidth		: 1010,
					frameHeight		: 450,
				ajax			: {
				    type	: "POST",
				    data	: 'b=2'
				}
			});		

			$("#sizing2_det").fancybox({
			    'overlayShow'     : true,
			    'overlayOpacity'	: 0.5,
   				'overlayColor'	: '#101010',
					frameWidth		: 1010,
					frameHeight		: 450,
				ajax			: {
				    type	: "POST",
				    data	: 'b=2'
				}
			});		
			$("#sizing3_det").fancybox({
			    'overlayShow'     : true,
			    'overlayOpacity'	: 0.5,
   				'overlayColor'	: '#101010',
					frameWidth		: 1010,
					frameHeight		: 450,
				ajax			: {
				    type	: "POST",
				    data	: 'b=2'
				}
			});		


			$("#search_go").click(function() {
				var what = $("#search_what").val();
				
				$.fancybox( {
					'href'	: 'http://www.google.ca/search?newwindow=1&q=' + what
				}, {
					frameWidth			: 750,
					frameHeight			: 430,
					type				: 'iframe'	
				});
			});
			
			$("#generate").click(function() {
			    $('<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit</p>').insertAfter(this);
			    $.fancybox.resize();
			});
			
		});
		
//		$(window).bind("load", function() { 
			// šito īstenībā vajadzētu tad, kad pilniibaa ielaadejusies lapa
			// mosh lapā rakstīt warningu - autodimensions var gļukot, ja lādē bildes, kas nav ielādējušās
			// (kā arī par marginiem)

//			$("#aaa").click(function() {
	//			var arr = [
	//			    $("#example1-1"),
					//$('#biude'),
				//	$('#biude')[0],
	//				$.trim( $("#inline1").html() ),
	//				{
	//					'href'	: 'http://farm4.static.flickr.com/3498/4006876523_289a8296ee.jpg',
	//					'orig'	: this,
	//					'opts'	: {
	//						'padding' : 0
	//					}
	//				}
	//			];
				
	//			$.fancybox( arr, {
	//				'zoomSpeedIn'		: 200,
	//				'zoomSpeedOut'		: 200,
	//				'autoDimensions'	: true,
	//				'frameWidth'		: 500
	//			});
	//		});
	//	});
