function mail(user, domain)
{
	window.location = 'mailto:'+user+'@'+domain;
}

function error(elem, text)
{
	if (errfound) return;
	window.alert(text);
	elem.select();
	elem.focus();
	errfound = true;
}

function Validate()
{
	errfound = false;
	//komentarze
	if (document.getElementById('autorx').value == "")
	{
		error(document.getElementById('autorx'),"Nie uzupełniłeś pola NICK.");
	}
	if (document.getElementById('newsx').value == "")
	{
		error(document.getElementById('newsx'),"Nie uzupełniłeś pola KOMENTARZ.");
	}
	return !errfound;
}

function Validate_gb()
{
	errfound = false;
	//księga gości
	if (document.getElementById('nick').value == "")
	{
		error(document.getElementById('nick'),"Nie uzupełniłeś pola NICK.");
	}
	if (document.getElementById('e_mail').value == "")
	{
		error(document.getElementById('e_mail'),"Nie uzupełniłeś pola E-MAIL.");
	}
	if (document.getElementById('wpis').value == ""){
		error(document.getElementById('wpis'),"Nie uzupełniłeś pola WPIS.");
	}
	return !errfound;
}

function emoticon(text, pole)
{
	if (document.getElementById(pole).createTextRange && document.getElementById(pole).caretPos)
	{
		var caretPos = document.getElementById(pole).caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
		document.getElementById(pole).focus();
	}
	else if (document.getElementById(pole).selectionStart != undefined)
	{
		document.getElementById(pole).value = document.getElementById(pole).value.substring(0, document.getElementById(pole).selectionStart) + ' ' + text + ' ' + document.getElementById(pole).value.substring(document.getElementById(pole).selectionStart);
		document.getElementById(pole).focus();
	}
	else
	{
		document.getElementById(pole).value += ' ' + text;
		document.getElementById(pole).focus();
	}
}