

function submit_search() {
	if( document.forms[0] ) {
		if( document.forms[0].szukaj.value == "szukana fraza" || document.forms[0].szukaj.value == "" ) {
			alert("Proszę podać frazę do wyszukania.");
			return;
		}
		document.forms[0].submit();
	}
}

function submit_contact_form() {
	var form = document.getElementById('fast_kontakt');
	if( form ) {
		if( !validate_form( 'nazwisko', 'Proszę podać nazwisko' ) ) {
			return;
		}
		if( !validate_form( 'mail', 'Proszę podać adres e-mail' ) ) {
			return;
		}
		if( !validate_form( 'tekst', 'Proszę wpisać pytanie' ) ) {
			return;
		}
		var zgoda = document.getElementById( 'zgoda' );
		if( zgoda.checked == true ) {
			form.submit();
			return;
		} 
		alert("Należy wyrazić zgodę na przetwarzanie danych osobowych");
		return;
	}
	alert("Brak dostępu do formularza");
}

function validate_form(id,text) {
	var elem = document.getElementById( id );
	if( typeof( elem ) != "undefined" ) {
		if( elem.value=='' ) {
			alert( text );
			return false;
		}
		return true;
	}
	return false;
}