var _commentLimit = 3000;


function SendToFriendNews(newsId)
{
	var stTemp = escape("/news/comments.aspx?mid="+ newsId);
	window.open("/site/sendfriend.aspx?type=news&pg="+stTemp, "_New", "toolbar=no,width=465,height=250,status=no,resizable=no");
}

function OnUpdateComent()
{
	var nCount = fldComment.value.length;
	if (nCount > _commentLimit)
	{
		window.status = "Warning: Your comment is exceeding "+ _commentLimit +" characters limit.";
		document.all.oCommmentCount.innerHTML = "(count: <b>"+ nCount +"</b>)<br><font color=red>Your comment is exceeding "+ _commentLimit +" characters limit, if you post this message users with narrowband connection will experience delay loading this page. Consider shorting your message below "+ _commentLimit +" characters.</font>";
	}
	else
	{
		window.status = "";
		document.all.oCommmentCount.innerHTML = "(count: <b>"+ nCount +"</b>)";
	}
}

window.setInterval("OnUpdateComent()", 3000);


// spell checker
function SpellCheckPost()
{
	if (bSubmited || !ValidatorOnSubmit())
		return false;
		
	window.open("", "_spellCheck", "width=375,height=195,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,directories=no");
	document.WizSpellCheck.sctext.value = fldComment.value;
	document.WizSpellCheck.target = "_spellCheck";
	return true;
}

function SpellCheckOpen()
{
	if (bSubmited || !ValidatorOnSubmit())
		return false;
		
	window.open("/shared/tools/spellcheck.aspx", "_spellCheck", "width=375,height=195,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no");
}

function SpellCheckGetText()
{
	return fldComment.value;
}

function SpellCheckCorrected(text)
{
	fldComment.value = text;
}


var bSubmited = false;

function ClearForm()
{
	var el = document.getElementById("ctl00_body_lblMsgInfo");
	if (el != null)
		el.innerText = "";
}

function ReplyTo(parentId)
{
	var fldName = document.getElementById("ctl00_body_txtName");
	var fldReplayTo = document.getElementById("ctl00_body_fldReplayTo");
	var oMsgInfo = document.getElementById("ctl00_body_lblMsgInfo");
	
	if (fldName.disabled)
	{
		alert("You can not reply to selected message because you are currently editing a message.");
		return;
	}
	
	fldReplayTo.value = parentId;
	oMsgInfo.innerText = "Write your reply";
}


var fldComment = document.getElementById("ctl00_body_txtComment");
