/**
 * Javascript code
 * for the text editor
 */
function autoresize()
{
	$('td.messages img').each(function()
    {
		if(this.width > 556) 
		{
			this.height = this.height * 556 / this.width;
			this.width = 556;
		}
	});
}

$(document).ready(function()
{
    $("#forumRecord").submit(function()
    {
    	var ed = tinyMCE.get('forumPost_sContent');
        var sTitleValue = $('#forum_sTitle').val();
        var oForm = $('#forumRecord');
        var content = ed.getContent();
        if(!content && !sTitleValue)
        {
            alert(forumRecordErrorContentAndTitleEmpty);
            return false;
        }
        else if(!content)
        {
            alert(forumRecordErrorContentEmpty);
            return false;
        }
        else if(!sTitleValue)
        {
            alert(forumRecordErrorTitleEmpty);
            return false;
        }
    });
    
    autoresize();
});