
<!-- This must be added to the FORM header onSubmit="return validateForm(this)" -->

var OSs="";
var APIs="";
var POSTs="";
var expdate = new Date ();

<!-- Used to clear marked radio buttons -->
function clearCheckBox() {
OSs="";
APIs="";
POSTs="";
for (j = 0; j < 3; j++) {
  document.dreg.API[j].checked = false;
  }
for (j = 0; j < 8; j++) {
  document.dreg.POST[j].checked = false;
  }
for (j = 0; j < 9; j++) {
  document.dreg.OS[j].checked = false;
  }
FillInForm()
}

<!-- 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.dreg.requiredcontactname.value") == '') {
  output += '  - Your Name\n';
  }
 if (eval("document.dreg.requiredcontactcompany.value") == '') {
  output += '  - Your Company\n';
  }
 if (document.dreg.requiredcontactcountry.selectedIndex == 0) {
  output += '  - Your Country\n';
  }
 if ((eval("document.dreg.requiredcontactemail.value") == '') ||
  (document.dreg.requiredcontactemail.value.indexOf(',') != -1) || 
  (document.dreg.requiredcontactemail.value.indexOf(' ') != -1) || 
  (document.dreg.requiredcontactemail.value.indexOf('@') == -1) || 
  (document.dreg.requiredcontactemail.value.indexOf('.') == -1)) {
  output += '  - Your Valid Email Address\n';
  }

 if (OSs==''){
  output += '  - Target Operating System\n';
  }
 if (POSTs=='') {
  output += '  - Target POS System\n';
  } 
 if (APIs=='') {
  output += '  - Target Driver API\n';
  }

 if (output != '') {
   alert('Please enter the following information:    \n\r' + output);
   return false;
 } 


<!-- Second start validating the choices and build error report -->


 if (OSs=='DOS' && POSTs.indexOf('232') != -1){
   output += '- No DOS drivers need for this system.\n';
 }

 if (('posspossb'.indexOf(APIs) != -1) && (POSTs.indexOf('232') != -1)){
   output += '- This system does not support the POSS API.\n';
 }

 if (OSs=='DOS' && ('jposopos'.indexOf(APIs) != -1)){
   output += '- OPOS & JavaPOS APIs not supported in DOS.\n';
 }

 if (('DOSos2lin'.indexOf(OSs) != -1) && (APIs.indexOf('opos')) != -1) {
   output += '- The OPOS API is architected only for Windows.\n';
  }

 if (((OSs == 'lin') || (OSs.indexOf('xpWindowsVista') != -1 )) && (POSTs.indexOf('4695') != -1)){
   output += '- This system does not support this OS.\n';
 }

 if (((OSs == 'lin') || (OSs.indexOf('xp') != -1 )) && (POSTs.indexOf('4614') != -1)){
   output += '- You must program directly to the I/O under Linux.\n';
 }


 if (((APIs=='jposb remove this to disable beta-oposb') && (POSTs.indexOf('usb') != -1) && OSs=='lin') ==-1) {
   output += '- No BETA package exists for this configuraiton.\n\r';
 }

 if (('linDOS'.indexOf(OSs) == -1) && (APIs=='possb'))  {
   output += '- No BETA package exists for this configuraiton.\n\r';
 }

 if (APIs=='oposb remove this to disable beta-'){
   output += '- No BETA package exists for this configuraiton.\n\r';
 }

 if (APIs=='opos-DISABLED'){
   output += '- This package not available. Please check back after 10-24.\n\r';
 }

 if (APIs=='dosb'){
   output += '- No BETA package exists for this configuraiton.\n\r';
 }

 if (('w95os2'.indexOf(OSs) != -1) && ((POSTs.indexOf('300') != -1) || (POSTs.indexOf('500') != -1) || (POSTs.indexOf('700') != -1)|| (POSTs.indexOf('kiosk') != -1)) ){
   output += '- This system does not support this OS.\n';
 }

 if (output != '') {
   alert('POS drivers are not available for your configuration.  \n\rPlease review the following exceptions that were noted:\t\n\r' + output);
   clearCheckBox();
   return false;
 } else {


<!-- Third put up any warning messages -->

 if (('DOSos2w95wnt'.indexOf(OSs) != -1) && (POSTs.indexOf('usb') != -1)){
   output += '- Chosen OS does not support USB devices. Only use RS-485 or RS-232 peripherals.\n';
 }

 if (('posspossb'.indexOf(APIs) != -1) && (POSTs.indexOf('usb') != -1)){
   output += '- The POSS API does not support USB or RS-232 devices. Only use RS-485 peripherals.\n';
 }

 if (OSs !='DOS' && OSs !='os2' && ('posspossb'.indexOf(APIs) != -1)){
  output += '- We recommend that you use the industry standard JavaPOS or OPOS API to maximize\n\r  your development investment. The POSS API is not available for all terminals.\n\r';
 }

 if ((OSs.indexOf('xp') != -1 ) && (POSTs.indexOf('300') == -1)){
   output += "- Older terminals may not support Windows XP. Check\n  the Knowledgebase for Windows XP compatiblility.\n\r";
   output += "- Note Driver Defects on XPe/WEPOS must be reproduced on\n\r  XP Professional to receive support.\n\r"
 }

 if ('w95os2w98wnt'.indexOf(OSs) != -1){
  output += "- The operating system you chose is no longer supported by our current POS drivers.\n\rIn addition our latest terminals do not support it. Please migrate to a supported OS soon.\n\r";
 }

 if ('w 98w nt -disabled remove spaces to enable'.indexOf(OSs) != -1){
  output += "- The operating system you chose is no longer supported. The driver package may or may not work with it.\n\rIn addition our latest terminals may or may not support it. Please migrate to Windows 2000/XP or Linux soon.\n\r";
 }

 if ((APIs=='oposb') || (APIs=='jposb') || (APIs=='possb')){
   output += '\n\r** This BETA package is for development use ONLY! **\n\r';
 }

if (output != '') alert('Please review the following warnings that were noted:\t\n\r' + output);

<!-- Save info in cookie -->


expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000 * 31));
SetCookie ('1bmrss$name', document.dreg.requiredcontactname.value, expdate);
SetCookie ('1bmrss$company', document.dreg.requiredcontactcompany.value, expdate);
<!-- alert('DebugSet:' + document.dreg.requiredcontactcountry.selectedIndex); -->
SetCookie ('1bmrss$country', document.dreg.requiredcontactcountry.selectedIndex, expdate);
SetCookie ('1bmrss$email', document.dreg.requiredcontactemail.value, expdate);


<!-- Update the success variable to point to the next web page -->


 if (OSs == 'DOS' && APIs=="poss"){
   document.dreg.success.value = 'https://www2.clearlake.ibm.com/store/support/html/possdosdl.html';
   return true;
 }

 if (OSs == 'DOS' && APIs=="possb"){
   document.dreg.success.value = 'https://www2.clearlake.ibm.com/store/support/html/possdbeta.html';
   return true;

 }

 if (OSs == 'lin' && APIs=="possb"){
   document.dreg.success.value = 'https://www2.clearlake.ibm.com/store/support/html/posslbeta.html';
   return true;
 }

 if (OSs == 'os2' || OSs=='w95'|| OSs=='w98'|| OSs=='wnt'){
   document.dreg.success.value = 'https://www2.clearlake.ibm.com/store/support/html/odriversdl.html ';
   return true;
 }

 if (OSs=='lin' && APIs=="jpos-delete to enable" && POSTs.indexOf('usb') != -1){
   document.dreg.success.value = 'https://www2.clearlake.ibm.com/store/support/html/jpos2ldl.html';
   return true;
 }

 if (OSs=='lin' && APIs=="jpos"){
   document.dreg.success.value = 'https://www2.clearlake.ibm.com/store/support/html/jposldl.html ';
   return true;
 }

 if (OSs=='lin' && APIs=="poss"){
   document.dreg.success.value = 'https://www2.clearlake.ibm.com/store/support/html/possldl.html ';
   document.dreg.success.value = 'https://www2.clearlake.ibm.com/store/support/html/jposldl.html ';
   return true;
 }

 if (OSs=='lin' && APIs=="apos"){
   document.dreg.success.value = 'https://www2.clearlake.ibm.com/store/support/html/aposldl.html ';
   return true;
 }

 if (APIs=="jposb"){
   document.dreg.success.value = 'https://www2.clearlake.ibm.com/store/support/html/jpbetala.html ';
   return true;
 }

 if (APIs=="jpos"){
   document.dreg.success.value = 'https://www2.clearlake.ibm.com/store/support/html/jposwdl.html ';
   return true;
 }

 if (APIs=="oposb"){
   document.dreg.success.value = 'https://www2.clearlake.ibm.com/store/support/html/oposbetala.html ';
   return true;
 }

 if (APIs=="opos"){
   document.dreg.success.value = 'https://www2.clearlake.ibm.com/store/support/html/oposdl.html ';
   return true;
 }

 if (APIs=="poss"){
   document.dreg.success.value = 'https://www2.clearlake.ibm.com/store/support/html/posswdl.html ';
   document.dreg.success.value = 'https://www2.clearlake.ibm.com/store/support/html/jposwdl.html ';
   return true;
 }

 if (APIs=="apos"){
   document.dreg.success.value = 'https://www2.clearlake.ibm.com/store/support/html/aposwdl.html ';
   return true;
 }

 return true;
 }
  
}

<!-- ================== COOKIE FUNCTIONS BELOW ================== -->

function FillInForm() {
document.dreg.requiredcontactname.value=GetCookie('1bmrss$name')
document.dreg.requiredcontactcompany.value=GetCookie('1bmrss$company')
document.dreg.requiredcontactcountry.selectedIndex=eval(GetCookie('1bmrss$country'))
<!-- alert('DebugGet:' + document.dreg.requiredcontactcountry.selectedIndex);-->
document.dreg.requiredcontactemail.value=GetCookie('1bmrss$email')
}

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" : "");
}










