changing element ID to data-code?
<p>instead of using the <code>ID element</code>, <code>data-code</code>. Do I just change everything that is <code>.getElementById</code> to <code>getElementByData-code</code> ?</p>

<pre><code>// form validation function //
function validate(form) {
  var s_name = form.s_name.value;
  var s_email = form.s_email.value;
  var s_drop = form.s_drop.value;
// var s_promo = form.s_promo.value;
  var nameRegex = /^[A-Za-z\d_]+$/;
  var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
  var msgRegex = new RegExp(/&lt;\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'"&gt;\s]+))?)+\s*|\s*)\/?&gt;/gim);
  if(s_name == "") {
    inlineMsg('s_name','You must enter your name.',2);
    return false;
  }
  if(!s_name.match(nameRegex)) {
    inlineMsg('s_txt','You have entered an invalid name.',2);
    return false;
  }
  if(s_email == "") {
    inlineMsg('s_email','&lt;strong&gt;Error&lt;/strong&gt;&lt;br /&gt;You must enter your email.',2);
    return false;
  }
  if(!s_email.match(emailRegex)) {
    inlineMsg('s_email','&lt;strong&gt;Error&lt;/strong&gt;&lt;br /&gt;You have entered an invalid email.',2);
    return false;
  }
  if(s_drop == "") {
    inlineMsg('s_drop','&lt;strong&gt;Error&lt;/strong&gt;&lt;br /&gt;You must select your gender.',2);
    return false;
  }
/*
  if(s_promo == "") {
    inlineMsg('s_promo','You must enter a message.');
    return false;
  }
*/  
  if(s_promo.match(msgRegex)) {
    inlineMsg('s_promo','You have entered an invalid message.',2);
    return false;
  }
  return true;
}

// START OF MESSAGE SCRIPT //

var MSGTIMER = 20;
var MSGSPEED = 5;
var MSGOFFSET = 3;
var MSGHIDE = 3;

// build out the divs, set attributes and call the fade function //
function inlineMsg(target,string,autohide) {
  var msg;
  var msgcontent;
  if(!document.getElementById('msg')) {
    msg = document.createElement('div');
    msg.id = 'msg';
    msgcontent = document.createElement('div');
    msgcontent.id = 'msgcontent';
    document.body.appendChild(msg);
    msg.appendChild(msgcontent);
    msg.style.filter = 'alpha(opacity=0)';
    msg.style.opacity = 0;
    msg.alpha = 0;
  } else {
    msg = document.getElementById('msg');
    msgcontent = document.getElementById('msgcontent');
  }
  msgcontent.innerHTML = string;
  msg.style.display = 'block';
  var msgheight = msg.offsetHeight;
  var targetdiv = document.getElementById(target);
  targetdiv.focus();
  var targetheight = targetdiv.offsetHeight;
  var targetwidth = targetdiv.offsetWidth;
  var topposition = topPosition(targetdiv) - ((msgheight - targetheight) / 2);
  var leftposition = leftPosition(targetdiv) + targetwidth + MSGOFFSET;
  msg.style.top = topposition + 'px';
  msg.style.left = leftposition + 'px';
  clearInterval(msg.timer);
  msg.timer = setInterval("fadeMsg(1)", MSGTIMER);
  if(!autohide) {
    autohide = MSGHIDE;  
  }
  window.setTimeout("hideMsg()", (autohide * 1000));
}

// hide the form alert //
function hideMsg(msg) {
  var msg = document.getElementById('msg');
  if(!msg.timer) {
    msg.timer = setInterval("fadeMsg(0)", MSGTIMER);
  }
}

// face the message box //
function fadeMsg(flag) {
  if(flag == null) {
    flag = 1;
  }
  var msg = document.getElementById('msg');
  var value;
  if(flag == 1) {
    value = msg.alpha + MSGSPEED;
  } else {
    value = msg.alpha - MSGSPEED;
  }
  msg.alpha = value;
  msg.style.opacity = (value / 100);
  msg.style.filter = 'alpha(opacity=' + value + ')';
  if(value &gt;= 99) {
    clearInterval(msg.timer);
    msg.timer = null;
  } else if(value &lt;= 1) {
    msg.style.display = "none";
    clearInterval(msg.timer);
  }
}
</code></pre>
