function CheckPaperFields () {
 if (document.frmCoverSheet.PaperTitle.value.length < 1) {alert('Please complete the Paper Title field.'); return false;}
  else {if (document.frmCoverSheet.PaperAbstract.value.length < 1) {alert('Please complete the Paper Abstract field.  You may copy and paste ASCII text into the abstract field if your browser/operating system allows.'); return false;}
   else {if (document.frmCoverSheet.ReviewTopic1.selectedIndex < 1) {alert('Please complete the Review Topic first choice.'); return false;}
    else {if ((document.frmCoverSheet.ReviewTopic1.options[document.frmCoverSheet.ReviewTopic1.selectedIndex].value%100==0) && (document.frmCoverSheet.ReviewTopic1.selectedIndex!=0)) {alert('You cannot choose a major category. Please choose a sub-category for your Primary Topic.'); return false;}
//     else {if ((document.frmCoverSheet.ReviewTopic2.options[document.frmCoverSheet.ReviewTopic2.selectedIndex].value%100==0) && (document.frmCoverSheet.ReviewTopic2.selectedIndex!=0)) {alert('You cannot choose a major category. Please choose a sub-category for your Secondary Topic.'); return false;}
      else {if (document.frmCoverSheet.NewNameLast.value.length > 0) {alert('If you intend on adding an author, please click the button labelled ADD above before continuing paper submission.  Otherwise, clear the new author information fields.'); return false;}
       else {return true;};
	  }
	 }
//	}
   }
  }
}

function CheckAuthorFields ()
{ if (document.frmCoverSheet.NewNameFirst.value.length < 1) {alert('Please complete the author first name.'); return false;}
  else {if (document.frmCoverSheet.NewNameLast.value.length < 1) {alert('Please complete the author last name.'); return false;}
    else {if (document.frmCoverSheet.NewAffiliation.value.length < 1) {alert('Please complete the author affiliation.'); return false;}
      else {if (document.frmCoverSheet.NewAddressStreet1.value.length < 1) {alert('Please complete the author street address.'); return false;}
        else {if (document.frmCoverSheet.NewAddressCity.value.length < 1) {alert('Please complete the author city address.'); return false;}
          else {if (document.frmCoverSheet.NewAddressZip.value.length < 1) {alert('Please complete the author postal code.'); return false;}
            else {if (document.frmCoverSheet.NewAddressCountry.selectedIndex < 1) {alert('Please complete the author address country.'); return false;}
              else {if (document.frmCoverSheet.NewEmail.value.length < 1) {alert('Please complete the author email address.'); return false;}
                else {if (document.frmCoverSheet.NewEmailCheck.value.length < 1) {alert('Please complete the author email address check field (second email field).'); return false;}
                  else {if (document.frmCoverSheet.NewEmailCheck.value != document.frmCoverSheet.NewEmail.value) {alert('The email addresses you entered do not match. Please make sure you entered the same email address in both fields.'); return false;}
                    else {return true;};
					   }
				     }
  				   }
			     }
			   }
		     }
		   }
	     }
	   }
}

function CheckUploadFields ()
{ if (!((document.frmFileUpload.File.value.slice(document.frmFileUpload.File.value.length - 3) == '.ps') || (document.frmFileUpload.File.value.slice(document.frmFileUpload.File.value.length - 3) == '.PS') || (document.frmFileUpload.File.value.slice(document.frmFileUpload.File.value.length - 4) == '.pdf') || (document.frmFileUpload.File.value.slice(document.frmFileUpload.File.value.length - 4) == '.PDF') || (document.frmFileUpload.File.value.slice(document.frmFileUpload.File.value.length - 4) == '.zip') || (document.frmFileUpload.File.value.slice(document.frmFileUpload.File.value.length - 4) == '.ZIP') || (document.frmFileUpload.File.value.slice(document.frmFileUpload.File.value.length - 3) == '.gz') || (document.frmFileUpload.File.value.slice(document.frmFileUpload.File.value.length - 3) == '.GZ')  )) {alert("Please submit a PostScript or PDF file or a PKWare PKZIP compatible compressed PostScript or PDF file as specified in the paper kit.  Your filename may end with '.ps', '.pdf', '.zip', or '.gz'."); return false;}
    else {return true;};
}

function CheckReviewerFields ()
{ document.frmReviewerApp.Categories.value = '';
  for (var i = 0; i < document.frmReviewerApp.PaperCat1.options.length; i++)
  {  if (document.frmReviewerApp.PaperCat1.options[i].selected) {document.frmReviewerApp.Categories.value = document.frmReviewerApp.Categories.value + '1.' + document.frmReviewerApp.PaperCat1.options[i].value + ':';}
  }
  for (var i = 0; i < document.frmReviewerApp.PaperCat2.options.length; i++)
  {  if (document.frmReviewerApp.PaperCat2.options[i].selected) {document.frmReviewerApp.Categories.value = document.frmReviewerApp.Categories.value + '2.' + document.frmReviewerApp.PaperCat2.options[i].value + ':';}
  }
  for (var i = 0; i < document.frmReviewerApp.PaperCat3.options.length; i++)
  {  if (document.frmReviewerApp.PaperCat3.options[i].selected) {document.frmReviewerApp.Categories.value = document.frmReviewerApp.Categories.value + '3.' + document.frmReviewerApp.PaperCat3.options[i].value + ':';}
  }
  for (var i = 0; i < document.frmReviewerApp.PaperCat4.options.length; i++)
  {  if (document.frmReviewerApp.PaperCat4.options[i].selected) {document.frmReviewerApp.Categories.value = document.frmReviewerApp.Categories.value + '4.' + document.frmReviewerApp.PaperCat4.options[i].value + ':';}
  }
  for (var i = 0; i < document.frmReviewerApp.PaperCat5.options.length; i++)
  {  if (document.frmReviewerApp.PaperCat5.options[i].selected) {document.frmReviewerApp.Categories.value = document.frmReviewerApp.Categories.value + '5.' + document.frmReviewerApp.PaperCat5.options[i].value + ':';}
  }
  for (var i = 0; i < document.frmReviewerApp.PaperCat6.options.length; i++)
  {  if (document.frmReviewerApp.PaperCat6.options[i].selected) {document.frmReviewerApp.Categories.value = document.frmReviewerApp.Categories.value + '6.' + document.frmReviewerApp.PaperCat6.options[i].value + ':';}
  }
  
  if (document.frmReviewerApp.Categories.value.length < 1) {alert('Please choose the categories that you would like to review in before submitting.'); return false;}  
  else {if (document.frmReviewerApp.NameFirst.value.length < 1) {alert('Please complete the reviewer first name before submitting.'); return false;}
    else {if (document.frmReviewerApp.NameLast.value.length < 1) {alert('Please complete the reviewer last name before submitting.'); return false;}
      else {if (document.frmReviewerApp.AddressStreet1.value.length < 1) {alert('Please complete the street address before submitting.'); return false;}
        else {if (document.frmReviewerApp.AddressCity.value.length < 1) {alert('Please complete the city address before submitting.'); return false;}
          else {if (document.frmReviewerApp.AddressZip.value.length < 1) {alert('Please complete the postal code before submitting.'); return false;}
            else {if (document.frmReviewerApp.AddressCountry.value.length < 1) {alert('Please complete the address country before submitting.'); return false;}
              else {return true;};
				 }
			   }
			 }
		   }
		 }
	   }
}

function CheckPassword ()
{ if (document.frmPassword.Email.value.length < 1) {alert('Please provide an email address that we can use to contact you.'); return false;}
  else {if (document.frmPassword.Password1.value.length < 6) {alert('Passwords must be at least 6 characters long.  Please re-enter a password of at least 6 alphanumeric characters'); return false;}
    else {if (document.frmPassword.Password1.value == document.frmPassword.Password2.value) {return true} else {alert('The passwords that you entered are not identical.  Please re-enter them and try submitting again.'); return false;}
	     }
	   }
}
