function check_contact(frm)
{
	var error=false;
	 var str="";
	 if(frm.bname.value==0)
	 {
	   str=str+"Please Enter Business Name  \n";
	   error=true;
	 }
	 if(frm.address.value==0)
	 {
	   str=str+"Please Enter Address  \n";
	   error=true;
	 }
	 if(frm.country.value=="")
	 {
	   str=str+"Please Select Country  \n";
	   error=true;
	 }
    if(frm.license.value==0)
	 {
	   str=str+"Please Enter Business License Number  \n";
	   error=true;
	 }
	 if(!CheckPhoneNumber(frm.phone.value))
	 {
		 str=str+"Please Enter Phone Number \n";
		 error=true;
	 }	 
	  if(echeck(frm.email.value)!=true)
	    {
		 str=str+"Please Enter Email  \n";
		 error=true;
	    }
      
	  if(error==true)
	   {
	  alert(str);
	  return false;
	  }
	  else
	  {
	  return true;
	  }
	
}

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

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

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

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

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

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

 		 return true					
	}	
	function CheckPhoneNumber(TheNumber) {
		var valid = 1
		var GoodChars = "0123456789()-+ "
		var i = 0
		if (TheNumber=="") {
			// Return false if number is empty
			valid = 0
		}
		for (i =0; i <= TheNumber.length -1; i++) {
			if (GoodChars.indexOf(TheNumber.charAt(i)) == -1) {
	// Note: Remove the comments from the following line to see this
	// for loop in action.
	// alert(TheNumber.charAt(i) + " is no good.")
				valid = 0
			} // End if statement
		} // End for loop
		return valid
	}

