/* fancybox 1.3 RC2 config <script> */

		$(document).ready(function() {
			 $("a.zoom2").fancybox({
				'transitionIn'			: 'elastic',
				'transitionOut'			: 'elastic',
				'overlayShow'			: true,
				'hideOnContentClick'	: true,
				'overlayOpacity'		: 0.7,
				'overlayColor'			: '#AAA',				
				centerOnScroll          : true
			 });

			 $("a.zoom1").fancybox({
				'transitionIn'			: 'elastic',
				'transitionOut'			: 'elastic',
				'overlayShow'			: true,
				'hideOnContentClick'	: true,
				'overlayOpacity'		: 0.7,
				'overlayColor'			: '#AAA',				
				centerOnScroll          : true
			 });

			 $("a.hilfe1").fancybox({
				'overlayShow'			: false,
				'hideOnContentClick'	: false

			 });
		
		
			$("a.zoom2x").fancybox({
			    'transitionIn'	: 'none',
				'transitionOut'	: 'none',
			    'overlayShow'	: false,
				'autoScale'     : false,
				titlePosition	: 'inside'
			});
		
		
			$("#example1-1").fancybox({
				'transitionIn'			: 'elastic',
				'transitionOut'			: 'elastic',
				'hideOnContentClick'	: true,
				centerOnScroll          : true
			});

			$("#example1-2").fancybox({
				titlePosition			: 'inside',
				'transitionIn'			: 'elastic',
				'transitionOut'			: 'elastic',
			    'opacity'				: true,
				'hideOnContentClick'	: false
			});


			$("#example1-3").fancybox({
				titlePosition			: 'inside',
				padding					: 20,
				'transitionIn'			: 'fade',
				'transitionOut'			: 'fade',
				'hideOnContentClick'	: true
			});

			$("#example2-1, #example2-2").fancybox({
				changeFade              : 0,
			    titleShow               : false,
				margin					: 0,
				'transitionIn'			: 'none',
				'transitionOut'			: 'none',
				'overlayShow'			: true,
				'hideOnContentClick'	: true
			});
			
			$("a.zoomX").fancybox({
				titlePosition		: 'inside',
			    //'autoScale'         : false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				onCleanup : function() {
                    //return window.confirm('Close?');
				}
			});
			
			$("a.zoom21").fancybox({
				titlePosition		: 'inside',
			    'autoScale'         : false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'autoDimensions'    : false,
				'frameWidth'        : 500,
				'frameHeight'       : 'auto'
			});
			
			$("a.zoom22").fancybox({
				titlePosition		: 'inside',
			    'autoScale'         : false,
			    'autoDimensions'    : true,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			});
				
			$("#custom4").fancybox({
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				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,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				hideOnContentClick	: false
				/*,
				autoDimensions		: false,
				autoScale           : false
				*/
			});
			
			$("#custom1").click(function() {
				$.fancybox({
				    //orig    : this,
				    'transitionIn'	: 'none',
					'transitionOut'	: 'none',
					href			: '#biude',
					title   		: 'Custom title'
				}, {
					frameWidth		: 300,
					frameHeight		: 200
				});
			});

			$("#custom5").click(function() {
				$.fancybox({
					href	: '#biude',
					title   : 'Custom title'
				}, {
					frameWidth			: 300,
					frameHeight			: 200,
					onStart		:	function() {
						return window.confirm('Continue?');
					},
					onCancel	:	function() {
						alert('Canceled!');
					},
					onComplete	:	function() {
                        alert('Completed!');
					},
					onCleanup	:	function() {
                        return window.confirm('Close?');
					}
				});
			});


			$("#login_form").bind("submit", function() {
			    $.fancybox.showActivity();
			    
				var data = $(this).serializeArray();

				$.ajax({
					type	: "POST",
					cache	: false,
					url		: "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',
				'transitionIn'	: 'none',
				'transitionOut'	: 'none',
				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'			: 50,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'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/3068/3096463741_67b9979fd4.jpg',
						padding	: 0
					}
				], opts);
			});
			
/*
			var opts = {
				'zoomSpeedIn'		: 200,
				'zoomSpeedOut'		: 200,
				'autoDimensions'	: true,
				'frameWidth'		: 500
			}
			
			$("#manual1").click(function() {
				$.fancybox( $.trim( $("#inline1").html() ), opts);
			});
			
			$("#manual2").click(function() {
				$.fancybox( $('#biude'), opts);
			});
			
			$("#manual3").click(function() {
				$.fancybox( $('#biude')[0], opts);
			});
			
			$("#manual4").click(function() {
				$.fancybox( {
					'href'	: 'http://farm4.static.flickr.com/3498/4006876523_289a8296ee.jpg',
					'orig'	: this
				}, opts);
			});
			
			$("#manual5").click(function() {
				$.fancybox([
					{ 'href' : 'http://farm4.static.flickr.com/3498/4006876523_289a8296ee.jpg' },
					{ 'href' : 'http://farm4.static.flickr.com/3068/3096463741_67b9979fd4.jpg' }
				], opts);
			});
*/
			$("#ajax1").fancybox({
				ajax			: {
				    type	: "POST",
				    data	: 'a=1'
				}
			});
			
			$("#ajax2").fancybox({
			    overlayShow     : true,
			    overlayOpacity	: 0.5,
   				overlayColor	: '#101010',

				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 i-steni-ba- vajadze-tu tad, kad pilniibaa ielaadejusies lapa
			// mosh lapa- raksti-t warningu - autodimensions var gl,ukot, ja la-de- bildes, kas nav iela-de-juša-s
			// (ka- ari- 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
				});
			});
		});

