

	function CheckForm()
		{
			var objField	=	document.frm_profile;
		
				email=objField.email.value;
				var splitted = email.match("^(.+)@(.+)$");
			if(splitted == null)
			{
			AlertFocus('Please enter your email address!',objField.email);
			return false;
			}
			if(splitted[1] != null )
			{
			  var regexp_user=/^\"?[\w-_\.]*\"?$/;
			  if(splitted[1].match(regexp_user) == null)
			  {
			  AlertFocus('Please enter your email address!',objField.email);
			  return false;
			  }
			}
			if(splitted[2] != null)
			{
			  var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
			  if(splitted[2].match(regexp_domain) == null) 
			  {
				var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
				if(splitted[2].match(regexp_ip) == null) 
			  {
				    AlertFocus('Please enter your email address!',objField.email);
				return false;
			
			  }
			  }// if
			}
	
			
			
			//check
			if(objField.password.value != "")
				{
					//check password fields
					if(objField.password.value.length < 5)
						{
							AlertFocus('Password too short! Must be atleast 5 characters long!',objField.password);
							return false;
						}
					if(objField.cpassword.value == "")
						{
							AlertFocus('Please confirm your password!',objField.cpassword);
							return false;
						}
					if(objField.cpassword.value != objField.password.value)
						{
							AlertFocus('Passwords do not match!',objField.cpassword);
							return false;
						}
				}
		
						
		
			
	
			
			
			
				if(objField.password.value == "")
						{
							AlertFocus('Please enter the password',objField.password);
							return false;
						}
				
			if(objField.name.value == "")
				{
					AlertFocus('Please enter your full name!',objField.name);
					return false;
				}
			
		
				
					if(objField.cophone.value == "")
				{
					AlertFocus('Please enter the Phone Number!',objField.cophone);
					return false;
				}
			
						if(objField.strtad.value == "")
				{
					AlertFocus('Please enter the street address!',objField.strtad);
					return false;
				}
			
				
			if(!validateemail(objField.email.value))
				{
					AlertFocus('Please enter your valid email address!',objField.email);
					return false;
				}
			
				
		}
		
		function AlertFocus(msg,obj)
			{
				window.alert(msg);
				var objref = eval(obj);
				objref.focus();
			}
			
		function validateEmail(x)
		{
			
				var re = /^.+\@.+\..{2,4}$/gi; 
				if(x.match(re))
				{
					return true;
				} 
				else
				{
					return false;
				}
		}

