
function isPhone(phno){
	var pos=phno.search("[A-Za-z]"); 
	if(isProper(phno)==false) {
		return false;
	} 
	if (pos != -1) {
		return false;
	}
	return true;
} 
function isProper(string) {
   var iChars = "#=+*|'.`,\":<>[]{}~;@&$%!^\\\/?";
   for (var i = 0; i < string.length; i++) {
      if (iChars.indexOf(string.charAt(i)) != -1)
         return false;
   }
   return true;
}

function validatecontact(){
   
	var form = document.contact;

	var emailid= form.email.value;
	var fname = form.fname.value;
	var mno = form.contactno.value;
	
	emailid = trim(emailid);
	fname = trim(fname);
	mno = trim(mno);
	
	
	
	
	
	if(fname=="" && fname.length==0 || isProper(fname)==false ||!(isNaN(fname.charAt(0)))){
		form.fname.focus();
		alert('Please enter name');
		return false;
	}

 if(mno=="" && mno.length==0 || parseInt(mno)<99 || !isPhone(mno)){
		form.contactno.focus();
		alert('Phone numbershould be in number format only');
		return false;
	}
	
	if(emailid=="" || !echeck(emailid)){
		form.email.focus();
		alert('Please Enter Valid E-mail ID');
		return false;
	}
	
	
	return true;
}





function clears(){

  var form = document.contact;
  var contactno= form.contactno.value;

contactno = trim(contactno);
   
  if(contactno == "--With Country Code--") {
	  form.contactno.value="";
	  form.contactno.focus();
  }
	
}

