function validData () {
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	var errorHTML = "";
	var errorList = new Array();
	var errorN = 0;
	var dataAttest = 0;
	var analysisAttest = 0;
	var archivalAttest = 0;
	var archivalAuthors = "";
	if ($('title').value === "")
		{
		errorList.push("manuscript title");
		errorN++;
		$("title").style.border="2px solid #FF0000";
		}
	else $("title").style.border="1px solid #000066";

	if ($('short_title').value === "")
		{
		errorList.push("short title");
		errorN++;
		$("short_title").style.border="2px solid #FF0000";
		}
	else $("short_title").style.border="1px solid #000066";
	
	if ($('institution').value === "")
		{
		errorList.push("institution");
		errorN++;
		$("institution").style.border="2px solid #FF0000";
		}
	else $("institution").style.border="1px solid #000066";

	if ($('funding').value === "")
		{
		errorList.push("funding information");
		errorN++;
		$("funding").style.border="2px solid #FF0000";
		}
	else $("funding").style.border="1px solid #000066";
		
	// Manuscript Type
	if (!($('Research_ReportCheckBox').checked ||
		$('Case_ReportCheckBox').checked ||
		$('Echo_RoundsCheckBox').checked ||
		$('Brief_ReportCheckBox').checked ||
		$('Technical_CommunicationCheckBox').checked ||
		$('ReviewCheckBox').checked ||
		$('Medical_IntelligenceCheckBox').checked ||
		$('Special_ArticleCheckBox').checked ||
		$('Pro/Con/Core_ReviewCheckBox').checked ||
		$('Book_or_Multimedia_ReviewCheckBox').checked ||
		$('Meeting_ReportCheckBox').checked ||
		$('Focused_ReviewCheckBox').checked ||
		$('CommentaryCheckBox').checked ||
		$('Letter_to_the_EditorCheckBox').checked ||
		$('EditorialCheckBox').checked ||
		$('The_Open_MindCheckBox').checked)) {
			errorList.push("manuscript type");
			errorN++;
		$("MSTypeHeader").style.color="#FF0000";
		}
	else $("MSTypeHeader").style.color="";

	// Consent for Letters, Case Reports, and Echo Rounds
	var VAL0 = 	($('Case_ReportCheckBox').checked +
				$('Echo_RoundsCheckBox').checked +
				$('Letter_to_the_EditorCheckBox').checked +
				$('ConsentNecessaryRadioYes').checked * 10 +
				$('ConsentNecessaryRadioNo').checked*100);
	switch(VAL0)
	{
	case 0:
	case 10:
	case 100:
	case 101:
		$("Consent1Div").style.color="";
		break;
	case 1:
		errorList.push("consent question 1");
		errorN++;
		$("Consent1Div").style.color="#FF0000";
		break;	
	case 11:	
		$("Consent1Div").style.color="";
		var VAL = ($("ConsentTypeRadioPatient").checked +
		$("ConsentTypeRadioFamily").checked * 10 +
		$("ConsentTypeRadioIRB").checked * 100);
		switch (VAL) {
			case 0:
				errorList.push("consent question 1a");
				errorN++;
				$("ConsentTypeDiv").style.color="#FF0000";
				break;
		
			case 1:
				$("ConsentTypeDiv").style.color="";
				var VAL1 = ($("PatientConsentIncludedRadioYes").checked +
				$("PatientConsentIncludedRadioNo").checked * 10);
				switch (VAL1) {
					case 0:
						errorList.push("consent question 1b");
						errorN++;
						$("PatientConsentsDiv").style.color="#FF0000";
						break;
					case 1:
						$("PatientConsentsDiv").style.color="";
						break;
					case 10:
						errorList.push("patient consent not included in submission");
						errorN++;
						$("PatientConsentsDiv").style.color="#FF0000";
						break;
				}
				break;
				
			case 10:
				$("ConsentTypeDiv").style.color="";
				var VAL1 = ($("FamilyConsentIncludedRadioYes").checked +
				$("FamilyConsentIncludedRadioNo").checked * 10);
				switch (VAL1) {
					case 0:
						errorList.push("consent question 1b");
						errorN++;
						$("FamilyConsentsDiv").style.color="#FF0000";
						break;
					case 1:
						$("FamilyConsentsDiv").style.color="";
						break;
					case 10:
						errorList.push("consent from family not mentioned in submission");
						errorN++;
						$("FamilyConsentsDiv").style.color="#FF0000";
						break;
				}
				break;
				
			case 100:
				$("ConsentTypeDiv").style.color="";
				var VAL1 = ($("IRBConsentIncludedRadioYes").checked +
				$("IRBConsentIncludedRadioNo").checked * 10);
				switch (VAL1) {
					case 0:
						errorList.push("consent question 1b");
						errorN++;
						$("IRBConsentsDiv").style.color="#FF0000";
						break;
					case 1:
						$("IRBConsentsDiv").style.color="";
						break;
					case 10:
						errorList.push("consent from IRB not mentioned in submission");
						errorN++;
						$("IRBConsentsDiv").style.color="#FF0000";
						break;
				}
				break;
		}
	}				

	// Case Report Questions
	if ($('Case_ReportCheckBox').checked) {
	
		// Truly Exceptional
		var VAL = ($("TrulyExceptionalRadioYes").checked +
		$("TrulyExceptionalRadioNo").checked * 10);
		switch (VAL) {
			case 0:
				errorList.push("case report question 2");
				errorN++;
				$("TrulyExceptionalDiv").style.color="#FF0000";
				break;
			case 1:
			case 10:
				$("TrulyExceptionalDiv").style.color="";
				break;
		}
		
		// Claim Efficacy
		var VAL = ($("ClaimEfficacyRadioYes").checked +
		$("ClaimEfficacyRadioNo").checked * 10);
		switch (VAL) {
			case 0:
				errorList.push("case report question 3");
				errorN++;
				$("ClaimEfficacyDiv").style.color="#FF0000";
				break;
			case 1:
			case 10:
				$("ClaimEfficacyDiv").style.color="";
				break;
		}
	}

	// Research Report / Brief Report Questions
	if ($('Research_ReportCheckBox').checked ||
	$('Brief_ReportCheckBox').checked) {
		var SubErrorList = new Array();
		var SubErrorN = 0;
		// Prospective Clinical Trial
		var VAL = ($("ProspectiveRadioYes").checked +
				  $("ProspectiveRadioNo").checked * 10);
		switch (VAL) {
			case 0:
				SubErrorList.push("1");
				SubErrorN++;
				$("ProspectiveDiv").style.color="#FF0000";
				break;
			case 1:
				$("ProspectiveDiv").style.color="";
				break;
			case 10:
				$("ProspectiveDiv").style.color="";
				$("ConsortIncludedRadioYes").checked=false;
				$("ConsortIncludedRadioNo").checked=false;
				break;
		}

		// CONSORT Statement Included
		var VAL = ($("ConsortIncludedRadioYes").checked +
				  $("ConsortIncludedRadioNo").checked * 10 +
				  $("ProspectiveRadioYes").checked * 100);
		switch (VAL) {
			case 0:
			case 10:
			case 101:
			case 110:
				$("ConsortDiv").style.color="";
				break;
			case 100:
				SubErrorList.push("1a");
				SubErrorN++;
				$("ConsortDiv").style.color="#FF0000";
				break;
		}
		
		// Observational Clinical Trial
		var VAL = ($("ObservationalRadioYes").checked +
				  $("ObservationalRadioNo").checked * 10);
		switch (VAL) {
			case 0:
				SubErrorList.push("2");
				SubErrorN++;
				$("ObservationalDiv").style.color="#FF0000";
				break;
			case 1:
				$("ObservationalDiv").style.color="";
				break;
			case 10:
				$("ObservationalDiv").style.color="";
				$("Observational1RadioYes").checked=false;
				$("Observational1RadioNo").checked=false;
				$("Observational2RadioYes").checked=false;
				$("Observational2RadioNo").checked=false;
				$("Observational3RadioYes").checked=false;
				$("Observational3RadioNo").checked=false;
				$("Observational4RadioYes").checked=false;
				$("Observational4RadioNo").checked=false;
				$("Observational5RadioYes").checked=false;
				$("Observational5RadioNo").checked=false;
				$("Observational6RadioYes").checked=false;
				$("Observational6RadioNo").checked=false;
				$("Observational7RadioYes").checked=false;
				$("Observational7RadioNo").checked=false;
				$("Observational8RadioYes").checked=false;
				$("Observational8RadioNo").checked=false;
				break;
		}

		if ($('ObservationalRadioYes').checked) {
			// Large Observational Trial
			var VAL = ($("Observational1RadioYes").checked +
			$("Observational1RadioNo").checked * 10);
			switch (VAL) {
				case 0:
					SubErrorList.push("2a");
					SubErrorN++;
					$("Observational2aDiv").style.color="#FF0000";
					break;
				case 1:
					$("Observational2aDiv").style.color="";
					break;
				case 10:
					$("Observational2aDiv").style.color="";
					$("Observational2RadioYes").checked=false;
					$("Observational2RadioNo").checked=false;
					break;
			}

			// Large Observational Confidence IntervalsTrial
			var VAL = ($("Observational2RadioYes").checked +
			$("Observational2RadioNo").checked * 10 +
			$("Observational1RadioYes").checked * 100);
			switch (VAL) {
				case 100:
					SubErrorList.push("2a1");
					SubErrorN++;
					$("Observational2a1Div").style.color="#FF0000";
					break;
				default:
					$("Observational2a1Div").style.color="";
					break;
			}
			
			// Cohort Observational Trial
			var VAL = ($("Observational3RadioYes").checked +
			$("Observational3RadioNo").checked * 10);
			switch (VAL) {
				case 0:
					SubErrorList.push("2b");
					SubErrorN++;
					$("Observational2bDiv").style.color="#FF0000";
					break;
				case 1:
					$("Observational2bDiv").style.color="";
					break;
				case 10:
					$("Observational2bDiv").style.color="";
					$("Observational4RadioYes").checked=false;
					$("Observational4RadioNo").checked=false;
					break;
			}
			
			// Cohort STROBE Checklist
			var VAL = ($("Observational4RadioYes").checked +
			$("Observational4RadioNo").checked * 10 +
			$("Observational3RadioYes").checked * 100);
			switch (VAL) {
				case 100:
					SubErrorList.push("2b1");
					SubErrorN++;
					$("Observational2b1Div").style.color="#FF0000";
					break;
				default:
					$("Observational2b1Div").style.color="";
					break;
			}
			
			
			// Case Control Observational Trial
			var VAL = ($("Observational5RadioYes").checked +
			$("Observational5RadioNo").checked * 10);
			switch (VAL) {
				case 0:
					SubErrorList.push("2c");
					SubErrorN++;
					$("Observational2cDiv").style.color="#FF0000";
					break;
				case 1:
					$("Observational2cDiv").style.color="";
					break;
				case 10:
					$("Observational2cDiv").style.color="";
					$("Observational6RadioYes").checked=false;
					$("Observational6RadioNo").checked=false;
					break;
			}
			
			// Cohort STROBE Checklist
			var VAL = ($("Observational6RadioYes").checked +
			$("Observational6RadioNo").checked * 10 +
			$("Observational5RadioYes").checked * 100);
			switch (VAL) {
				case 100:
					SubErrorList.push("2c1");
					SubErrorN++;
					$("Observational2c1Div").style.color="#FF0000";
				break;
				default:
					$("Observational2c1Div").style.color="";
					break;
			}
			
			// Cross Sectional Observational Trial
			var VAL = ($("Observational7RadioYes").checked +
			$("Observational7RadioNo").checked * 10);
			switch (VAL) {
				case 0:
					SubErrorList.push("2d");
					SubErrorN++;
					$("Observational2dDiv").style.color="#FF0000";
					break;
				case 1:
					$("Observational2dDiv").style.color="";
					break;
				case 10:
					$("Observational8RadioYes").checked=false;
					$("Observational8RadioNo").checked=false;
					$("Observational2dDiv").style.color="";
					break;
			}
			
			// Cohort STROBE Checklist
			var VAL = ($("Observational8RadioYes").checked +
			$("Observational8RadioNo").checked * 10 +
			$("Observational7RadioYes").checked * 100);
			switch (VAL) {
				case 100:
					SubErrorList.push("2d1");
					SubErrorN++;
					$("Observational2d1Div").style.color="#FF0000";
					break;
				default:
					$("Observational2d1Div").style.color="";
					break;
			}
		}

		// Meta Regression
		var VAL = ($("MetaRegressionRadioYes").checked +
		$("MetaRegressionRadioNo").checked * 10);
		switch (VAL) {
			case 0:
				SubErrorList.push("3");
				SubErrorN++;
				$("MetaRegression1Div").style.color="#FF0000";
				break;
			case 1:
				$("MetaRegression1Div").style.color="";
				break;
			case 10:
				$("MetaRegression1Div").style.color="";
				break;
		}

		// Meta Regression
		var VAL = ($("MetaRegression1RadioYes").checked +
		$("MetaRegression1RadioNo").checked * 10 +
		$("MetaRegressionRadioYes").checked * 100);
		switch (VAL) {
			case 100:
				SubErrorList.push("3a");
				SubErrorN++;
				$("MetaRegression2Div").style.color="#FF0000";
				break;
			default:
				$("MetaRegression2Div").style.color="";
				break;
		}

		// Meta Analysis
		var VAL = ($("MetaAnalysisRadioYes").checked +
		$("MetaAnalysisRadioNo").checked * 10);
		switch (VAL) {
			case 0:
				SubErrorList.push("4");
				SubErrorN++;
				$("MetaAnalysisDiv").style.color="#FF0000";
				break;
			case 1:
				$("MetaAnalysisDiv").style.color="";
				break;
			case 10:
				$("MetaAnalysisDiv").style.color="";
				break;
		}

		// Cost Analysis
		var VAL = ($("CostRadioYes").checked +
		$("CostRadioNo").checked * 10);
		switch (VAL) {
			case 0:
				SubErrorList.push("5");
				SubErrorN++;
				$("CostDiv").style.color="#FF0000";
				break;
			case 1:
				$("CostDiv").style.color="";
				break;
			case 10:
				$("CostDiv").style.color="";
				break;
		}

		// Propensity Analysis
		var VAL = ($("PropensityRadioYes").checked +
		$("PropensityRadioNo").checked * 10);
		switch (VAL) {
			case 0:
				SubErrorList.push("6");
				SubErrorN++;
				$("PropensityDiv").style.color="#FF0000";
				break;
			case 1:
				$("PropensityDiv").style.color="";
				break;
			case 10:
				$("PropensityDiv").style.color="";
				break;
		}

		// Negative Paper
		var VAL = ($("NegativeRadioYes").checked +
		$("NegativeRadioNo").checked * 10);
		switch (VAL) {
			case 0:
				SubErrorList.push("7");
				SubErrorN++;
				$("NegativeDiv").style.color="#FF0000";
				break;
			case 1:
				$("NegativeDiv").style.color="";
				break;
			case 10:
				$("NegativeDiv").style.color="";
				break;
		}

		// Mixed Effect Paper
		var VAL = ($("MixedEffectsRadioYes").checked +
		$("MixedEffectsRadioNo").checked * 10);
		switch (VAL) {
			case 0:
				SubErrorList.push("8");
				SubErrorN++;
				$("MixedEffectsDiv").style.color="#FF0000";
				break;
			case 1:
				$("MixedEffectsDiv").style.color="";
				break;
			case 10:
				$("MixedEffectsDiv").style.color="";
				break;
		}
	if (SubErrorN > 0) {
		if (SubErrorN == 1) TempText = "statistical question ";
		else TempText = "statistical questions: "
		SubErrorList[0]=TempText+SubErrorList[0];
		for (var i = 0; i < SubErrorN; i++) {
			errorList.push(SubErrorList[i]);
			}
		errorN += SubErrorN;
		}
	}
	
	// Manuscript Number
	var VAL = ($("MSNumberRadioYes").checked +
			  $("MSNumberRadioNo").checked  * 10);
	switch (VAL) {
		case 0:
			errorList.push("does the manuscript already have a number (yes/no)");
			errorN++;
			$("MSNumberQuestionDiv").style.color="#FF0000";
			break;
		case 1:
			$("MSNumberQuestionDiv").style.color="";
			if ($('MSNumberText').value === "") {
				errorList.push("manuscript number");
				errorN++;
				$("MSNumberText").style.border="2px solid #FF0000";
			}
			else $("MSNumberText").style.border="1px solid #000066";
			break;
		case 10:
			$('MSNumberText').value = "";
			$("MSNumberText").style.border="1px solid #000066";
			$("MSNumberQuestionDiv").style.color="";
			break;
	}
	
	// Section Editor
	var VAL = ($("EditorRadioYes").checked +
			  $("EditorRadioNo").checked  * 10);
	switch (VAL) {
		case 0:
			errorList.push("was the paper solicited by a Section Editor (yes/no)");
			errorN++;
			$("EditorQuestionDiv").style.color="#FF0000";
			break;
			
		case 1:
			$("EditorQuestionDiv").style.color="";
			if ($('EditorText').value === "") {
				errorList.push("soliciting Section Editor");
				errorN++;
				$("EditorText").style.border="2px solid #FF0000";
			}
			else $("EditorText").style.border="1px solid #000066";
			break;
		case 10:
			$('EditorText').value = "";
			$("EditorText").style.border="1px solid #000066";
			$("EditorQuestionDiv").style.color="";
			break;
	}

	// Presented at Meeting
	var VAL = ($("MeetingRadioYes").checked +
			  $("MeetingRadioNo").checked  * 10);
	switch (VAL) {
		case 0:
			errorList.push("has this paper been presented at a meeting (yes/no)");
			errorN++;
			$("MeetingQuestionDiv").style.color="#FF0000";
			break;
			
		case 1:
			$("MeetingQuestionDiv").style.color="";
			if ($('MeetingText').value === "") {
				errorList.push("name of the meeting(s) where this was presented");
				errorN++;
				$("MeetingText").style.border="2px solid #FF0000";
			}
			else $("MeetingText").style.border="1px solid #000066";
			var VAL = ($("NewsRadioYes").checked +
					  $("NewsRadioNo").checked  * 10);
			switch (VAL) {
				case 0:
					errorList.push("was the presentation also reported in the press (yes/no)");
					errorN++;
					$("NewsQuestionDiv").style.color="#FF0000";
					break;
				case 1:
					$("NewsQuestionDiv").style.color="";
					if ($('NewsText').value === "") {
						errorList.push("name of the news media that reported on the presentation");
						errorN++;
						$("NewsText").style.border="2px solid #FF0000";
					}
					else $("NewsText").style.border="1px solid #000066";
					break;
				case 10:
					$('NewsText').value = "";
					$("NewsText").style.border="1px solid #000066";
					$("NewsQuestionDiv").style.color="";
					break;
					}
			break;
		case 10:
			$('MeetingText').value = "";
			$("MeetingText").style.border="1px solid #000066";
			$("MeetingQuestionDiv").style.color="";
			break;
	}

	// NIH
	if ($('NIHCheckBox').checked)
		{
		if ($('NIHText').value === "") 
			{
			errorList.push("NIH Grant Number");
			errorN++;
			$("NIHText").style.border="2px solid #FF0000";
			}
		else $("NIHText").style.border="1px solid #000066";
		}
	else 
		{
		$('NIHText').value = "";
		$("NIHText").style.border="1px solid #000066";
		}
		
	// HHMI
	if ($('HHMICheckBox').checked) 
		{
		if ($('HHMIText').value === "") 
			{
			errorList.push("HHMI Grant Number");
			errorN++;
			$("HHMIText").style.border="2px solid #FF0000";
			}
		else $("HHMIText").style.border="1px solid #000066";
		}
	else 
		{
		$('HHMIText').value = "";
		$("HHMIText").style.border="1px solid #000066";
		}
		
	// MRC
	if ($('MRCCheckBox').checked) 
		{
		if ($('MRCText').value === "") 
			{
			errorList.push("MRC Grant Number");
			errorN++;
			$("MRCText").style.border="2px solid #FF0000";
			}
		else $("MRCText").style.border="1px solid #000066";
		}
	else 
		{
		$("MRCText").style.border="1px solid #000066";
		$('MRCText').value = "";
		}
		
	// WT
	if ($('WTCheckBox').checked) 
		{
		if ($('WTText').value === "") 
			{
			errorList.push("Wellcome Trust Grant Number");
			errorN++;
			$("WTText").style.border="2px solid #FF0000";
			}
		else $("WTText").style.border="1px solid #000066";
		}
	else 
		{
		$("WTText").style.border="1px solid #000066";
		$('WTText').value = "";
		}
		
	//check individual Authors (blank fields, Corresponding fields, valid email address, Authorship role, conflicts of interest)
		for (var i = 0; i < nextIndex; i++) {
			//blank fields
			$("Authors_Author_name_"+i).style.color=""
			Authorname=$("Author_" + i + "_name").value;
			if (Authorname === "") {
				Authorname = "Author " + (i + 1);
				errorList.push("name for "+Authorname);
				errorN++;
				$("Authors_Author_name_"+i).style.color="#FF0000";
				$("Author_" + i + "_name").style.border="2px solid #FF0000";
			}
			else $("Author_" + i + "_name").style.border="1px solid #000066";

			if ($("Author_" + i + "_degree").value === "") {
				errorList.push("degree for " + Authorname);
				errorN++;
				$("Authors_Author_name_"+i).style.color="#FF0000";
				$("Author_" + i + "_degree").style.border="2px solid #FF0000";
			}
			else $("Author_" + i + "_degree").style.border="1px solid #000066";

			if ($("Author_" + i + "_academic_title").value === "") {
				errorList.push("academic title for " + Authorname);
				errorN++;
				$("Authors_Author_name_"+i).style.color="#FF0000";
				$("Author_" + i + "_academic_title").style.border="2px solid #FF0000";
			}
			else $("Author_" + i + "_academic_title").style.border="1px solid #000066";

			if ($("Author_" + i + "_affiliation_where_work_was_done").value === "") {
				errorList.push("affiliation for " + Authorname);
				errorN++;
				$("Authors_Author_name_"+i).style.color="#FF0000";
				$("Author_" + i + "_affiliation_where_work_was_done").style.border="2px solid #FF0000";
			}
			else $("Author_" + i + "_affiliation_where_work_was_done").style.border="1px solid #000066";
			
			//valid email address
			var email = $("Author_" + i + "_email").value;
			if (!filter.test(email)) {
				errorList.push("valid email for " + Authorname);
				errorN++;
				$("Authors_Author_name_"+i).style.color="#FF0000";
				$("Author_" + i + "_email").style.border="2px solid #FF0000";
			}
			else $("Author_" + i + "_email").style.border="1px solid #000066";

			//Role
		    if (!($("Author_" + i + "_study_design").checked ||
			$("Author_" + i + "_conduct_of_study").checked ||
			$("Author_" + i + "_data_analysis").checked ||
			$("Author_" + i + "_manuscript_preparation").checked ||
			$('Author_' + i + '_other').value !== "")) {
				errorList.push("authorship role for " + Authorname);
				errorN++;
				$("Authors_Author_name_"+i).style.color="#FF0000";
				$("Author_" + i + "_Role").style.color="#FF0000";
			}
			else $("Author_" + i + "_Role").style.color="";

			// Attestations
			var VAL = ($("Author_" + i + "_approved_the_final_manuscript?Yes").checked +
			$("Author_" + i + "_approved_the_final_manuscript?No").checked * 10);
			switch (VAL) {
				case 0:
					errorList.push(Authorname + " has not indicated manuscript approval");
					errorN++;
					$("Authors_Author_name_"+i).style.color="#FF0000";
					$("Author_" + i + "_approved_the_final_manuscript?").style.color="#FF0000";
					break;
				case 1:
					$("Author_" + i + "_approved_the_final_manuscript?").style.color="";
					break;
				case 10:
					errorList.push(Authorname + " has not approved the final manuscript");
					errorN++;
					$("Authors_Author_name_"+i).style.color="#FF0000";
				$("Author_" + i + "_approved_the_final_manuscript?").style.color="#FF0000";
					break;
			}
			
			if ($('Research_ReportCheckBox').checked || 
				$('Brief_ReportCheckBox').checked || 
				$("Technical_CommunicationCheckBox").checked) {
					var VAL = ($("Author_" + i + "_have_seen_the_original_study_data?Yes").checked +
					$("Author_" + i + "_have_seen_the_original_study_data?No").checked * 10);
					switch (VAL) {
						case 0:
							errorList.push(Authorname + " has not indicated yes or no regarding inspection of the study data");
							errorN++;
							$("Authors_Author_name_"+i).style.color="#FF0000";
							$("Author_" + i + "_have_seen_the_original_study_data?").style.color="#FF0000";
							break;
						case 1:
							dataAttest++;
							$("Author_" + i + "_have_seen_the_original_study_data?").style.color="";
							break;
						case 10:
							$("Author_" + i + "_have_seen_the_original_study_data?").style.color="";
							break;
					}

					var VAL = ($("Author_" + i + "_reviewed_the_data_analysis?Yes").checked +
					$("Author_" + i + "_reviewed_the_data_analysis?No").checked * 10);
					switch (VAL) {
						case 0:
							errorList.push(Authorname + " has not indicated yes or no regarding review of the analysis");
							errorN++;
							$("Authors_Author_name_"+i).style.color="#FF0000";
							$("Author_" + i + "_reviewed_the_data_analysis?").style.color="#FF0000";
							break;
						case 1:
							analysisAttest++;
							$("Author_" + i + "_reviewed_the_data_analysis?").style.color="";
							break;
						case 10:
							$("Author_" + i + "_reviewed_the_data_analysis?").style.color="";
							break;
					}

					var VAL = ($("Author_" + i + "_are_the_archival_author?Yes").checked +
					$("Author_" + i + "_are_the_archival_author?No").checked * 10);
					switch (VAL) {
						case 0:
							errorList.push(Authorname + " has not indicated yes or no regarding being the archival author");
							errorN++;
							$("Authors_Author_name_"+i).style.color="#FF0000";
							$("Author_" + i + "_are_the_archival_author?").style.color="#FF0000";
							break;
						case 1:
							archivalAttest++;
							archivalAuthors = archivalAuthors + Authorname + ", "
							$("Author_" + i + "_are_the_archival_author?").style.color="";
							break;
						case 10:
							$("Author_" + i + "_are_the_archival_author?").style.color="";
							break;
					}
			}

			$("Author_" + i + "_COI").style.color="";
			if (!($("Author_" + i + "_COI_yes").checked || 
				$("Author_" + i + "_COI_no").checked))  {
					errorList.push(Authorname + " has not indicated whether or not conflicts of interest exist");
					errorN++;
					$("Authors_Author_name_"+i).style.color="#FF0000";
					$("Author_" + i + "_COI").style.color="#FF0000";
				}

			if ($("Author_" + i + "_COI_yes").checked === true) {
				var conflictflag = 0;
				for (var rowIndex = 0; rowIndex <= 5; rowIndex++) {
					if ($("Author_" + i + "_company_" + rowIndex).value === "") {
						$("Author_" + i + "_salary_" + rowIndex).checked = false;
						$("Author_" + i + "_honoraria_" + rowIndex).checked = false;
						$("Author_" + i + "_consulting_" + rowIndex).checked = false;
						$("Author_" + i + "_royalties_" + rowIndex).checked = false;
						$("Author_" + i + "_equity_" + rowIndex).checked = false;
						$("Author_" + i + "_funded_research_" + rowIndex).checked = false;
						$("Author_" + i + "_other_" + rowIndex).checked = false;
					}
					else {
						if ($("Author_" + i + "_salary_" + rowIndex).checked ||
						$("Author_" + i + "_honoraria_" + rowIndex).checked ||
						$("Author_" + i + "_consulting_" + rowIndex).checked ||
						$("Author_" + i + "_royalties_" + rowIndex).checked ||
						$("Author_" + i + "_equity_" + rowIndex).checked ||
						$("Author_" + i + "_funded_research_" + rowIndex).checked ||
						$("Author_" + i + "_other_" + rowIndex).checked) 
							conflictflag = 1;
					}
				}
				$("Author_" + i + "_COI_free_response").value = 
				   trim($("Author_" + i + "_COI_free_response").value);
				if (("Author_" + i + "_COI_free_response").value !== "") conflictflag = 1;
				if (conflictflag === 0) {
					errorList.push(Authorname + " has not disclosed conflicts of interest");
					errorN++;
					$("Authors_Author_name_"+i).style.color="#FF0000";
					$("Author_" + i + "_COI").style.color="#FF0000";
				}
			}
			
			//if Corresponding, check fields
			if ($('Author_' + i + '_Corresponding_Author').checked) {
				if ($("Author_" + i + "_address").value === "") {
					errorList.push("address for corresponding author (" + $("Author_" + i + "_name").value + ")");
					errorN++;
					$("Authors_Author_name_"+i).style.color="#FF0000";
					$("Author_" + i + "_address").style.border="2px solid #FF0000";
				}
				else $("Author_" + i + "_address").style.border="1px solid #000066";
				
				if ($("Author_" + i + "_phone").value === "") {
					errorList.push("phone number for corresponding author (" + $("Author_" + i + "_name").value + ")");
					errorN++;
					$("Authors_Author_name_"+i).style.color="#FF0000";
					$("Author_" + i + "_phone").style.border="2px solid #FF0000";
				}
				else $("Author_" + i + "_phone").style.border="1px solid #000066";

				if ($("Author_" + i + "_fax").value === "") {
					errorList.push("fax number for corresponding author (" + $("Author_" + i + "_name").value + ")");
					errorN++;
					$("Authors_Author_name_"+i).style.color="#FF0000";
					$("Author_" + i + "_fax").style.border="2px solid #FF0000";
				}
				else $("Author_" + i + "_fax").style.border="1px solid #000066";
			}
		}

	//any Corresponding Author
	if(findCorrespondingAuthor() == -1)
		{
		errorList.push("there is no corresponding author");
		errorN++;
		}

	// Global Attestations
	if ($('Research_ReportCheckBox').checked || $('Brief_ReportCheckBox').checked || $("Technical_CommunicationCheckBox").checked) {
		if (nextIndex == 1) {
			if (dataAttest < 1) {
				errorList.push("<b>as the sole author</b> " + Authorname + " must attest for the integrity of the original study data");
				errorN++;
				$("Authors_Author_name_"+i).style.color="#FF0000";
				$("Author_0_have_seen_the_original_study_data?").style.color="#FF0000";
			}
			if (analysisAttest < 1) {
				errorList.push("<b>as the sole author</b> " + Authorname + " must attest for the integrity of the data analysis");
				errorN++;
				$("Authors_Author_name_"+i).style.color="#FF0000";
				$("Author_0_reviewed_the_data_analysis?").style.color="#FF0000";
			}
			if (archivalAttest < 1) {
				errorList.push("<b>as the sole author</b> " + Authorname + " must attest to being the archival author");
				errorN++;
				$("Authors_Author_name_"+i).style.color="#FF0000";
				$("Author_0_are_the_archival_author?").style.color="#FF0000";
			}
		}
		else {
			if (dataAttest < 2) {
				errorList.push("at least two authors must attest for the integrity of the original study data");
				errorN++;
			}
			if (analysisAttest < 2) {
				errorList.push("at least two authors must attest for the integrity of the data analysis");
				errorN++;
			}
			if (archivalAttest == 0) {
				errorList.push("one author must be identified as the archival author, responsible for archiving the study data files");
				errorN++;
			}
			if (archivalAttest > 1) {
				errorList.push("you have identified " + archivalAttest + " authors as archival authors, " +
				archivalAuthors + "but only one author can be the archival author");
				errorN++;
			}
		}
	}
	if (errorN > 0) 
		{
		if (errorN == 1) 
			var Items = errorN + " item:</b> ";
		else
			var Items = errorN + " items:</b> ";
		errorHTML = "<b>Missing " + Items + errorList.toSentence() + ".";
		}
	else
		errorHTML = "";
	return errorHTML;
}

function invalid(message){
	alert("Cannot generate title page: "+message + ".");
}
