function doShowHideWriteCommentBox(val)
{
	if(val == "Show")
	{
		document.getElementById('CommentWriteBox').style.display = "";

		if(document.frmcomment.vName)
			document.frmcomment.vName.focus();
		else if(document.frmcomment.vEmail)
			document.frmcomment.vEmail.focus();
		else
			document.frmcomment.tComments.focus();
	}
	else
	{
		document.getElementById('CommentWriteBox').style.display = "none";
	}
}
function checkValidation(frmObj)
{
	with(frmObj)
	{
		if(frmObj.mandatory_name.value == "Y" && vName.value == "")
		{
			alert("Please enter your name.");
			vName.focus();
			return false;
		}
		if(frmObj.mandatory_email.value == "Y" && vEmail.value == "")
		{
			alert("Please enter your email.");
			vEmail.focus();
			return false;
		}
		if(frmObj.mandatory_email.value == "Y" && (!isValidEmail(vEmail.value)))
		{
			vEmail.focus();
			vEmail.select();
			return false;
		}
		if(tComment.value == "" || tComment.value == "Write your comment here...")
		{
			alert("Please enter your comment.");
			tComment.focus();
			return false; 
		}
		if(vCaptchaVal.value == "")
		{
			alert("Please enter your answer.");
			vCaptchaVal.focus();
			return false; 
		}
		checkCaptchaVerification(document.frmcomment, document.frmcomment.vCaptchaVal.value, 'AddComment');
		return false;
		
	}
}

function textCounter(field, cntfield, maxlimit) 
{
	var len = document.getElementById(field).value.length;
	if( len > maxlimit) // if too long...trim it!
		document.getElementById(field).value = document.getElementById(field).value.substring(0, maxlimit);
	else
	{
		document.getElementById(cntfield).innerHTML = maxlimit - len;
		document.getElementById(cntfield).focus();
	}
}