function CheckWords(field)
{
	var mxLen = 50;
	var wordVal = field.value
	var lines = wordVal.split("\n");

	for (var j = 0; j < lines.length; j++)
	{
		var words = lines[j].split(" ");

		for (var i = 0; i < words.length; i++)
		{
			if (words[i].length > mxLen)
     			{
				return "Invalid"
			}
		}
	}
}

	function ForumComplaint(CompType, CompId, TopicId, CntId, CtyId, PageNo)
	{
		if(CompType=="BT")
		{
			var AccType = "topic"
		}
		else
		{
			var AccType = "message"
		}

		if(typeof(document.frm.txtFirstName) != "undefined")
		{
			var CompConfirm=window.confirm("Are you sure to report this "+ AccType +" as bad "+ AccType +". You need to login. Proceed?")
		}
		else
		{
	    var CompConfirm=window.confirm("Are you sure to report this "+ AccType +" as bad "+ AccType +"?")
		}

	    if (CompConfirm)
           window.location="/Sitegen3/forum/ForumComplaint.asp?Type="+CompType+"&Id="+CompId+"&TopicId="+TopicId+"&CntId="+CntId+"&CtyId="+CtyId+"&Page="+PageNo
	}

	function stripHTML(msg)
	{
		var re = /<\S[^><]*>/g
		document.frm.txtMessage.value = msg.replace(re, "")
	}

    function SbmtFrm(form)
    {
        stripHTML(form.txtMessage.value)

        if(trim(form.txtMessage.value)=="")
        {
            alert("Please complete the message field.")
            form.txtMessage.focus()
            return false
        }

        if(form.txtMessage.value.length>3000)
        {
            alert("Please limit your text to 3000 characters. You have used " + form.txtMessage.value.length + " characters.")
            form.txtMessage.focus()
            return false
        }

	if(CheckWords(form.txtMessage)=="Invalid")
	{
		alert("Words are restricted to 50 characters")
		form.txtMessage.focus()
		return false
	}

		if(typeof(form.txtFirstName) != "undefined")
		{
			var langMsg = "Please complete this field using English characters."
			if (typeof (Membership_MemCheckFrom_FName) == "undefined")
			Membership_MemCheckFrom_FName = "Please enter First Name."

			if (isEmpty(form.txtFirstName, "", Membership_MemCheckFrom_FName)) return false
			if (charCheck(form.txtFirstName, langMsg)) return false
			if (typeof (Membership_MemCheckFrom_LName) == "undefined")
			Membership_MemCheckFrom_LName = "Please enter Last Name."

			if (isEmpty(form.txtSecondName, "", Membership_MemCheckFrom_LName)) return false
			if (charCheck(form.txtSecondName, langMsg)) return false
			if (typeof (Membership_MemCheckFrom_Email) == "undefined")
			Membership_MemCheckFrom_Email = "Please enter E-mail Address."

			if (isEmpty(form.txtEmailId, "", Membership_MemCheckFrom_Email)) return false
			if (typeof (Membership_MemCheckFrom_NotVldEmail) == "undefined")
			Membership_MemCheckFrom_NotVldEmail = "The e-mail you entered is not a valid e-mail address."

			if (notEmail(form.txtEmailId, "", Membership_MemCheckFrom_NotVldEmail)) return false
		}

   	if(form.securityCode.value == "")
   	{
   		alert("Enter the security code as given in the image")
		form.securityCode.focus()
		return false
	}
    }
