var click = false;

function showTopPic(k,mx,id){
	for (i=0;i<=mx;i++) {if (i==k) document.getElementById(id+i).style.visibility='visible'; else document.getElementById(id+i).style.visibility='hidden';}}

function abo(id,s){
	if (s) document.getElementById(id).className='borderON'; else document.getElementById(id).className='borderOFF';}

function hideMsg(){
	document.getElementById('messageBox').style.visibility='hidden';}

function menuMEvnt(id,img){
	if (document.getElementById(id) && img) document.getElementById(id).src = img;}

function goToURL(url){
	if (url) document.location.href=url;}

function sendKForm(){
	if (click) return false;
	var info = "";
	var p =/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	var f = document.forms['formMessage'];
	if (!p.test(f.inputEmail.value)) {if (_lng=='pl') info+='\n- poprawny adres e-mail'; else info+='\n- empty or invalid e-mail address';} 
	if (!f.inputMessage.value) {if (_lng=='pl') info+='\n- treść wiadomości'; else info+='\n- empty message';}
	if (info)
	{
		if (_lng=='pl') info = "Wiadomość nie może zostać wysłana, ponieważ\nnie wszystkie wymagane pola zostały wypełnione.\n\nBrakujące informacje:" + info + ".\n\nProszę uzupełnić dane i ponownie wysłać wiadomość.";
		else info = "Your message could not be sent because of required fields are not valid:\n" + info + ".\n\nPlease, fill in the mandatory fields and send the form again.";
		alert (info);
	}
	else {click = true; f.submit();}}

function sendNForm(o){
	if (click) return false;
	var info = "";
	var p =/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	var f = document.forms['formNewsletter'];
	f.onl.value=o;
	if (!p.test(f.inputNewsletter.value)) {if (_lng=='pl') info='\nNiepoprawny adres e-mail!\n\n'; else info='\nInvalid e-mail address!\n\n';}
	if (info) alert (info); else {click = true; f.submit();}}


