function hidePop()
{
	document.getElementById('ad').style.display = 'none';
}

function Gallery(photo_id)
{
	var left = screen.width / 2 - 340;
	var top = screen.height / 2 - 270;
	
	
	handle = window.open ('../photo.php?photo_id=' + photo_id , 'galleryPreview', 'menubar=no, toolbar=no, resizable=no, width=660, height=570, top=' + top + ', left=' + left);
}

function showImage (source, description) {
	//funkcja wyswietlajaca zdjecia z galerii w nowym oknie

	var left = screen.width / 2 - 340;
	var top = screen.height / 2 - 270;
	
	handle = window.open ('', '', "menubar=no, toolbar=no, resizable=no, width=660, height=570, top=" + top + ", left=" + left);

	handle.focus();
	handle.document.open();
	handle.document.write ('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" /><link rel=\"stylesheet\" href=\"preview_style.css\" type=\"text/css\" />');
	handle.document.write ('<title>' + description + '</title>');
	handle.document.write ('</head><body style="text-align: center;">');
	handle.document.write ("<img src='" + source + "' alt='' onclick='window.close();' />");
	if (description != '')
	{
			handle.document.write ("<p class=\'description\'>" + description + "</p>");
	}
	handle.document.write ("<p style='text-align: center;'><a href='#' onclick='window.close();'><img src='img/zamknij.png' alt=\'\' /></a></p>");
	handle.document.write ('</body></html>');
	handle.document.close();
}

function myWidth()
{
	if( typeof( window.innerWidth ) == 'number' )
   {
		//Non-IE
		return window.innerWidth;
	}
	
	if( document.documentElement && document.documentElement.clientWidth )
	{
		//IE 6+ in 'standards compliant mode'
		return document.documentElement.clientWidth;
	}
	
	if( document.body && document.body.clientWidth )
	{
		//IE 4 compatible
		return document.body.clientWidth;
	}
}

function myHeight()
{
		var browserHeight = 0;

		if (typeof( window.innerHeight ) == 'number')
		{
				//Non-IE
				
				browserHeight = window.innerHeight - 166;
				
				if (browserHeight < 280)
						browserHeight = 280;
						
				return browserHeight;
		}
		
		if (document.documentElement && document.documentElement.clientHeight)
		{
				//IE 6+ in 'standards compliant mode'
				
				browserHeight = document.documentElement.clientHeight - 170;
				
				if (browserHeight < 280)
						browserHeight = 280;
						
				return browserHeight;
		}
		
		if (document.body && document.body.clientHeight )
		{
				//IE 4 compatible
				
				browserHeight = document.body.clientHeight - 170;
				
				if (browserHeight < 280)
						browserHeight = 280;
						
				return browserHeight;
		}
}

function changeFooter()
{
		var browserHeight = myHeight();
		document.getElementById('nav').style.height = browserHeight + 'px';
}

function validForm()
{
	var wzor = /^[a-z0-9\-_\.]+?@[a-z0-9\-_\.]+?\.[a-z]{2,5}$/; 
	var email = document.getElementById('from').value;
	if (wzor.test(email) == false || email == '')
	{
		alert('Proszę podać poprawny adres e-mail');
		document.getElementById('from').focus();
		return false;
	} 
	
	var wzor = document.getElementById('subject').value;
	if (wzor.length < 1)
	{
		alert('Brak tematu');
		document.getElementById('subject').focus();
		return false;
	}
	
	var wzor = document.getElementById('text').value;
	if (wzor.length < 1)
	{
		alert('Brak treści');
		document.getElementById('text').focus();
		return false;
	}
	
	
	return true;
}