﻿// JScript File

function myValidate()
{
  var tName=document.frmfeedback.txtName.value;
  var tEmail=document.frmfeedback.txtmail.value;
  var tMsg=document.frmfeedback.txtMsg.value;
  //alert("Hello" + tName);
  
  if(tName==" " ||tName.length==0)
  {
    alert("Please enter your Name");
    document.frmfeedback.txtName.focus();
    return false;
  }
  if(tEmail==" " ||tEmail.length==0 ||!ValidateEmail(tEmail))
  {
    alert("Please enter your Valid E-mail ID");
    document.frmfeedback.txtmail.focus();
    return false;
  }
  
  if(tMsg==" " ||tMsg.length==0)
  {
    alert("Please enter your Message");
    document.frmfeedback.txtMsg.focus();
    return false;
  }
  return true;
}
function ValidateEmail( Email )
{
		var atCharPresent = false;
		var dotPresent = false;
		for ( var Idx = 0; Idx < Email.length; Idx++ )
		{
			if ( Email.charAt ( Idx ) == '@' )
				atCharPresent = true;
			if ( Email.charAt ( Idx ) == '.' )
				dotPresent = true;
		}
		if ( !atCharPresent || !dotPresent )
			return false;

	return true;
}