// JavaScript Document


	function validateForm(form) {
		if (isNotEmpty(form.tit)) {
			if (isNotEmpty(form.e)) {	
				if (isNotEmpty(form.content)) {
					if (isEMailAddr(form.e))
						return true;			
				}
			}
		}
		return false;
	}
	
	function isEMailAddr(elem) {
		var str = elem.value;
		var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
		if (!str.match(re)) {
			alert("Sprawdź poprawność adresu email!");
			return false;
		} else {
			return true;
		}
	}
	
	function isNotEmpty(elem) {
		var str = elem.value;
		if(str == null || str.length == 0) {
			alert("Musisz wypełnić pola zanim wyślesz wiadomość!"+elem.value);
			return false;
		} else {
			return true;
		}
	}
	function validate(){
		var form = document.getElementById('kontactForm');
		return validateForm(form);
	}
	
	function closeInfoBox(){
		obj = document.getElementById('komunikat');
		obj.style.visibility = 'hidden';
	}
	
	function setText(message){
		var obj = document.getElementById('komunikat');
		obj.style.visibility = 'visible';
		obj.style.top = screen.height/2 - 160 +'px';
		//obj.style.left = screen.width/2-100+'px';
		var text = document.getElementById('mailInfoText');
		while (text.childNodes.length > 0) {
    		text.removeChild(text.firstChild);
		}

		var txt = document.createTextNode(message);
		text.appendChild(txt);
	}

