sCount1=0;
sCount2=0;
sCount3=0;
newwin1=null;
newwin2=null;
newwin3=null;
newwin4=null;

iprbtn1=0;

function checkQuickContactForm(i) {

qcn=document.getElementById('qcname').value;
qce=document.getElementById('qceml').value;
qcm=document.getElementById('qcmsg').value;
qcv=document.getElementById('vi1').value;

replaceWith="HHH-";
emailBody = escape(qcm);

 for(i=0; i < emailBody.length; i++) {

  if(emailBody.indexOf("%0D%0A") > -1) {
  emailBody=emailBody.replace("%0D%0A",replaceWith)
  }
  else if(emailBody.indexOf("%0A") > -1) {
  emailBody=emailBody.replace("%0A",replaceWith)
  }
  else if(emailBody.indexOf("%0D") > -1) {
  emailBody=emailBody.replace("%0D",replaceWith)
  }

 }

qcm=unescape(emailBody);
 for(i=0; i < qcm.length; i++) {
 qcm=qcm.replace('HHH-','%0a');
 qcm=qcm.replace('&','%26');
 qcm=qcm.replace('+','%2B');
 qcm=qcm.replace(';','%3B');
 qcm=qcm.replace(':','%3A');
 }

document.getElementById('qcmsghidden').value=qcm;

if (i=='') {qcetest=validateEmail(qce);}
else {qcetest=true;}

 if ((qcn=='')||(qcm=='')||(qce=='')||(qcetest==false)||(qcv=='')) {alert('Error!\n\nPlease fill out form correctly,\nthen resubmit. Thank you.');return false;}
 else {return true;}

}

function createRequestObject() {
var ro;
browser = navigator.appName;
 if(browser == "Microsoft Internet Explorer") {
 ro = new ActiveXObject("Microsoft.XMLHTTP");
 }
 else{
 ro = new XMLHttpRequest();
 }
return ro;
}

var http = createRequestObject();
var http2 = createRequestObject();

function resetpass(y,z) {
n=Math.floor(Math.random()*9999999);
http.open('get', 'reset-acct-pass.pl?b='+y+'&c='+z+'&d='+n);
http.onreadystatechange = GetResetPassResponse;
http.send(null);

}

function GetResetPassResponse() {
 if(http.readyState == 4){
 response = http.responseText;
  if (response=='updated') {alert('Your password has been updated!');location.href='members.pl';}
  if (response=='no match') {
  alert('The current password was\nnot correct. Please retype then submit!');
  document.getElementById('currpass').value='';
  document.getElementById('currpass').focus();
  document.getElementById('submitbutton').disabled=false;
  }
 }
}

function locationchange(v) {

alert(v);

}

function resetacctpass() {
npass=document.getElementById('newpass').value;
npass2=document.getElementById('confnewpass').value;

 if ((npass!='')&&(npass2!='')&&(npass.length==5)&&(npass2.length==5)&&(npass==npass2)) {
 resetpass(npass,npass2);
 document.getElementById('submitbutton').disabled=true;
 }
 else{
  if (npass!=npass2) {alert('Your new passwords do not match!');}
  else {alert('Please make sure each field is\ncompletely filled out.');}
 }

}

function passclear() {
p=document.getElementById('acctpass').value;
 if (p=='*******') {document.getElementById('acctpass').value='';}
}

function affiliatesignupform() {
fn=document.getElementById('fname').value;
ln=document.getElementById('lname').value;
ap=document.getElementById('acctpass').value;
em1=document.getElementById('email1').value;
em2=document.getElementById('email2').value;
p1=document.getElementById('ph1').value;
p2=document.getElementById('ph2').value;
p3=document.getElementById('ph3').value;
bn=document.getElementById('bname').value;
//sa=document.getElementById('saddress').value;
tn=document.getElementById('taxnumber').value;
//ci=document.getElementById('city').value;
//st8=document.getElementById('state').value;
//zi=document.getElementById('zip').value;
ma=document.getElementById('mailingaddress1').value;
wr=document.getElementById('wurl').value;
pt=document.getElementById('payto').value;

err=0;
errmsg='';

 if (fn=='') {err++;errmsg='First name field cannot be blank.';}
 else {
 fn=fn.replace(/^\s+|\s+$/g, '');
 fn=fn.toLowerCase();
 st=fn.length;
  for (i = 0; i < st; i++) {
   if (i == 0) {
   tmpChar = fn.substring(0,1).toUpperCase();
   postString = fn.substring(1,st);
   fn = tmpChar + postString;
   }
  }
 document.getElementById('fname').value=fn;
 }

 if (ln=='') {
 err++;
  if (errmsg=='') {errmsg='Last name field cannot be blank.';}
  else {errmsg+='\nLast name field cannot be blank.';}
 }
 else {
 ln=ln.replace(/^\s+|\s+$/g, '');
 ln=ln.toLowerCase();
 st=ln.length;
  for (i = 0; i < st; i++) {
   if (i == 0) {
   tmpChar = ln.substring(0,1).toUpperCase();
   postString = ln.substring(1,st);
   ln = tmpChar + postString;
   }
  }
 document.getElementById('lname').value=ln;
 }

 apChk=alphaNumCheck(ap,7);
 if ((ap=='')||(ap.length<7)||(apChk=='no')) {
 err++;
  if (errmsg=='') {errmsg='Password must be 7 letters and/or numbers';}
  else {errmsg+='\nPassword must be 7 letters and/or numbers.';}
 }

 if ((em1=='')||(em2=='')) {
 err++;
  if (errmsg=='') {errmsg='Email fields cannot be blank.';}
  else {errmsg+='\nEmail fields cannot be blank.';}
 }
 else {
 em1=em1.replace(/^\s+|\s+$/g, '');
 em2=em2.replace(/^\s+|\s+$/g, '');
 e1test=validateEmail(em1);
 e2test=validateEmail(em2);
  if ((e1test == false)||(e2test == false)) {
  err++;
   if (errmsg=='') {errmsg='Email must be formatted correctly.';}
   else {errmsg+='\nEmail must be formatted correctly.';}
  }
  else {
   if (em1!=em2) {
   err++;
    if (errmsg=='') {errmsg='Email fields do not match.';}
    else {errmsg+='\nEmail fields do not match.';}
   }
  }
 document.getElementById('email1').value=em1;
 document.getElementById('email2').value=em2;
 }

 phChk1=numCheck(p1,3);
 phChk2=numCheck(p2,3);
 phChk3=numCheck(p3,4);
 if ((p1=='')||(p2=='')||(p3=='')||(p1.length<3)||(p2.length<3)||(p3.length<4)||(phChk1=='no')||(phChk2=='no')||(phChk3=='no')) {
 err++;
  if (errmsg=='') {errmsg='Phone number must contain 7 numbers.';}
  else {errmsg+='\nPhone number must contain 7-digits.';}
 }

/*

 if (sa=='') {
  err++;
  if (errmsg=='') {errmsg='Street address field cannot be blank.';}
  else {errmsg+='\nStreet address field cannot be blank.';}
 }
 else {
 sa=sa.replace(/^\s+|\s+$/g, '');
 sa=sa.toLowerCase();
 st=sa.length;
  for (i = 0; i < st; i++) {
   if (i == 0) {
   tmpChar = sa.substring(0,1).toUpperCase();
   postString = sa.substring(1,st);
   sa = tmpChar + postString;
   }
  }
 saarray=sa.split(" ");
 saarrycnt=saarray.length;
  if (saarrycnt>1) {
  sa='';
  ix=0;
   while (ix<saarrycnt) {
   saarrypc=saarray[ix];
   st=saarrypc.length;
    for (i = 0; i < st; i++) {
     if (i == 0) {
     tmpChar = saarrypc.substring(0,1).toUpperCase();
     postString = saarrypc.substring(1,st);
     saarrypc = tmpChar + postString;
     }
    }
    if (ix == saarrycnt-1) {sa+=saarrypc;}
    else {sa+=saarrypc+' ';}
   ix++;
   }
  }
 saarray=sa.split("-");
 saarrycnt=saarray.length;
  if (saarrycnt>1) {
  sa='';
  ix=0;
   while (ix<saarrycnt) {
   saarrypc=saarray[ix];
   st=saarrypc.length;
    for (i = 0; i < st; i++) {
     if (i == 0) {
     tmpChar = saarrypc.substring(0,1).toUpperCase();
     postString = saarrypc.substring(1,st);
     saarrypc = tmpChar + postString;
     }
    }
    if (ix == saarrycnt-1) {sa+=saarrypc;}
    else {sa+=saarrypc+'-';}
   ix++;
   }
  }
 document.getElementById('saddress').value=sa;
 }

 if (ci=='') {
 err++;
  if (errmsg=='') {errmsg='City address field cannot be blank.';}
  else {errmsg+='\nCity address field cannot be blank.';}
 }
 else {
 ci=ci.replace(/^\s+|\s+$/g, '');
 ci=ci.toLowerCase();
 st=ci.length;
  for (i = 0; i < st; i++) {
   if (i == 0) {
   tmpChar = ci.substring(0,1).toUpperCase();
   postString = ci.substring(1,st);
   ci = tmpChar + postString;
   }
  }
 ciarray=ci.split(" ");
 ciarrycnt=ciarray.length;
  if (ciarrycnt>1) {
  ci='';
  ix=0;
   while (ix<ciarrycnt) {
   ciarrypc=ciarray[ix];
   st=ciarrypc.length;
    for (i = 0; i < st; i++) {
     if (i == 0) {
     tmpChar = ciarrypc.substring(0,1).toUpperCase();
     postString = ciarrypc.substring(1,st);
     ciarrypc = tmpChar + postString;
     }
    }
    if (ix == ciarrycnt-1) {ci+=ciarrypc;}
    else {ci+=ciarrypc+' ';}
   ix++;
   }
  }
 ciarray=ci.split("-");
 ciarrycnt=ciarray.length;
  if (ciarrycnt>1) {
  ci='';
  ix=0;
   while (ix<ciarrycnt) {
   ciarrypc=ciarray[ix];
   st=ciarrypc.length;
    for (i = 0; i < st; i++) {
     if (i == 0) {
     tmpChar = ciarrypc.substring(0,1).toUpperCase();
     postString = ciarrypc.substring(1,st);
     ciarrypc = tmpChar + postString;
     }
    }
    if (ix == ciarrycnt-1) {ci+=ciarrypc;}
    else {ci+=ciarrypc+'-';}
   ix++;
   }
  }
 document.getElementById('city').value=ci;
 }

 if ((st8=='')||(st8.length<2)) {
 err++;
  if (errmsg=='') {errmsg='State field cannot be blank.';}
  else {errmsg+='\nState field cannot be blank.';}
 }
 else {
 st8=st8.toUpperCase();
 document.getElementById('state').value=st8;
 }

 zipChk=numCheck(zi,5);
 if ((zi=='')||(zi.length<5)||(zipChk=='no')) {
 err++;
  if (errmsg=='') {errmsg='Zip code must contain 5 numbers.';}
  else {errmsg+='\nZip code must contain 5 numbers.';}
 }

*/

 if (ma=='') {
 err++;
  if (errmsg=='') {errmsg='Mailing Address field cannot be blank.';}
  else {errmsg+='\nMailing Address field cannot be blank.';}
 }

 if (bn=='') {
 err++;
  if (errmsg=='') {errmsg='Business name field cannot be blank.';}
  else {errmsg+='\nBusiness name field cannot be blank.';}
 }
 else {
 bn=bn.replace(/^\s+|\s+$/g, '');
 bn=bn.toLowerCase();
 st=bn.length;
  for (i = 0; i < st; i++) {
   if (i == 0) {
   tmpChar = bn.substring(0,1).toUpperCase();
   postString = bn.substring(1,st);
   bn = tmpChar + postString;
   }
  }
 bnarray=bn.split(" ");
 bnarrycnt=bnarray.length;
  if (bnarrycnt>1) {
  bn='';
  ix=0;
   while (ix<bnarrycnt) {
   bnarrypc=bnarray[ix];
   st=bnarrypc.length;
    for (i = 0; i < st; i++) {
     if (i == 0) {
     tmpChar = bnarrypc.substring(0,1).toUpperCase();
     postString = bnarrypc.substring(1,st);
     bnarrypc = tmpChar + postString;
     }
    }
    if (ix == bnarrycnt-1) {bn+=bnarrypc;}
    else {bn+=bnarrypc+' ';}
   ix++;
   }
  }
 bnarray=bn.split("-");
 bnarrycnt=bnarray.length;
  if (bnarrycnt>1) {
  bn='';
  ix=0;
   while (ix<bnarrycnt) {
   bnarrypc=bnarray[ix];
   st=bnarrypc.length;
    for (i = 0; i < st; i++) {
     if (i == 0) {
     tmpChar = bnarrypc.substring(0,1).toUpperCase();
     postString = bnarrypc.substring(1,st);
     bnarrypc = tmpChar + postString;
     }
    }
    if (ix == bnarrycnt-1) {bn+=bnarrypc;}
    else {bn+=bnarrypc+'-';}
   ix++;
   }
  }
 document.getElementById('bname').value=bn;
 }

 if (tn=='') {
 err++;
  if (errmsg=='') {errmsg='SSN/Tax ID# field cannot be blank.';}
  else {errmsg+='\nSSN/Tax ID#  field cannot be blank.';}
 }

 if (wr=='') {
 err++;
  if (errmsg=='') {errmsg='Website URL field cannot be blank.';}
  else {errmsg+='\nWebsite URL field cannot be blank.';}
 }

 if (pt==0) {
 err++;
  if (errmsg=='') {errmsg='Please select a "Make Payment To" option.';}
  else {errmsg+='\nPlease select a "Make Payment To" option.';}
 }

 if (err!=0) {
 errmsghdr='The Form Has Errors!\n---------------------------\n';
 errmsgftr='\n---------------------------\nPlease correct, then resubmit!';
 alert(errmsghdr+errmsg+errmsgftr);
 }
 else {
 document.getElementById('hdv22').value='pass';
 document.getElementById('submitbutton').disabled=true;
 document.getElementById('resetbutton').disabled=true;
 document.getElementById('addaffiliateform').submit();
 }

}

function checkLoginForm() {

em=document.getElementById('email').value;
 if (em != '') {
 document.getElementById('retrieveloginsubmit').disabled=true;
 return true;
 }
 else {return false;}

}

function confirmpr1904() {
window.location="confirm-panel-1904.cgi";
}

function denypr1904() {

dusp = confirm("You will not be eligible to\nparticipate on this panel. OK?");

 if (dusp == true) {window.location="deny-panel-1904.cgi";}

}

function storereviewid(v) {

 document.getElementById('offerid54').value=v;
 oid21=document.getElementById('offerid54').value;
 selectreviewform.submit();

}

function checkPostReviewSurvey() {


 if (iprbtn1 < 1) {

 diffsu2a=document.getElementById('diffsu1a').checked;
 diffsu2b=document.getElementById('diffsu1b').checked;
 sutext2=document.getElementById('sutext1').value;

 difftr2a=document.getElementById('difftr1a').checked;
 difftr2b=document.getElementById('difftr1b').checked;
 trtext2=document.getElementById('trtext1').value;

 whysign2=document.getElementById('whysign1').value;

 continue2a=document.getElementById('continue1a').checked;
 continue2b=document.getElementById('continue1b').checked;

 rectofrnd2a=document.getElementById('rectofrnd1a').checked;
 rectofrnd2b=document.getElementById('rectofrnd1b').checked;

 rectofam2a=document.getElementById('rectofam1a').checked;
 rectofam2b=document.getElementById('rectofam1b').checked;

 experience2=document.getElementById('experience1').value;

 rate2a=document.getElementById('rate1a').checked;
 rate2b=document.getElementById('rate1b').checked;
 rate2c=document.getElementById('rate1c').checked;
 rate2d=document.getElementById('rate1d').checked;
 rate2e=document.getElementById('rate1e').checked;

 addcomment2=document.getElementById('addcomment1').value;

 satisfied2=document.getElementById('satisfied3').checked;

 err432=0;
 err433='';

 if ((diffsu2a == false)&&(diffsu2b == false)) {err432++;err433=err433+'You must answer Question #2 completely.\n';}

 if ((difftr2a == false)&&(difftr2b == false)) {err432++;err433=err433+'You must answer Question #3 completely.\n';}

 if (whysign2 == '') {err432++;err433=err433+'You cannot leave Question #4 blank.\n';}

 if ((continue2a == false)&&(continue2b == false)) {err432++;err433=err433+'You must answer Question #5 completely.\n';}

 if ((rectofrnd2a == false)&&(rectofrnd2b == false)) {err432++;err433=err433+'You must answer Question #6 completely.\n';}

 if ((rectofam2a == false)&&(rectofam2b == false)) {err432++;err433=err433+'You must answer Question #7 completely.\n';}

 if (experience2 == '') {err432++;err433=err433+'You cannot leave Question #8 blank.\n';}

 if ((rate2a == false)&&(rate2b == false)&&(rate2c == false)&&(rate2d == false)&&(rate2e == false)) {err432++;err433=err433+'You must answer Question #9 completely.\n';}

 if (addcomment2 == '') {err432++;err433=err433+'You cannot leave Question #10 blank.\n';}

  if (err432 > 0) {
  alert('Your post-review is not complete.\n\nPlease fix the following errors.\n\n'+err433);
  return false;
  }
  else {

   if (satisfied2 == true) {
   document.getElementById('hdv46').value='pass';
   iprbtn1++;
   postReviewSurveyForm.submit();
   }
   else {
   alert('You must review your answers completely\nand then check the "I\'m Satisfied" box.');
   }
  }
 }

}

function disablereviewformnow() {

//document.getElementById('satisfied3').disabled=true;
//document.getElementById('reviewsubmitbutton').disabled=true;

}

function enablereviewformnow() {

document.getElementById('reviewsubmitbutton').disabled=false;

}

function checkenabledbuttons() {

toscheckbox=document.getElementById('satisfied3').checked;
 if (toscheckbox==false) {disablereviewformnow();}
 else {enablereviewformnow();}

}

function disableformnow() {

document.getElementById('heard1a').checked=false;
document.getElementById('heard1a').disabled=true;

document.getElementById('heard1b').disabled=true;
document.getElementById('heard1b').checked=false;

document.getElementById('advertising1a').disabled=true;
document.getElementById('advertising1a').checked=false;

document.getElementById('advertising1b').disabled=true;
document.getElementById('advertising1b').checked=false;

document.getElementById('advertising1c').disabled=true;
document.getElementById('advertising1c').checked=false;

document.getElementById('advertising1d').disabled=true;
document.getElementById('advertising1d').checked=false;

document.getElementById('advertising1e').disabled=true;
document.getElementById('advertising1e').checked=false;

document.getElementById('advertising1f').disabled=true;
document.getElementById('advertising1f').checked=false;

document.getElementById('advertising1g').disabled=true;
document.getElementById('advertising1g').checked=false;

document.getElementById('recommend1a').disabled=true;
document.getElementById('recommend1a').checked=false;

document.getElementById('recommend1b').disabled=true;
document.getElementById('recommend1b').checked=false;

document.getElementById('utos1a').disabled=true;
document.getElementById('utos1a').checked=false;

document.getElementById('utos1b').disabled=true;
document.getElementById('utos1b').checked=false;

}

function enableformnow() {

document.getElementById('heard1a').checked=false;
document.getElementById('heard1a').disabled=false;

document.getElementById('heard1b').disabled=false;
document.getElementById('heard1b').checked=false;

document.getElementById('advertising1a').disabled=false;
document.getElementById('advertising1a').checked=false;

document.getElementById('advertising1b').disabled=false;
document.getElementById('advertising1b').checked=false;

document.getElementById('advertising1c').disabled=false;
document.getElementById('advertising1c').checked=false;

document.getElementById('advertising1d').disabled=false;
document.getElementById('advertising1d').checked=false;

document.getElementById('advertising1e').disabled=false;
document.getElementById('advertising1e').checked=false;

document.getElementById('advertising1f').disabled=false;
document.getElementById('advertising1f').checked=false;

document.getElementById('advertising1g').disabled=false;
document.getElementById('advertising1g').checked=false;

document.getElementById('recommend1a').disabled=false;
document.getElementById('recommend1a').checked=false;

document.getElementById('recommend1b').disabled=false;
document.getElementById('recommend1b').checked=false;

document.getElementById('utos1a').disabled=false;
document.getElementById('utos1a').checked=false;

document.getElementById('utos1b').disabled=false;
document.getElementById('utos1b').checked=false;

}

function takenbefore(p) {

 if (p=='y'){
 alert("You don't seem to be eligible for this offer.This\nreview is limited to first time users only.\n\nWe apologize for this, but encourage you\nto complete a different review.\n\nThank you for your understanding!");
 disableformnow();
 return false;
 }
 else {enableformnow();}

}

function reviewWin(k,e) {
fnew='_blank';
 if (e=='y') {fnew='_blank';}
rwin1=window.open ('r.cgi?i='+k,fnew,'resizable=1');
}

function surveylaunch(x) {
swin7=window.open (x,"swindow7");
}

function surveyWin(e,f) {
 if (f!='') {f2='?r='+f}
 else {f2='';}
swin1=window.open (e+'.pl'+f2,"swindow1","status=0,scrollbars=1,width=660,height=560,copyhistory=no,resizable=1");
}

function checkPreReviewSurvey() {

allchecks='n';
profilestring='';
err='';
errcnt=0;

k2=document.getElementById('hdv99').value;

prevex8=document.forms["preReviewSurveyForm"].elements["prevex1"];
x=0;
checkPass=0;
 while (x<prevex8.length) {
 bx=prevex8[x];
  if (bx.checked) {checkPass++;profilestring+=bx.value+'|';}
 x++;
 }
 if (checkPass==0) {err+='Question #1 - You cannot leave this question blank. Please choose an answer.\n';}

heard8=document.forms["preReviewSurveyForm"].elements["heard1"];
x=0;
checkPass=0;
 while (x<heard8.length) {
 bx=heard8[x];
  if (bx.checked) {checkPass++;profilestring+=bx.value+'|';}
 x++;
 }
 if (checkPass==0) {err+='Question #2 - You cannot leave this question blank. Please choose an answer.\n';}

advertising8=document.forms["preReviewSurveyForm"].elements["advertising1"];
x=0;
checkPass=0;
 while (x<advertising8.length) {
 bx=advertising8[x];
  if (bx.checked) {checkPass++;profilestring+=bx.value+'|';}
 x++;
 }
 if (checkPass==0) {err+='Question #3 - You cannot leave this question blank. Please choose an answer.\n';}

recommend8=document.forms["preReviewSurveyForm"].elements["recommend1"];
x=0;
checkPass=0;
 while (x<recommend8.length) {
 bx=recommend8[x];
  if (bx.checked) {checkPass++;profilestring+=bx.value+'|';}
 x++;
 }
 if (checkPass==0) {err+='Question #4 - You cannot leave this question blank. Please choose an answer.\n';}

utos8=document.forms["preReviewSurveyForm"].elements["utos1"];
x=0;
checkPass=0;
tosval='';
 while (x<utos8.length) {
 bx=utos8[x];
  if (bx.checked) {checkPass++;profilestring+=bx.value;tosval=bx.value;}
 x++;
 }
 if ((checkPass==0)||(tosval=='n')) {err+='Question #5 - Please read and understand the terms of this review.\n';}

 if (err == '') {
 rwin1=window.open ('r.cgi?i='+k2,'_blank','resizable=1');
 document.getElementById('hdv1').value = 'pass';
 document.getElementById('hdv4').value = profilestring;
 return true;
 }
 else {
 alert(err);
 return false;
 }

}

function checkProfileSurvey() {

allchecks='n';
profilestring='';
err='';
errcnt=0;

income8=document.forms["profileSurveyForm"].elements["income1"];
x=0;
checkPass=0;
 while (x<income8.length) {
 bx=income8[x];
  if (bx.checked) {checkPass++;profilestring+=bx.value+'|';}
 x++;
 }
 if (checkPass==0) {err+='Question #1 - You cannot leave this question blank. Please choose an answer.\n';}

income9=document.forms["profileSurveyForm"].elements["income2"];
x=0;
checkPass=0;
 while (x<income9.length) {
 bx=income9[x];
  if (bx.checked) {checkPass++;profilestring+=bx.value+'|';}
 x++;
 }
 if (checkPass==0) {err+='Question #2 - You cannot leave this question blank. Please choose an answer.\n';}

race8=document.forms["profileSurveyForm"].elements["race1"];
x=0;
checkPass=0;
 while (x<race8.length) {
 bx=race8[x];
  if (bx.checked) {checkPass++;profilestring+=bx.value+'|';}
 x++;
 }
 if (checkPass==0) {err+='Question #3 - You cannot leave this question blank. Please choose an answer.\n';}

eth8=document.forms["profileSurveyForm"].elements["eth1"];
x=0;
checkPass=0;
 while (x<eth8.length) {
 bx=eth8[x];
  if (bx.checked) {checkPass++;profilestring+=bx.value+'|';}
 x++;
 }
 if (checkPass==0) {err+='Question #4 - You cannot leave this question blank. Please choose an answer.\n';}

marry8=document.forms["profileSurveyForm"].elements["marry1"];
x=0;
checkPass=0;
 while (x<marry8.length) {
 bx=marry8[x];
  if (bx.checked) {checkPass++;profilestring+=bx.value+'|';}
 x++;
 }
 if (checkPass==0) {err+='Question #5 - You cannot leave this question blank. Please choose an answer.\n';}

house8=document.forms["profileSurveyForm"].elements["house1"];
x=0;
checkPass=0;
 while (x<house8.length) {
 bx=house8[x];
  if (bx.checked) {checkPass++;profilestring+=bx.value+'|';}
 x++;
 }
 if (checkPass==0) {err+='Question #6 - You cannot leave this question blank. Please choose an answer.\n';}

edu8=document.forms["profileSurveyForm"].elements["edu1"];
x=0;
checkPass=0;
 while (x<edu8.length) {
 bx=edu8[x];
  if (bx.checked) {checkPass++;profilestring+=bx.value+'|';}
 x++;
 }
 if (checkPass==0) {err+='Question #7 - You cannot leave this question blank. Please choose an answer.\n';}

employ8=document.forms["profileSurveyForm"].elements["employ1"];
x=0;
checkPass=0;
 while (x<employ8.length) {
 bx=employ8[x];
  if (bx.checked) {checkPass++;profilestring+=bx.value+'|';}
 x++;
 }
 if (checkPass==0) {err+='Question #8 - You cannot leave this question blank. Please choose an answer.\n';}

kids7=document.forms["profileSurveyForm"].elements["kids1"];
x=0;
checkPass=0;
 while (x<kids7.length) {
 bx=kids7[x];
  if (bx.checked) {checkPass++;profilestring+=bx.value+'|';}
 x++;
 }
 if (checkPass==0) {err+='Question #9 - You cannot leave this question blank. Please choose an answer.\n';}

kids8=document.forms["profileSurveyForm"].elements["kids2"];
x=0;
checkPass=0;
 while (x<kids8.length) {
 bx=kids8[x];
  if (bx.checked) {checkPass++;profilestring+=bx.value+'|';}
 x++;
 }
 if (checkPass==0) {err+='Question #10 - You cannot leave this question blank. Please choose an answer.\n';}

kids9=document.forms["profileSurveyForm"].elements["kids3"];
x=0;
checkPass=0;
 while (x<kids9.length) {
 bx=kids9[x];
  if (bx.checked) {checkPass++;profilestring+=bx.value+'|';}
 x++;
 }
 if (checkPass==0) {err+='Question #11 - You cannot leave this question blank. Please choose an answer.\n';}

brow8=document.forms["profileSurveyForm"].elements["brow1"];
x=0;
checkPass=0;
 while (x<brow8.length) {
 bx=brow8[x];
  if (bx.checked) {checkPass++;profilestring+=bx.value+'|';}
 x++;
 }
 if (checkPass==0) {err+='Question #12 - You cannot leave this question blank. Please choose an answer.\n';}

hearabout8=document.forms["profileSurveyForm"].elements["hearabout1"];
x=0;
checkPass=0;
 while (x<hearabout8.length) {
 bx=hearabout8[x];
  if (bx.checked) {checkPass++;profilestring+=bx.value+'|';}
 x++;
 }
 if (checkPass==0) {err+='Question #13 - You cannot leave this question blank. Please choose an answer.\n';}

armed8=document.forms["profileSurveyForm"].elements["armed1"];
x=0;
checkPass=0;
 while (x<armed8.length) {
 bx=armed8[x];
  if (bx.checked) {checkPass++;profilestring+=bx.value+'|';}
 x++;
 }
 if (checkPass==0) {err+='Question #14 - You cannot leave this question blank. Please choose an answer.\n';}

rest8=document.forms["profileSurveyForm"].elements["rest1"];
x=0;
checkPass=0;
 while (x<rest8.length) {
 bx=rest8[x];
  if (bx.checked) {checkPass++;profilestring+=bx.value+'|';}
 x++;
 }
 if (checkPass==0) {err+='Question #15 - You cannot leave this question blank. Please choose an answer.\n';}

alc8=document.forms["profileSurveyForm"].elements["alc1"];
x=0;
checkPass=0;
 while (x<alc8.length) {
 bx=alc8[x];
  if (bx.checked) {checkPass++;profilestring+=bx.value;}
 x++;
 }
 if (checkPass==0) {err+='Question #16 - You cannot leave this question blank. Please choose an answer.\n';}


/*
loc8=document.forms["profileSurveyForm"].elements["loc1"];
x=0;
checkPass=0;
 while (x<loc8.length) {
 bx=loc8[x];
  if (bx.checked) {
  checkPass++;
  //profilestring+=bx.value+'|';
  }
 x++;
 }
 if (checkPass==0) {err+='Question #17 - You cannot leave this question blank. Please choose an answer.\n';}

loc8a=document.getElementById('stateprovince').value;
 if (loc8a=='') {err+='Question #18 - Please tell us the city or town you live in.\n';}

loc8b=document.getElementById('city').value;
 if (loc8b=='') {err+='Question #19 - Please tell us the state or province you live in.\n';}

*/

pay8=document.forms["profileSurveyForm"].elements["pay1"];
pp=document.getElementById('paypalbox').value;
x=0;
checkPass=0;
paychoice='';
 while (x<pay8.length) {
 bx=pay8[x];
  if (bx.checked) {
  checkPass++;
   if (bx.value==1) {
   document.getElementById('paytypeinfo').value=pp;
   }
   else {
   document.getElementById('paytypeinfo').value='Check';
   }
  paychoice=bx.value;
  }
 x++;
 }
 if (checkPass==0) {err+='Question #17 - You cannot leave this question blank. Please choose an answer.\n';}
 else {
  if ((pp=='')&&(paychoice==1)) {err+='Question #17 - Please enter your PayPal address.\n';}
 }





 if (err != '') {alert(err);return false;}
 else {
 document.getElementById('submitbutton').disabled=true;
 document.getElementById('resetbutton').disabled=true;
 document.getElementById('hdv1').value = 'pass';
 document.getElementById('hdv4').value = profilestring;
 return true;
 }

}

function checkBuyForm() {

em983=document.getElementById('uemail68').value;
if (em983 != '') {return true;}
else {return false;}
}

function chkboxes() {
chkbxs=document.forms["chkform1"].elements.length;
i=0;
q='';
 while (i<chkbxs-5) {
 s=document.forms["chkform1"].elements[i];
  if (s.checked==true) {q+='t';}
  else {q+='f';}
  if (i!=chkbxs-6) {q+='|';}
 i++;
 }
document.getElementById('chkbxcnt').value=q;
document.getElementById('hdv5').value='pass';
}

function checkoffer(x) {
document.getElementById(x).checked=true;
}

function tacdoubleclick() {alert();
tosboxstate=document.getElementById('tos1').disabled;
 if (tosboxstate==true) {alert('Please read the terms and conditions first.');}
}

function winOpen() {
document.getElementById('tos1').disabled=false;
termsbox=1;
 if(newwin1 == null || newwin1.closed) {newwin1=window.open ("http://palmresearch.com/terms-and-conditions.html","mywindow1","status=0,scrollbars=1,width=250,height=250,copyhistory=no,resizable=1");}
 else {newwin1.focus();}
}

function winOpen2() {
 if(newwin2 == null || newwin2.closed) {newwin2=window.open ("emaillist.pl","mywindow2","status=0,scrollbars=1,width=325,height=195,copyhistory=no,resizable=1");}
 else {newwin2.focus();}
}

function winOpen3() {
 if(newwin3 == null || newwin3.closed) {newwin3=window.open ("checkbox.pl","mywindow3","status=0,scrollbars=1,width=325,height=195,copyhistory=no,resizable=1");}
 else {newwin3.focus();}
}

function winOpen55() {
 if(newwin4 == null || newwin4.closed) {newwin4=window.open ("paypal.html","mywindow4","status=0,scrollbars=1,width=250,height=250,copyhistory=no,resizable=1");}
 else {newwin4.focus();}
}

function surveyWinCount(x) {
 if (x=='npd') {sCount1=1}
 if (x=='synovate') {sCount2=1;}
 if (x=='nfo') {sCount3=1;}
}

function submitnewform() {
 if ((sCount1==1)&&(sCount2==1)&&(sCount3==1)) {
 document.getElementById('hdv3').value='pass';
 newform.submit();
 }
 else {alert('Please register with the 3 research\npanels first, then continue on. Thanks!');}
}

function validateEmail(str) {
return ((/^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6}$/).test(str))
}

function validateSentence(str2) {
return ((/[^A-Za-z0-9 .'?!,@$#\-_]/).test(str2));
}

function alphaCheck(x) {
alphaTest='no';
 if (x!='') {
 re = /[^a-z ]/ig;
  if (!re.test(x)) {alphaTest='yes';}
 }
return alphaTest;
}

function numCheck(x,n) {
numTest='no';
isVar22='no';
xl=x.length;
re = /[^0-9]/;
 if (xl==n) {isVar22 = 'yes';}
 if ((!re.test(x))&&(isVar22 == 'yes')) {numTest='yes';}
return numTest;
}

function alphaNumCheck(x,idVar) {
alphaNumTest='no';
re = /[^a-z0-9 \.]/ig;
 if ((idVar=='addr')||(idVar=='addr')) {re=/[^a-z0-9 ]/ig;}
 if(!re.test(x)){alphaNumTest='yes';}
return alphaNumTest;
}

function sendEmail() {
email=document.getElementById('email1').value;
test22=validateEmail(email);
 if (test22==true) {return true;}
 else {
  if (email=='') {
  alert('You must provide a valid email address to access our research panel list.');
  document.getElementById('email1').focus();
  }
  else {
  alert('Please use the format of "smith@domainaddress.com". Acceptable characters are A-Z 0-9 . - @ only.');
  document.getElementById('email1').value='';
  document.getElementById('email1').focus();
  }
 return false;
 }
}

function checkSignUpForm() {

surveyComplete=false;
errTxt='';
err=0;

fname=document.getElementById('fname1');
lname=document.getElementById('lname1');
month=document.getElementById('month1');
day=document.getElementById('day1');
year=document.getElementById('year1');
sex=document.getElementById('gender1');
userlocation=document.getElementById('location1');
mailadd=document.getElementById('mailingaddress1');
//street=document.getElementById('street1');
//city=document.getElementById('city1');
//state=document.getElementById('state1');
//zip=document.getElementById('zip1');
phone1=document.getElementById('ph1');
phone2=document.getElementById('ph2');
phone3=document.getElementById('ph3');
email=document.getElementById('email1');
emailconfirm=document.getElementById('email2');
passw=document.getElementById('pass1').value;
tos=document.getElementById('tos1');
iverify=document.getElementById('vi1');

textInfo="fname,lname";
textInfoPcs=textInfo.split(",");
x1=0;
 while (x1<textInfoPcs.length) {
 ax=textInfoPcs[x1];
 axLit=ax;
 ax=eval(ax);
 axVal=ax.value;
  if (axVal!='') {
  alphaCheck(axVal);
   if (alphaTest=='no') {
    err++;
    if (errTxt!='') {errTxt=errTxt+"\n- ";}
    else {errTxt='- ';}
    if (axLit=='fname') {errTxt=errTxt+'Your first name can only consist of letters.';}
    if (axLit=='lname') {errTxt=errTxt+'Your last name can only consist of letters.';}
   }
   if ((axLit=='state')&&(ax.value.length<2)) {
   err++;
    if (errTxt!='') {errTxt=errTxt+"\n- ";}
    else {errTxt='- ';}
   errTxt=errTxt+'The state must contain 2 letters.';
   }
  }
  else {
   err++;
   if (errTxt!='') {errTxt=errTxt+"\n- ";}
   else {errTxt='- ';}
   if (axLit=='fname') {errTxt=errTxt+'The first name field cannot be blank.';}
   if (axLit=='lname') {errTxt=errTxt+'The last name field cannot be blank.';}
  }
 x1++;
 }

 if (month.value==0) {
 err++;
  if (errTxt!='') {errTxt=errTxt+"\n- ";}
  else {errTxt='- ';}
 newErr2='You must select your birth month.';
 errTxt=errTxt+newErr2;
 }

 if (day.value==0) {
 err++;
  if (errTxt!='') {errTxt=errTxt+"\n- ";}
  else {errTxt='- ';}
 newErr2='You must select your birth day.';
 errTxt=errTxt+newErr2;
 }

 if (year.value==0) {
 err++;
  if (errTxt!='') {errTxt=errTxt+"\n- ";}
  else {errTxt='- ';}
 newErr2='You must select your birth year.';
 errTxt=errTxt+newErr2;
 }

 if (sex.value==0) {
 err++;
  if (errTxt!='') {errTxt=errTxt+"\n- ";}
  else {errTxt='- ';}
 newErr2='You must select your gender.';
 errTxt=errTxt+newErr2;
 }

 if (userlocation.value==0) {
 err++;
  if (errTxt!='') {errTxt=errTxt+"\n- ";}
  else {errTxt='- ';}
 errTxt=errTxt+'Please select your location.';
 }

 if (mailadd.value=='') {
 err++;
  if (errTxt!='') {errTxt=errTxt+"\n- ";}
  else {errTxt='- ';}
 errTxt=errTxt+'The mailing address field cannot be blank.';
 }

/*
 if (street.value=='') {
 err++;
  if (errTxt!='') {errTxt=errTxt+"\n- ";}
  else {errTxt='- ';}
 errTxt=errTxt+'The street address field cannot be blank.';
 }
  else {
  alphaNumCheck(street.value,'');
  if (alphaNumTest=='no') {
  err++;
  if (errTxt!='') {errTxt=errTxt+"\n- ";}
  else {errTxt='- ';}
  errTxt=errTxt+'Your street address is not formatted properly.';
  }
 }

textInfo="city,state";
textInfoPcs=textInfo.split(",");
x1=0;
 while (x1<textInfoPcs.length) {
 ax=textInfoPcs[x1];
 axLit=ax;
 ax=eval(ax);
 axVal=ax.value;
  if (axVal!='') {
  alphaCheck(axVal);
   if (alphaTest=='no') {
    err++;
    if (errTxt!='') {errTxt=errTxt+"\n- ";}
    else {errTxt='- ';}
    if (axLit=='city') {errTxt=errTxt+'The city can only consist of letters.';}
    if (axLit=='state') {
     if (ax.value.length<2) {errTxt=errTxt+'The state must contain 2 letters.';}
     else {errTxt=errTxt+'The state can only consist of letters.';}
    }
   }
   if ((axLit=='state')&&(ax.value.length<2)) {
  err++;
    if (errTxt!='') {errTxt=errTxt+"\n- ";}
    else {errTxt='- ';}
   errTxt=errTxt+'The state must contain 2 letters.';
   }
  }
  else {
   err++;
   if (errTxt!='') {errTxt=errTxt+"\n- ";}
   else {errTxt='- ';}
   if (axLit=='city') {errTxt=errTxt+'The city field cannot be blank.';}
   if (axLit=='state') {errTxt=errTxt+'The state field cannot be blank.';}
  }
 x1++;
 }

 if (zip.value=='') {
 err++;
   if (errTxt!='') {errTxt=errTxt+"\n- ";}
   else {errTxt='- ';}
  errTxt=errTxt+'The zip code field cannot be blank.';
 }
 else {
 thisZip=zip.value;
 numCheck(thisZip,5);
  if (numTest=='no') {
  err++;
   if (errTxt!='') {errTxt=errTxt+"\n- ";}
   else {errTxt='- ';}
  errTxt=errTxt+'The zip code must contain 5 numbers.';
  }
 }
*/

 phErr=0;
 if ((phone1.value=='')&&(phone2.value=='')&&(phone3.value=='')) {
  err++;
   if (errTxt!='') {errTxt=errTxt+"\n- ";}
   else {errTxt='- ';}
  errTxt=errTxt+'The phone number field cannot be blank.';
 }
 else {
 ph1=phone1.value;
 numCheck(ph1,3);
  if (numTest=='no') {phErr++;}
 ph2=phone2.value;
 numCheck(ph2,3);
  if (numTest=='no') {phErr++;}
 ph3=phone3.value;
 numCheck(ph3,4);
  if (numTest=='no') {phErr++;}
  if (phErr!=0) {
  err++;
   if (errTxt!='') {errTxt=errTxt+"\n- ";}
   else {errTxt='- ';}
  errTxt=errTxt+'The phone number field must contain 10 numbers.';
  }
 }

 emailMatch='no';
 isBlank='yes';
 emailArry='email,emailconfirm';
 emailArryPcs=emailArry.split(",");
 x5=0;
 while (x5<emailArryPcs.length) {
 emailPc=emailArryPcs[x5];
 xLit=emailPc;
 emailPc=eval(emailPc);
 newErr2='';
  if ((email.value!='')&&(emailconfirm.value!='')) {
 newVal2='';
 newEmailVal1=email.value.toLowerCase();
 newVal2='';
 newEmailVal2=emailconfirm.value.toLowerCase();
  isBlank='no';
   if (newEmailVal1==newEmailVal2) {
   emailMatch='yes';
   testEmail=validateEmail(emailPc.value);
    if ((x5==0)&&(testEmail==false)) {
    newErr2='Your email addresses are are not formatted correctly.';
    err++;
     if (errTxt!='') {errTxt=errTxt+"\n- ";}
     else {errTxt='- ';}
    errTxt=errTxt+newErr2;
    }
   }
  }
  else {
   if ((xLit=='email')&&(emailPc.value=='')) {
   err++;
    if (errTxt!='') {errTxt=errTxt+"\n- ";}
    else {errTxt='- ';}
   newErr2='The first email field cannot be blank.';
   errTxt=errTxt+newErr2;
   }
   if ((xLit=='emailconfirm')&&(emailPc.value=='')) {
   err++;
    if (errTxt!='') {errTxt=errTxt+"\n- ";}
    else {errTxt='- ';}
   newErr2='The confirmation email field cannot be blank.';
   errTxt=errTxt+newErr2;}
  }
 x5++;
 }
 if ((emailMatch=='no')&&(isBlank=='no')) {
 err++;
  if (errTxt!='') {errTxt=errTxt+"\n- ";}
  else {errTxt='- ';}
 errTxt=errTxt+'Your email addresses do not match.';
 }

 if ((passw=='')||(passw.length<5)) {
 err++;
  if (errTxt!='') {errTxt=errTxt+"\n- ";}
  else {errTxt='- ';}
 newErr2='Password must contain 5 characters.';
 errTxt=errTxt+newErr2;
 }

 if (tos.checked!=true) {
 err++;
  if (errTxt!='') {errTxt=errTxt+"\n- ";}
  else {errTxt='- ';}
 newErr2='The terms and conditions box is unchecked.';
 errTxt=errTxt+newErr2;
 }

 if (iverify.value=='') {
 err++;
   if (errTxt!='') {errTxt=errTxt+"\n- ";}
   else {errTxt='- ';}
  errTxt=errTxt+'The image verification field cannot be blank.';
 }
 else {
 thisImg=iverify.value;
 numCheck(thisImg,5);
  if (numTest=='no') {
  err++;
   if (errTxt!='') {errTxt=errTxt+"\n- ";}
   else {errTxt='- ';}
  errTxt=errTxt+'The image verification field must contain 5 numbers.';
  }
 }

 if (err!=0) {
  if (err>1) {rtxt='Reasons';}
  else {rtxt='Reason';}
 alert("We cannot accept your registration at this time.\n\n"+rtxt+":\n"+errTxt+"\n\nPlease correct, then submit again. Thank you!");
 return false;
 }
 else {
 newVal='';
 newVal2='';
 newVal2=fname.value.toLowerCase();
 val = newVal2.split(' ');
 for(var c=0; c < val.length; c++) {
 newVal += val[c].substring(0,1).toUpperCase() + val[c].substring(1,val[c].length);
        }
 document.getElementById('fname1').value = newVal;

 newVal='';
 newVal2='';
 newVal2=lname.value.toLowerCase();
 val = newVal2.split(' ');
 for(var c=0; c < val.length; c++) {
 newVal += val[c].substring(0,1).toUpperCase() + val[c].substring(1,val[c].length);
        }
 document.getElementById('lname1').value = newVal;

/*
 newVal='';
 newVal2='';
 newVal2=street.value.toLowerCase();
 val = newVal2.split(' ');
 for(var c=0; c < val.length; c++) {
  if (c==val.length-1) {spcAdd='';}
  else {spcAdd=' ';}
 newVal += val[c].substring(0,1).toUpperCase() + val[c].substring(1,val[c].length) + spcAdd;
       }
 document.getElementById('street1').value = newVal;

 newVal='';
 newVal2='';
 newVal2=city.value.toLowerCase();
 val = newVal2.split(' ');
 for(var c=0; c < val.length; c++) {
  if (c==val.length-1) {spcAdd='';}
  else {spcAdd=' ';}
 newVal += val[c].substring(0,1).toUpperCase() + val[c].substring(1,val[c].length) + spcAdd;
        }
 document.getElementById('city1').value = newVal;

 newVal='';
 newVal=state.value.toUpperCase();
 document.getElementById('state1').value = newVal;
*/

 document.getElementById('email1').value = newEmailVal1;
 document.getElementById('email2').value = newEmailVal2;

 document.getElementById('regresetbutton').disabled=true;
 document.getElementById('regsubmitbutton').disabled=true;

 document.getElementById('hdv1').value = 'pass';
 return true;
 }
}

function presubmitnewlocation(x) {
 if (x!=0) {
 document.getElementById('newlocationbtn').disabled=false;
 }
 else {
 document.getElementById('newlocationbtn').disabled=true;
 }
}

function submitnewlocation(m) {
tv=document.getElementById('location5').value;
tv1=document.getElementById('location5').selectedIndex;
tv2=document.getElementById('location5').options[tv1].text;

fx=confirm("Changing location to "+tv2+".\n\nPlease click OK to confirm.");

 if (fx==true) {
 document.getElementById('location5').disabled=true;
 document.getElementById('newlocationbtn').disabled=true;
 n=Math.floor(Math.random()*9999999);
 snlurl='c-loc.cgi?a='+currentmembernumber+'&b='+currentmemberkey+'&c='+tv+'&d='+m+'&e='+n;
 http.open('get',snlurl);
 http.onreadystatechange = NewLocationResponse;
 http.send(null);


 }


}

function NewLocationResponse() {
 if(http.readyState == 4){
 response = http.responseText;
  if (response==1) {
  alert('Your location has been updated!');
  location.href='members.pl';
  }
  if (response==0) {
  alert('There was an error processing your request. Please try again.');
 document.getElementById('location5').disabled=false;
  document.getElementById('newlocationbtn').disabled=false;
  }
 }
}
