function ValidPhone(aphone)
{
	// if the value (entered) of the name field is empty (length == 0) then send to the function rqNotEmpty to give empty error message.
		if(aphone=="")
		{
		alert("Phone number is required field!")
		return false
		}
		if (aphone.length < 6)
		{
		alert("Not less than 6 Characters");
		return false
		}
	
		// initialise the regular expression and place in a variable called regexy.
		var regexy = /[0123456789.\/\\.<>?:";',\[\]\{\}=\+\*\)\(&^%$#@!]/;
		
		// check to see if regexy test on the value (entered) was incorrect, if so give error message
		if (!regexy.test(aphone))
		{
		alert('Only Numeric letters');		
		return false;	
//			document.getElementById(fieldname+'_msg').innerHTML='Numbers only';
//			counter += "1";
//			disabler('contactcheckbox');
		}
		// otherwise provide a success message.
		else 
		{
		//alert('Phone number is invalid');
	return true;	
	
	//		document.getElementById(fieldname+'_msg').innerHTML='';
		//	counter = "0";
	//		disabler('contactcheckbox');
		}
	
// end alphaonly function.
/*
	var valid = "0123456789";

	
		
		if(aphone.length < 6 || aphone.length > 20)
		{
		alert("Invalid phone number! Please try again.")
		return false
		}
		
		
	for (var i=0; i < aphone.length; i++)
		{
		temp = "" + aphone.substring(i, i+1);
		
		
			if (valid.indexOf(temp) == "-1") 
			{
			alert("Invalid characters in your phone.  Please try again.")
			return false;
			}
		}*/
		
	
		return true
}






function valid_date(field)
{
	if(field=="")
	{
	alert("Date of Birth required field!")
	return false;
	}
	
	

	var valid = "0123456789/";
	var slashcount = 0;

	if (field.length!=10) 
	{
	alert("Invalid date! The correct date format is like '01/01/2004'.   Please try again.")
	return false;
	}
		for (var i=0; i < field.length; i++)
		 {
		temp = "" + field.substring(i, i+1);
		if (temp == "/") 
		slashcount++;
			if (valid.indexOf(temp) == "-1") 
			{
			alert("Invalid characters in your date.  Please try again.")
			return false;
			}
		if (slashcount > 2) 
		{
		alert("Invalid Date!  The slash character should be used with a properly formatted 8 digits like  '01/01/2004'.   Please try again.")
		return false;
  		 }
		if((field.charAt(2)!= '/')||(field.charAt(5) != '/'))
		{
		alert("Invalid date! The slash character should be used with a properly formatted 8 digits like  '01/01/2004'.   Please try again.")
		return false;
		}
	}
	return true;


}

function valid_required(field)
{
	if(field=="") 
	{
	return false;
	}

	return true;
}


function EmailValid(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

function ValidateForm(){
	var emailID=document.frmSample.txtEmail
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }
