/* gFader -> GalleryFader v. 1.0 , created by Swift, all rights reserved */
$(document).ready(function() {
						   
	
		var docWidth = $(document).width()-3;
		var docHeight = $(document).height()-3;
		$("#gf").fadeTo(1, 0);	
	
	$("#gallerybx img").click(function() {
		gfade($(this).attr("src"));
	});
	
	gfade = function(img) {
		var im = img.replace('minis/', 'c');
		//alert(im);
		var image = '<img src="'+im+'" alt="Obraz niedostêpny" style="display: none" />';
		$("#gf").css({
					 	"width" : docWidth,
					 	"height" : docHeight,
						"z-index" : "5",
						"display" : "block",
						"cursor" : "pointer"
					 });
		
		$("#gf").fadeTo(500, 1);	
		setTimeout(function() {	$("#gf").html(image); 			  
								$("#gf img").fadeIn("slow");
								$("#gf img").css({
										"margin-top" : "20px",
										"border" : "2px solid white",
										"position" : "absolute",
										"left" : "10px",
										"background" : "white"
						 		});			
								scrollTo(0,0);
											  }, 800);
		$("#gf").click(function() {
			$("#gf img").fadeOut("fast");
			
			setTimeout(function() {
				$("#gf").html(" "); 
				$("#gf").fadeOut("fast");								 
				setTimeout(function() { 
						$("#gf").css({	 
							"cursor" : "default",								 
							"display" : "none",							 
							"z-index" : "-1"							 
						});	
					}, 200);
								}, 200);
									   			   
		});
	}	
});

