
<!--
// function validates required form fields
// makes sure none are blank and that email is valid
var doc=document,sById=(doc.getElementById)?true:false;
function validateFeedbackForm(fform){
  if(!fform){if(sById)fform=doc.getElementById('feedbackForm');else fform=document.feedbackForm;}
  if(sById){var sender=doc.getElementById('netform_sender'),subject=doc.getElementById('netform_subject'),registration=doc.getElementById('registration'),fbody=doc.getElementById('netform_body');}
  else{var sender=fform.netform_sender,subject=fform.netform_subject,registration=fform.registration,fbody=fform.netform_body;}
  // check that required fields are not blank
  var sender_val=sender.value,subject_val=subject.options[subject.selectedIndex].value,reg_val=registration.value,fbody_val=fbody.value;
  var missing=[];
  if(!sender_val)missing.push('e-mail address');
  if(!subject_val)missing.push('feedback subject');
  if(subject_val=='Boston.com Registration'&&!reg_val)missing.push('registration subject');
  if(!fbody_val)missing.push('comments');
  if(missing.length){
    // missing fields
    var mlen=missing.length;
    if(mlen==2)missing=missing.join(' and ');
    else{
      if(mlen>2)missing[mlen-1]='and '+missing[mlen-1];
      missing=missing.join(', ');
    }
    alert('Please complete all required information.\nMissing: '+missing);
    return false;
  }
  var sender_val_at=sender_val.indexOf('@');
  if(sender_val.indexOf(' ')!=-1||sender_val_at<1||(sender_val_at+1)>=sender_val.length){
    // bad e-mail
    alert('Invalid e-mail address entered.');
    return false;
  }
  return true;
}
function resetFeedbackForm(){
  if(sById)var fform=doc.getElementById('feedbackForm');else var fform=document.feedbackForm;
  fform.reset();
}
function submitFeedbackForm(){
  if(sById)var fform=doc.getElementById('feedbackForm');else var fform=document.feedbackForm;
  var dosubmit=validateFeedbackForm(fform);
  if(!dosubmit)return false;
  // fill in browser and screen information
  if(sById){var subject=doc.getElementById('netform_subject'),registration=doc.getElementById('registration'),uagent=doc.getElementById('user_agent'),swidth=doc.getElementById('screen_width'),sheight=doc.getElementById('screen_height'),cenabled=doc.getElementById('cookies_enabled');}
  else{var subject=fform.netform_subject,registration=fform.registration,uagent=fform['Browser/Platform:'],swidth=fform['Screen width:'],sheight=fform['Screen height:'],cenabled=fform['Cookies enabled:'];}
  uagent.value = navigator.userAgent;
  swidth.value = screen.width;
  sheight.value = screen.height;
  cenabled.value = navigator.cookieEnabled;
  var subject_val=subject.options[subject.selectedIndex].value;
  if(subject_val=='Boston.com Registration'){
    subject.options[subject.selectedIndex].value=subject_val+' -- '+registration.options[registration.selectedIndex].value;
    if(sById){var regwrapper=doc.getElementById('registration_wrapper');regwrapper.removeChild(registration);}
  }
  fform.submit();
}
function changeFeedbackSubject(subject){
  var subject_val=subject.options[subject.selectedIndex].value,regwrapper,regdisplay='block';
  if(subject_val!='Boston.com Registration')regdisplay='none';
  if(sById)regwrapper=doc.getElementById('registration_wrapper');
  else regwrapper=document.feedbackForm['registration_wrapper'];
  regwrapper.style.display=regdisplay;
}
//-->


