﻿window.addEvent("domready",function(){
	var efekt1 = new Fx.Style('powieksz_01','color', {duration:300, wait:false});
	$('powieksz_01').addEvent('mouseenter', function(){
			efekt1.start('#370915','#f6e0e2');
	});
	
	$('powieksz_01').addEvent('mouseleave', function(){
			efekt1.start('#f6e0e2','#370915');
	});
});



function galeria(e) {
	var eSrc = e.src;
	eSrc = eSrc.substring(0, e.src.length - 5);
	document.getElementById('BigFoto').src = eSrc + 'm.jpg';
}

function pokaz() {
	
	document.getElementById('BigFoto').onclick = function() {
		if (!document.getElementById('galeriaOpacity')) {
		galeriaOpacity = document.createElement('div');
			document.body.appendChild(galeriaOpacity);
				galeriaOpacity.style.width = document.body.offsetWidth + 'px';
				galeriaOpacity.style.height = document.body.offsetHeight + 'px';
				galeriaOpacity.style.position = 'absolute';
				galeriaOpacity.style.background = '#000';
				galeriaOpacity.style.top = '0px';
				galeriaOpacity.style.left = '0px';
				galeriaOpacity.style.filter='Alpha(Opacity=50)';
				galeriaOpacity.style.opacity="0.5";
				galeriaOpacity.id = 'galeriaOpacity';	
		} else {
			document.getElementById('galeriaOpacity').style.display = 'block';
		}
	if (!document.getElementById('galeriaBody')) {
		galeriaBody = document.createElement('div');
			document.body.appendChild(galeriaBody);
				galeriaBody.style.width = document.body.offsetWidth + 'px';
				galeriaBody.style.height = document.body.offsetHeight + 'px';
				galeriaBody.style.position = 'absolute';
				galeriaBody.style.top = '0px';
				galeriaBody.style.left = '0px';
				galeriaBody.id = 'galeriaBody';
	} else {
			document.getElementById('galeriaBody').style.display = 'block';
	}
							
				galeriaCont = document.createElement('div');
					document.getElementById('galeriaBody').appendChild(galeriaCont);
						galeriaCont.id = 'galeriaCont';		

			var e = document.getElementById('BigFoto');
			var eSrc = e.src;
			eSrc = eSrc.substring(0, e.src.length - 5);
			if (!document.getElementById('galeriaFoto')) {
			img = document.createElement('img');
			}
			img.id = 'galeriaFoto';
			img.src = eSrc + 'b.jpg';					
			img.onclick = function() {
		}
		document.getElementById('galeriaCont').appendChild(img);
		document.getElementById('galeriaFoto').onclick = function() {
			document.getElementById('galeriaOpacity').style.display = 'none';
			document.getElementById('galeriaBody').style.display = 'none';
		}
	};
	
	document.getElementById('powieksz_01').onclick = function() {
		if (!document.getElementById('galeriaOpacity')) {
		galeriaOpacity = document.createElement('div');
			document.body.appendChild(galeriaOpacity);
				galeriaOpacity.style.width = document.body.offsetWidth + 'px';
				galeriaOpacity.style.height = document.body.offsetHeight + 'px';
				galeriaOpacity.style.position = 'absolute';
				galeriaOpacity.style.background = '#000';
				galeriaOpacity.style.top = '0px';
				galeriaOpacity.style.left = '0px';
				galeriaOpacity.style.filter='Alpha(Opacity=50)';
				galeriaOpacity.style.opacity="0.5";
				galeriaOpacity.id = 'galeriaOpacity';	
		} else {
			document.getElementById('galeriaOpacity').style.display = 'block';
		}
	if (!document.getElementById('galeriaBody')) {
		galeriaBody = document.createElement('div');
			document.body.appendChild(galeriaBody);
				galeriaBody.style.width = document.body.offsetWidth + 'px';
				galeriaBody.style.height = document.body.offsetHeight + 'px';
				galeriaBody.style.position = 'absolute';
				galeriaBody.style.top = '0px';
				galeriaBody.style.left = '0px';
				galeriaBody.id = 'galeriaBody';
	} else {
			document.getElementById('galeriaBody').style.display = 'block';
	}
							
				galeriaCont = document.createElement('div');
					document.getElementById('galeriaBody').appendChild(galeriaCont);
						galeriaCont.id = 'galeriaCont';		

			var e = document.getElementById('BigFoto');
			var eSrc = e.src;
			eSrc = eSrc.substring(0, e.src.length - 5);
			if (!document.getElementById('galeriaFoto')) {
			img = document.createElement('img');
			}
			img.id = 'galeriaFoto';
			img.src = eSrc + 'b.jpg';					
			img.onclick = function() {
		}
		
			document.getElementById('galeriaCont').appendChild(img);
			document.getElementById('galeriaFoto').onclick = function() {
			document.getElementById('galeriaOpacity').style.display = 'none';
			document.getElementById('galeriaBody').style.display = 'none';

		}
	};
}
