function DigitsPlusMinus(FieldName)
{
	if(FieldName.value != "")
	{
		var ValidChars = "0123456789-+  ";
		for (j = 0; j < FieldName.value.length; j++)
		{
			var Char = FieldName.value.charAt(j);
			if (ValidChars.indexOf(Char) == -1)
			{
				return  false;
			}
		}
		return true;
	}
}

function checkcontact(frm)
{
	with(frm)
	{
		if(txtname.value == "")
		{
			alert("Please enter Name");
			txtname.focus();
			return false;
		}
		if(txtemail.value != '')	// if email field is not empty
		{
			//	set the regular expression
			var emails=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
			var membermailid = eval("txtemail.value"); // get the email address from the email field

			result1=membermailid.search(emails);	// look for improper email address in email field
			if(result1==-1)	// email address in email field is not proper
			{
				alert("Please enter valid email address."); // Display the alert box
				txtemail.focus();	// set focus to email field
				return false;
			}
		} // email validation ends here
		
		
		if(txtphone.value == "")
		{
			alert("Please enter telephone number.");
			txtphone.focus();
			return false;
		}
		if(!DigitsPlusMinus(txtphone))
		{
			alert("Telephone : Only 0 to 9, '-' , ' +' , and space is allowed.");
			txtphone.focus();
			return  false;
		}
		
		return true;
	}
}
