/**
	*       Javascript Library
	* -------------------------------
	* www.avatec.pl / biuro@avatec.pl
**/

	function SprawdzFormularz(f) 
	{ 
		if (f.email.value=='') { alert('Nie podałeś/aś adresu e-mail.'); return false; } 
		if ( ((f.email.value.indexOf('@',1))==-1)||(f.email.value.indexOf('.',1))==-1 ) { alert('Podałeś/aś błędny adres e-mail'); return false; } 
		if (f.imie.value=='') { alert('Nie podałeś/aś swojego imienia'); return false; } 
		if (f.pp.checked == false ) { alert('Musisz zgodzić się z Polityką Prywatności.'); return false; } else { return true; } 
	} 
	
	function checkEmail(email)
	{
		var x = email;
		var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if (filter.test(x)) { return true; }
		else { return false; }
	}

	function checkContactForm(form)
	{
		var msg='';
		if(form.imie.value=='') { msg+='* Wpisz swoje imię\n'; }
		if(form.email.value=='') { msg+='* Podaj swój adres e-mail\n'; }
		if(checkEmail(form.email.value)==false) { msg+='* Składnia adresu e-mail jest nieprawidłowa\n'; }
		if(form.temat.value=='') { msg+='* Podaj temat wiadomości\n'; }
		if(form.wiadomosc.value=='') { msg+='* Pole wiadomość musi zawierać treść\n'; }
		if(msg)
		{
			alert('Wystąpiły błędy\n\n'+msg);
			return false;
		} else { return true; }
	}
	
	function showPodgladKomentarza() 
	{

		if (document.all) { eval( "document.all.podglad.style.display = 'block'");	}
		if (document.layers) { 	document.layers['podglad'].display = 'block'; }
		if (document.getElementById &&!document.all) { hza = document.getElementById('podglad'); hza.style.display = 'block'; }

		if (document.all) { eval( "document.all.komentarz_p.style.display = 'none'");	}
		if (document.layers) { 	document.layers['komentarz_p'].display = 'none'; }
		if (document.getElementById &&!document.all) { hza = document.getElementById('komentarz_p'); hza.style.display = 'none'; }
		
		document.getElementById('tekst_komentarza').innerHTML=document.getElementById('komentarz_input').value;
	
	}
	
	function hidePodgladKomentarza() 
	{
		if (document.all) { eval( "document.all.podglad.style.display = 'none'");	}
		if (document.layers) { 	document.layers['podglad'].display = 'none'; }
		if (document.getElementById &&!document.all) { hza = document.getElementById('podglad'); hza.style.display = 'none'; }

		if (document.all) { eval( "document.all.komentarz_p.style.display = 'block'");	}
		if (document.layers) { 	document.layers['komentarz_p'].display = 'block'; }
		if (document.getElementById &&!document.all) { hza = document.getElementById('komentarz_p'); hza.style.display = 'block'; }
	
	}
