
<!-- 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.requiredcontactbp.value=GetCookie('1bmrss$dqbp');
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');
}

function loadConfig() {
alert('This function will be activated later.');
return false;
document.plq.POST.selectedIndex=eval(GetCookie('1bmrss$dqPOST'));
if (document.plq.POST.selectedIndex == 0) {
   alert('Your POS configuration information is not available. Please enter\n\ryour configuration and it will be saved when you submit this form.');
   return false;
 }
document.plq.POSTmodel.value=GetCookie('1bmrss$dqPOSTmodel');
document.plq.BIOS.value=GetCookie('1bmrss$dqBIOS');
document.plq.memory.value=GetCookie('1bmrss$dqmemory');

document.plq.IOK.value=GetCookie('1bmrss$dqIOK');
document.plq.IOKP.value=GetCookie('1bmrss$dqIOKP');
document.plq.IOD.value=GetCookie('1bmrss$dqIOD');
document.plq.IODP.value=GetCookie('1bmrss$dqIODP');
document.plq.IOOD.value=GetCookie('1bmrss$dqIOOD');
document.plq.IOODP.value=GetCookie('1bmrss$dqIOODP');
document.plq.SPmodel.selectedIndex=eval(GetCookie('1bmrss$dq4820model'));

document.plq.IOS.value=GetCookie('1bmrss$dqIOS');
document.plq.IOSP.value=GetCookie('1bmrss$dqIOSP');
document.plq.IOM.value=GetCookie('1bmrss$dqIOM');
document.plq.IOMP.value=GetCookie('1bmrss$dqIOMP');
document.plq.IOCD.value=GetCookie('1bmrss$dqIOCD');
document.plq.IOCDP.value=GetCookie('1bmrss$dqIOCDP');
document.plq.SMtype.selectedIndex=eval(GetCookie('1bmrss$dq4610type'));
document.plq.SMfirmware.value=GetCookie('1bmrss$dq4610firmware');
document.plq.SMport.selectedIndex=eval(GetCookie('1bmrss$dq4610port'));
document.plq.SMrate.selectedIndex=eval(GetCookie('1bmrss$dq4610rate'));
document.plq.SMcontrol.selectedIndex=eval(GetCookie('1bmrss$dq4610control'));
document.plq.IOO.value=GetCookie('1bmrss$dqIOO');
document.plq.IOOP.value=GetCookie('1bmrss$dqIOOP');

document.plq.OS.selectedIndex=eval(GetCookie('1bmrss$dqOS'));
document.plq.fixpack.value=GetCookie('1bmrss$dqfixpack');
document.plq.pkg.selectedIndex=eval(GetCookie('1bmrss$dqpkg'));
document.plq.dver.value=GetCookie('1bmrss$dqdver');
document.plq.API.selectedIndex=eval(GetCookie('1bmrss$dqAPI'));

document.plq.sysinfo.value=GetCookie('1bmrss$dqsysinfo');

alert('Your last POS configuration information was loaded. Please verify\n\ryour configuration.  Updates will be saved when you submit this form.');
}


<!-- 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';
  }

<!-- Check Configuration Information -->

 if (eval("document.plq.POST.value") == '') {
  output += '  - Your POST type\n';
  }

 if (eval("document.plq.POSTmodel.value") == '') {
  output += '  - Your POST model\n';
  }

 if (document.plq.OS.selectedIndex == 0) {
  output += '  - Your Operating System\n';
  }

 if (document.plq.pkg.selectedIndex == 0) {
  output += '  - Your driver package\n';
  }

 if (eval("document.plq.dver.value") == '') {
  output += '  - Your driver package version\n';
  }

 if (document.plq.API.selectedIndex == 0) {
  output += '  - The driver API you are using\n';
  }

 if (eval("document.plq.summary.value") == '') {
  output += '  - A short summary of your problem\n';
  }

 if (eval("document.plq.desc.value") == '') {
  output += '  - Your problem 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$dqbp', document.plq.requiredcontactbp.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" : "");
}