title: Combine two javascript functions?
body: <p>How can I combine these two functions so that they both work? Right now, I can only get one to validate and not the other.</p>
  
  <p>SAMPLE OF THE JAVASCRIPT:</p>
  
  <pre><code>function validateForm() {
  
  var x=document.forms["giftCert"]["gift_name"].value;
  
  if (x==null || x=="") {
  
  errMsg = "The recpient's name is required.";              
      $("div#emptyName").show();
      $("div#emptyName").html(errMsg);
  
  return false;
    }
  }
  
  function validateForm() {
  
  var x=document.forms["giftCert"]["gift_email"].value;
  
  if (x==null || x=="") {
  
  errMsg2 = "The recpient's email address is required.";              
      $("div#emptyEmail").show();
      $("div#emptyEmail").html(errMsg2);
  
  return false;
    }
  }
  </code></pre>
  
  <p>SHORT VERSION OF THE FORM HTML:</p>
  
  <pre><code>&lt;form action="http://ww6.aitsafe.com/cf/voucher.cfm" method="post" name="giftCert" onsubmit="return validateForm()"  /&gt;
      *Name:&lt;input type="text" name="gift_name"&gt;
      &lt;div id="emptyName" class="error"&gt;&lt;/div&gt;
  
      *Email: &lt;input type="text" name="gift_email"&gt;
      &lt;div id="emptyEmail" class="error"&gt;&lt;/div&gt;
  
      &lt;input class="button" type="submit" value="Add to Cart" /&gt;
  
  &lt;/form&gt;
  </code></pre>