function frmValidate()
{
	if((document.form1.fname.value).length>0)
	{
		if(!(checkAlphaNumeric(document.form1.fname.value)))
		{
			alert("Invalid First Name\nPlease Enter Characters ONLY!");	
			document.form1.fname.focus(true);
		}
		else
		{
		 	 if((document.form1.lname.value).length>0)
			{
				if(!(checkAlphaNumeric(document.form1.lname.value)))
				{
					alert("Invalid Last Name\nPlease Enter Characters ONLY!");	
					document.form1.lname.focus(true);
				}
				else
				{
		   			theField=document.form1.email.value
				   email_pattern = /.+\@.+\..+/;
        			if (!email_pattern.test(theField)) 
					{
					alert("Please enter the Email in the proper format:\n\nuser@some.thing");
					document.form1.email.focus(true);
             		return false;
          			}
					else
						{	
						 if((document.form1.city.value).length>0)
							{
							 if(!(checkAlphaNumeric(document.form1.city.value)))
							 {
							 alert("Invalid City Name");	
							 document.form1.city.focus(true);
							 }
							 else
							 {
								if((document.form1.zipcode.value).length>0)
								{
								if(!(checkNumeric(document.form1.zipcode.value)))
									{
									alert("Invalid Zip Code\nPlease Enter Numbers ONLY!");	
									document.form1.zipcode.focus(true);
									}
									else
									{
										if((document.form1.state.value).length==0)
										{
										alert("Please Select State");
										document.form1.state.focus(true);
										}
										else
										{
											if((document.form1.country.value).length==0)
										    {
											alert("Please Select Country");
											document.form1.country.focus(true);
											}
											else
											{
												if((document.form1.gender.value).length==0)
										    		{
													alert("Please Select gender");
													document.form1.gender.focus(true);
													}
													else
													{
															if((document.form1.comments.value).length==0)
																{
																alert("Please Enter Ur Comments");
																document.form1.comments.focus(true);
																}
																else
																{
																document.form1.submit();
																}
													}
													
											}
										}
									}
								}
								else
								{
								alert("Kindly Enter Zip Code");
								document.form1.zipcode.focus(true);
								}
							 }
						  }
	                   else
	                    {
		                     alert("Kindly Enter City Name");
		                       document.form1.city.focus(true);
	                    }
						
						}
				}
			}
			else
			{
				alert("Kindly Enter Last Name");
				document.form1.lname.focus(true);
			}
		}
	}
	else
	{
		alert("Kindly Enter First Name");
		document.form1.fname.focus(true);
	}
}	

function checkAlphaNumeric(v)	
{
		var charpos = v.search("[^A-Za-z ]"); 
		if(v.length > 0 &&  charpos >=0) 
		{
		 	return false;
		}
		else if(charpos<0)
		{
		return true;
		}
}
function checkNumeric(v)	
{
		var charpos = v.search("[^0-9]"); 
		if(v.length > 0 &&  charpos >=0) 
		{
		 	return false;
		}
		else if(charpos<0)
		{
		return true;
		}
}
