
<!-- This must be added to the FORM header onSubmit="return validateForm(this)" -->

var expdate = new Date ();

<!-- Used to initialize form info -->
function resetForm() {
document.plq.requiredcontactemail.value=GetCookie('1bmrss$email');
document.plq.requiredcontactfname.value=GetCookie('1bmrss$fname');
document.plq.requiredcontactlname.value=GetCookie('1bmrss$lname');
document.plq.requiredcontactcompany.value=GetCookie('1bmrss$company');
document.plq.requiredcontactstate.value=GetCookie('1bmrss$state');
document.plq.requiredcontactcountry.selectedIndex=eval(GetCookie('1bmrss$country'));
document.plq.requiredcontactphone.value=GetCookie('1bmrss$phone');
}

<!-- This validates the chosen configuration -->

function validateForm(f) {
 var output = '';

<!-- First do basic validation looking for no answers and bad email addresses -->

 if ((eval("document.plq.requiredcontactemail.value") == '') ||
  (document.plq.requiredcontactemail.value.indexOf(',') != -1) || 
  (document.plq.requiredcontactemail.value.indexOf(' ') != -1) || 
  (document.plq.requiredcontactemail.value.indexOf('@') == -1) || 
  (document.plq.requiredcontactemail.value.indexOf('.') == -1)) {
  output += '  - Your Valid Email Address\n';
  }
 if (eval("document.plq.requiredcontactfname.value") == '') {
  output += '  - Your First Name\n';
  }
 if (eval("document.plq.requiredcontactlname.value") == '') {
  output += '  - Your Last Name\n';
  }
 if (eval("document.plq.requiredcontactcompany.value") == '') {
  output += '  - Your Company\n';
  }
 if (eval("document.plq.requiredcontactstate.value") == '') {
  output += '  - Your State/Province\n';
  }
 if (document.plq.requiredcontactcountry.selectedIndex == 0) {
  output += '  - Your Country\n';
  }
 if (eval("document.plq.requiredcontactphone.value") == '') {
  output += '  - Your Phone\n';
  } 
 if (document.plq.requiredcontactphone.value.length < 10) {
  output += '  - Your phone number does not appear to have a country or area code\n';
  }
 if (eval("document.plq.customernumber.value") == '') {
    output += '  - Your IBM Customer Number (or NONE if unknown)\n';
  }
 if (eval("document.plq.POST.value") == '') {
  output += '  - POS Terminal Type\n';
  }
 if (eval("document.plq.OS.value") == '') {
   output += '  - Operating System\n';
  }
 if (eval("document.plq.summary.value") == '') {
  output += '  - Request Summary\n';
  }
 if (eval("document.plq.desc.value") == '') {
  output += '  - Detailed Description\n';
  }

 if (output != '') {
   alert('Please enter the following information:    \n\r' + output);
   return false;
 } 

<!-- Save info in cookie -->

expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000 * 31));
SetCookie ('1bmrss$email', document.plq.requiredcontactemail.value, expdate);
SetCookie ('1bmrss$fname', document.plq.requiredcontactfname.value, expdate);
SetCookie ('1bmrss$lname', document.plq.requiredcontactlname.value, expdate);
SetCookie ('1bmrss$company', document.plq.requiredcontactcompany.value, expdate);
SetCookie ('1bmrss$state', document.plq.requiredcontactstate.value, expdate);
SetCookie ('1bmrss$country', document.plq.requiredcontactcountry.selectedIndex, expdate);
SetCookie ('1bmrss$phone', document.plq.requiredcontactphone.value, expdate);
return true;
}

<!-- ================== COOKIE FUNCTIONS BELOW ================== -->

function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
  var j = i + alen;
  if (document.cookie.substring(i, j) == arg)
  return getCookieVal (j);
  i = document.cookie.indexOf(" ", i) + 1;
  if (i == 0) break; 
}
return '';
}  

function SetCookie (cname, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
expdate.setTime(expdate.getTime() +  (24 * 60 * 60 * 1000 * 31));
document.cookie = cname + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}