// Contact form validation

function everything(form) 
  {
    isEmail(form)
    isPhone(form)
    isName(form)
	isCompany(form)
	isVerification(form)
    allblanks(form)
  }
  
function allblanks(form) 
  {
    if((isName(form) && isEmail(form)) && (isPhone(form)) && (isCompany(form))  && (isVerification(form))) 
      {
        form.submit()
      }
    if((isName(form) == false || isEmail(form) == false) || (isPhone(form) == false) || (isCompany(form) == false) || (isVerification(form) == false)) 
      {
        compose(form)
      }
  }

function compose(form) 
  {
    var text = "Please check that you filled the following required field(s) in correctly:"	
    if(isName(form) == false) 
	  {
        text += "\nYour name"
      }
    if (isPhone(form) == false) 
	  {
        text += "\nYour phone number"
      }
    if(isEmail(form) == false) 
	  {
        text += "\nYour e-mail address"
      }
	  if(isCompany(form) == false) 
	  {
        text += "\nYour company"
      }
	  if(isVerification(form) == false) 
	  {
        text += "\nPlease enter the text from the verification image"
      }
	  
	  alert(text)
  }

function isName(form) 
  {
    if (form.name.value == "") 
      {
        return false
      }
    else 
    {
      return true
    }
  }

function isEmail(form) 
  {
    if ((form.email.value == "" || form.email.value.indexOf('@', 0) == -1) || form.email.value.indexOf('.') == -1) 
     {
       return false
     }
   else 
     {
       return true
     }
  }
  
function isPhone(form) 
  {
    if (form.telephone.value == "") 
      {
        return false
      }
    else 
    {
      return true
    }
  }
function isCompany(form) 
  {
    if (form.company_name.value == "") 
      {
        return false
      }
    else 
    {
      return true
    }
  }
function isVerification(form) 
  {
    if (form.antispam.value == "") 
      {
        return false
      }
    else 
    {
      return true
    }
  }