function formvalidation()
{	
	
	if(document.getElementById('firstname').value =='')
		{
			alert("First Name Required !");
			document.getElementById('firstname').focus();
			return false;
		}
	if(document.getElementById('lastname').value =='')
		{
			alert("Last Name Required !");
			document.getElementById('lastname').focus();
			return false;
		}
	if(document.getElementById('emailaddress').value =='')
		{
			alert("Email Address Required !");
			document.getElementById('emailaddress').focus();
			return false;
		}	

	 else if(!validateEmail(document.getElementById('emailaddress').value))
    {
        alert('Email address is invalid !');
        document.getElementById('emailaddress').focus();
        return false;
    }		
	
	if(document.getElementById('address').value =='')
		{
			alert("Address Required !");
			document.getElementById('address').focus();
			return false;
		}
	if(document.getElementById('city').value =='')
		{
			alert("City Name Required !");
			document.getElementById('city').focus();
			return false;
		}
	if(document.getElementById('subject').value =='')
		{
			alert("Subject Required !");
			document.getElementById('subject').focus();
			return false;
		}	
	if(document.getElementById('feedback').value =='')
		{
			alert("Please fill your feedback !");
			document.getElementById('feedback').focus();
			return false;
		}		

}

function validateEmail(email)
{    
// a very simple email validation checking. 
// you can add more complex email checking if it helps 
    if(email.length <= 0)
    {
      return true;
    }
    var splitted = email.match("^(.+)@(.+)$");
    if(splitted == null) return false;
    if(splitted[1] != null )
    {
      var regexp_user=/^\"?[\w-_\.]*\"?$/;
      if(splitted[1].match(regexp_user) == null) 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) return false;
      }// if
      return true;
    }
return false;
}