var 
max_title_size = 255;
//max_comment_size = 1024;

function checkData()
{
	if (DATA_SENT) return false;

	removeHtml('forum_name', 'forma');
	trimValue('forum_name', 'forma');
	dropDblSpaces('forum_name', 'forma');

	removeHtml('forum_text', 'forma');
	trimValue('forum_text', 'forma');
	encodeCRLF('forum_text', 'forma');
	dropDblSpaces('forum_text', 'forma');
	decodeCRLF('forum_text', 'forma');
	
	if (checkFoul('forma'))
	{
		alert(foulFound);
		return false;
	}

	with (document.forma.forum_sect)
	{
		if (!selectedIndex)
		{
			focus();
			alert(noSect);
			return false;
		}
	}

	with (document.forma.forum_name)
	{
		if (!value)
		{
			focus();
			alert(noValue);
			return false;
		}
		
		if (parseInt(document.forma.forum_lang.value) == 1)
		if (value.search(/[a-z]/i)>=0)
		if (!confirm(engInName))
		{
			focus();
			return false;
		}

		if (parseInt(document.forma.forum_lang.value) == 2)
		if (value.search(/[à-ÿ]/i)>=0)
		{
			focus();
			alert(rusInName);
			return false;
		}
	}

	var oldText;
	with (document.forma.forum_text)
	{
		if (!value)
		{
			focus();
			alert(noValue);
			return false;
		}
		
		oldText = value;

		if (document.forma.forum_lang.value == 1)
		if (value.search(/[a-z]/i)>=0)
		if (!confirm(engInText))
		{
			focus();
			return false;
		}

		if (document.forma.forum_lang.value == 2)
		if (value.search(/[à-ÿ]/i)>=0)
		{
			focus();
			alert(rusInText);
			return false;
		}
	}

	replaceSpecials('forma');
	
	// check max message size
	with (document.forma.forum_text)
	{
		if (value.length > parseInt(maxMsgSize))
		{
			value = oldText;
			focus();
			alert(textTooLarge);
			return false;
		}
	}
	
	return DATA_SENT = true;
}