var val_errors = "";



function validatecombine(frm) {
	val_errors = "";
	checkitem("C_TITLE", "TEXT", "Combined Presentation Title", true, 300);
	checkitem("C_CHAIR_F", "TEXT", "Chairperson First Name", true, 50);
	checkitem("C_CHAIR_L", "TEXT", "Chairperson Last Name", true, 50);
	checkitem("C_CHAIR_AFFIL", "TEXT", "Chairperson Affiliation", true, 50);
	checkitem(frm.C_TYPE, "RADIO", "Submission Type", true, 0);
	checkitem(frm.C_DURATION, "RADIO", "Duration", true, 0);

	subcount = 0;
	txt = document.getElementById("C_1_PID").value;
	if (!(txt == 0 || txt == "")) subcount++;
	txt = document.getElementById("C_2_PID").value;
	if (!(txt == 0 || txt == "")) subcount++;
	txt = document.getElementById("C_3_PID").value;
	if (!(txt == 0 || txt == "")) subcount++;
	txt = document.getElementById("C_4_PID").value;
	if (!(txt == 0 || txt == "")) subcount++;
	txt = document.getElementById("C_5_PID").value;
	if (!(txt == 0 || txt == "")) subcount++;
	txt = document.getElementById("C_6_PID").value;
	if (!(txt == 0 || txt == "")) subcount++;
	txt = document.getElementById("C_7_PID").value;
	if (!(txt == 0 || txt == "")) subcount++;
	
	if (subcount < 2) {
		val_errors += "Select at least 2 Presentations<br/>";
	}
	
	if (val_errors != "") {
		err_title = "<font size='+1'>Correct the following errors before combining presentations.</font><br />";
		document.getElementById("errors").innerHTML = "<font color='red'>" + err_title + val_errors + "</font><br />";
		document.getElementById("h_error").value = err_title + val_errors;
		return false;
	}
	else {
		document.getElementById("h_error").value = '<div id="APPROVAL">The Combined Presentation has been successfully updated.<br><br></div>';	
		return true;
	}
}

function validateCEU(frm) {
	val_errors = "";
	checkitem("CEU_INSTRUCTOR", "TEXT", "Proposed CE Instructor", true, 60);
	checkitem(frm.CEU_INSTRUCT_CRITERION, "RADIO", "Criterion", true, 0);
	var crittype = getcriteriatype(frm);
	if (crittype == "BCBA") checkitem("CEU_CERTNUM", "TEXT", "BCBA Certificate #", true, 20);
	checkitem(frm.CEU_SUBSTANTIAL_TRAINING, "CHECKBOX", "Substantial Training", true, 0);
	checkitem(frm.CEU_GUIDELINES, "CHECKBOX", "BABC Guidelines", true, 0);
	checkitem("CEU_CV", "TEXT", "CV(s)", true, 0);
	checkitem(frm.CEU_AGREE, "MENU", "Agree to Terms", true, 0);
	bcaba = frm.CEU_BCABA.checked;
	bcba = frm.CEU_BCBA.checked;
	if (!bcaba && !bcba) val_errors += "Either BCaBA or BCCA must be checked<br/>";

	if (val_errors != "") {
		err_title = "<font size='+1'>Correct the following errors before submitting the CE Information.</font><br />";
		document.getElementById("errors").innerHTML = "<font color='red'>" + err_title + val_errors + "</font><br />";
		document.getElementById("h_error").value = err_title + val_errors;
	}
	else {
		document.getElementById("h_error").value = '<div id="APPROVALCE">The Continuing Education Application has been successfully submitted for review.<br><br><input id="submit2" class="conf-text" type="submit" name="submit2"  onClick="return setnewrec(0)" value="Create New Presentation"><br></div>';	
	}
}


function validatesubmission(frm) {
	if (txt = document.getElementById("new_rec").value == "new") return true;

	
	val_errors = "";
	var stype = getsubmissiontype(frm);
	var duration = getduration(frm);
	
	// GET MAJOR ERRORS FIRST
	checkitem(frm.Presentation_Agreement, "MENU", "Agreement to Terms", true, 0);
	checkitem("S_EMAIL", "TEXT", "E-Mail", true, 100);
	echeck("S_EMAIL");

	major_errors = val_errors;
	val_errors = "";
	
	checkitem(frm.S_TYPE, "RADIO", "Submission Type", true, 0);
	if (!(stype == "IGNITE" || stype == "POSTER"))
		checkitem(frm.S_DURATION, "RADIO", "Duration", true, 0);
	
	if (stype == "WORKSHOP") {
		checkitem(frm.S_KNOW_LEVEL, "RADIO", "Knowledge Level", true, 0);
		checkitem("S_MAX_PEOPLE", "NUMBER", "Maximum Attendees", true, 0);
		checkitem(frm.S_PREF_DATE, "RADIO", "Workshop Date Preference", true, 0);
	}
	checkitem(frm.S_AREA_PRIMARY, "MENU", "Primary Area", true, 0);
	checkitem("S_TITLE", "TEXT", "Title of Submission", true, 300);
	wordcount("S_TITLE", "Title of Submission", 0, 20);
	checkitem("S_AUTHOR_FIRST", "TEXT", "Author's First Name", true, 30);
	checkitem("S_AUTHOR_MI", "TEXT", "Author's Middle Initial", false, 10);
	checkitem("S_AUTHOR_LAST", "TEXT", "Author's Last Name", true, 50);
	checkitem(frm.S_SALUTATION, "MENU", "Salutation", true, 50);
	checkitem(frm.S_DEGREE, "MENU", "Highest Degree", true, 0);
	checkitem("S_DEGREE_OTHER", "TEXT", "Other Degrees", false, 20);
	checkitem("S_LICENSE_OTHER", "TEXT", "Other Licenses", false, 20);
	checkitem("S_AFFILIATION", "TEXT", "Author's Affiliation", true, 100);
	checkitem("S_ADDRESS_1", "TEXT", "Address 1", true, 100);
	checkitem("S_ADDRESS_2", "TEXT", "Address 2", false, 50);
	checkitem("S_ADDRESS_3", "TEXT", "Address 3", false, 50);
	checkitem("S_CITY", "TEXT", "City", true, 30);
	checkitem("S_ZIP", "TEXT", "Postal Code", true, 10);
	checkitem(frm.S_COUNTRY, "MENU", "Country", true, 30);
	checkitem("S_EMAIL", "TEXT", "E-Mail", true, 100);
	echeck("S_EMAIL");
	checkitem("S_PHONE", "TEXT", "Phone", true, 20);
	checkitem("S_FAX", "TEXT", "Fax", false, 20);
	checkitem("S_ABSTRACT", "TEXT", "Submission Abstract", true, 0);
	wordcount("S_ABSTRACT", "Submission Abstract", 50, 150);
 
	if (stype == "PAPER" || stype == "POSTER") {
		checkitem("PPS_AUTHOR_1_F", "TEXT", "Presenting Author First Name", true, 60);
		checkitem("PPS_AUTHOR_1_L", "TEXT", "Presenting Author Last Name", true, 60);
		checkitem("PPS_AFFILIATION_1", "TEXT", "Presenting Author's Affiliation", true, 100);
		checkitem("PPS_AUTHOR_2_F", "TEXT", "Author  2 First Name", false, 60);
		checkitem("PPS_AUTHOR_2_L", "TEXT", "Author  2 Last Name", false, 60);
		checkitem("PPS_AFFILIATION_2", "TEXT", "Author 2 Affiliation", false, 100);
		checkitem("PPS_AUTHOR_3_F", "TEXT", "Author  3 First Name", false, 60);
		checkitem("PPS_AUTHOR_3_L", "TEXT", "Author  3 Last Name", false, 60);
		checkitem("PPS_AFFILIATION_3", "TEXT", "Author 3 Affiliation", false, 100);
		checkitem("PPS_AUTHOR_4_F", "TEXT", "Author  4 First Name", false, 60);
		checkitem("PPS_AUTHOR_4_L", "TEXT", "Author  4 Last Name", false, 60);
		checkitem("PPS_AFFILIATION_4", "TEXT", "Author 4 Affiliation", false, 100);
		checkitem("PPS_AUTHOR_5_F", "TEXT", "Author  5 First Name", false, 60);
		checkitem("PPS_AUTHOR_5_L", "TEXT", "Author  5 Last Name", false, 60);
		checkitem("PPS_AFFILIATION_5", "TEXT", "Author 5 Affiliation", false, 100);
		checkitem("PPS_AUTHOR_6_F", "TEXT", "Author  6 First Name", false, 60);
		checkitem("PPS_AUTHOR_6_L", "TEXT", "Author  6 Last Name", false, 60);
		checkitem("PPS_AFFILIATION_6", "TEXT", "Author 6 Affiliation", false, 100);
	}
	
	if (stype == "SYMPOSIUM") {
		checkitem("S_SYM_CHAIR_F", "TEXT", "Symposium Chair First Name", true, 60);
		checkitem("S_SYM_CHAIR_L", "TEXT", "Symposium Chair Last Name", true, 60);
		checkitem("S_SYM_CHAIR_AFF", "TEXT", "Symposium Chair's Affiliation", true, 100);
		checkitem("S_SYM_DISC_F", "TEXT", "", false, 60);
		checkitem("S_SYM_DISC_L", "TEXT", "", false, 60);
		checkitem("S_SYM_DISC_AFF", "TEXT", "Discussant's Affiliation", false, 100);
		
		checkitem("S_SYM1_TITLE", "TEXT", "Title 1", true, 300);
		checkitem("S_SYM1_AUTHOR_1_F", "TEXT", "Paper 1: Presenting Author First Name", true, 60);
		checkitem("S_SYM1_AUTHOR_1_L", "TEXT", "Paper 1: Presenting Author Last Name", true, 60);
		checkitem("S_SYM1_AFFILIATION_1", "TEXT", "Paper 1: Presenting Author's Affiliation", true, 100);
		checkitem("S_SYM1_AUTHOR_2_F", "TEXT", "Paper 1: Author 2 First Name", false, 60);
		checkitem("S_SYM1_AUTHOR_2_L", "TEXT", "Paper 1: Author 2 Last Name", false, 60);
		checkitem("S_SYM1_AFFILIATION_2", "TEXT", "Paper 1: Author 2 Affiliation", false, 100);
		checkitem("S_SYM1_AUTHOR_3_F", "TEXT", "Paper 1: Author 3 First Name", false, 60);
		checkitem("S_SYM1_AUTHOR_3_L", "TEXT", "Paper 1: Author 3 Last Name", false, 60);
		checkitem("S_SYM1_AFFILIATION_3", "TEXT", "Paper 1: Author 3 Affiliation", false, 100);
		checkitem("S_SYM1_AUTHOR_4_F", "TEXT", "Paper 1: Author 4 First Name", false, 60);
		checkitem("S_SYM1_AUTHOR_4_L", "TEXT", "Paper 1: Author 4 Last Name", false, 60);
		checkitem("S_SYM1_AFFILIATION_4", "TEXT", "Paper 1: Author 4 Affiliation", false, 100);
		checkitem("S_SYM1_AUTHOR_5_F", "TEXT", "Paper 1: Author 5 First Name", false, 60);
		checkitem("S_SYM1_AUTHOR_5_L", "TEXT", "Paper 1: Author 5 Last Name", false, 60);
		checkitem("S_SYM1_AFFILIATION_5", "TEXT", "Paper 1: Author 5 Affiliation", false, 100);
		checkitem("S_SYM1_AUTHOR_6_F", "TEXT", "Paper 1: Author 6 First Name", false, 60);
		checkitem("S_SYM1_AUTHOR_6_L", "TEXT", "Paper 1: Author 6 Last Name", false, 60);
		checkitem("S_SYM1_AFFILIATION_6", "TEXT", "Paper 1: Author 6 Affiliation", false, 100);
		checkitem("S_SYM1_ABSTRACT", "TEXT", "Paper 1: Abstract", true, 0);
		wordcount("S_SYM1_ABSTRACT", "Paper 1: Abstract", 50, 150);

		ptitle = document.getElementById("S_SYM2_TITLE").value;
		if (!(ptitle == "" || ptitle == null)) {
			checkitem("S_SYM2_TITLE", "TEXT", "Title 2", true, 300);
			checkitem("S_SYM2_AUTHOR_1_F", "TEXT", "Paper 2: Presenting Author First Name", true, 60);
			checkitem("S_SYM2_AUTHOR_1_L", "TEXT", "Paper 2: Presenting Author Last Name", true, 60);
			checkitem("S_SYM2_AFFILIATION_1", "TEXT", "Paper 2: Presenting Author's Affiliation", true, 100);
			checkitem("S_SYM2_AUTHOR_2_F", "TEXT", "Paper 2: Author 2 First Name", false, 60);
			checkitem("S_SYM2_AUTHOR_2_L", "TEXT", "Paper 2: Author 2 Last Name", false, 60);
			checkitem("S_SYM2_AFFILIATION_2", "TEXT", "Paper 2: Author 2 Affiliation", false, 100);
			checkitem("S_SYM2_AUTHOR_3_F", "TEXT", "Paper 2: Author 3 First Name", false, 60);
			checkitem("S_SYM2_AUTHOR_3_L", "TEXT", "Paper 2: Author 3 Last Name", false, 60);
			checkitem("S_SYM2_AFFILIATION_3", "TEXT", "Paper 2: Author 3 Affiliation", false, 100);
			checkitem("S_SYM2_AUTHOR_4_F", "TEXT", "Paper 2: Author 4 First Name", false, 60);
			checkitem("S_SYM2_AUTHOR_4_L", "TEXT", "Paper 2: Author 4 Last Name", false, 60);
			checkitem("S_SYM2_AFFILIATION_4", "TEXT", "Paper 2: Author 4 Affiliation", false, 100);
			checkitem("S_SYM2_AUTHOR_5_F", "TEXT", "Paper 2: Author 5 First Name", false, 60);
			checkitem("S_SYM2_AUTHOR_5_L", "TEXT", "Paper 2: Author 5 Last Name", false, 60);
			checkitem("S_SYM2_AFFILIATION_5", "TEXT", "Paper 2: Author 5 Affiliation", false, 100);
			checkitem("S_SYM2_AUTHOR_6_F", "TEXT", "Paper 2: Author 6 First Name", false, 60);
			checkitem("S_SYM2_AUTHOR_6_L", "TEXT", "Paper 2: Author 6 Last Name", false, 60);
			checkitem("S_SYM2_AFFILIATION_6", "TEXT", "Paper 2: Author 6 Affiliation", false, 100);
			checkitem("S_SYM2_ABSTRACT", "TEXT", "Paper 2: Abstract", true, 0);
			wordcount("S_SYM2_ABSTRACT", "Paper 2: Abstract", 50, 150);
		}

		ptitle = document.getElementById("S_SYM3_TITLE").value;
		if (!(ptitle == "" || ptitle == null)) {
			checkitem("S_SYM3_TITLE", "TEXT", "Title 2", true, 300);
			checkitem("S_SYM3_AUTHOR_1_F", "TEXT", "Paper 3: Presenting Author First Name", true, 60);
			checkitem("S_SYM3_AUTHOR_1_L", "TEXT", "Paper 3: Presenting Author Last Name", true, 60);
			checkitem("S_SYM3_AFFILIATION_1", "TEXT", "Paper 3: Presenting Author's Affiliation", true, 100);
			checkitem("S_SYM3_AUTHOR_2_F", "TEXT", "Paper 3: Author 2 First Name", false, 60);
			checkitem("S_SYM3_AUTHOR_2_L", "TEXT", "Paper 3: Author 2 Last Name", false, 60);
			checkitem("S_SYM3_AFFILIATION_2", "TEXT", "Paper 3: Author 2 Affiliation", false, 100);
			checkitem("S_SYM3_AUTHOR_3_F", "TEXT", "Paper 3: Author 3 First Name", false, 60);
			checkitem("S_SYM3_AUTHOR_3_L", "TEXT", "Paper 3: Author 3 Last Name", false, 60);
			checkitem("S_SYM3_AFFILIATION_3", "TEXT", "Paper 3: Author 3 Affiliation", false, 100);
			checkitem("S_SYM3_AUTHOR_4_F", "TEXT", "Paper 3: Author 4 First Name", false, 60);
			checkitem("S_SYM3_AUTHOR_4_L", "TEXT", "Paper 3: Author 4 Last Name", false, 60);
			checkitem("S_SYM3_AFFILIATION_4", "TEXT", "Paper 3: Author 4 Affiliation", false, 100);
			checkitem("S_SYM3_AUTHOR_5_F", "TEXT", "Paper 3: Author 5 First Name", false, 60);
			checkitem("S_SYM3_AUTHOR_5_L", "TEXT", "Paper 3: Author 5 Last Name", false, 60);
			checkitem("S_SYM3_AFFILIATION_5", "TEXT", "Paper 3: Author 5 Affiliation", false, 100);
			checkitem("S_SYM3_AUTHOR_6_F", "TEXT", "Paper 3: Author 6 First Name", false, 60);
			checkitem("S_SYM3_AUTHOR_6_L", "TEXT", "Paper 3: Author 6 Last Name", false, 60);
			checkitem("S_SYM3_AFFILIATION_6", "TEXT", "Paper 3: Author 6 Affiliation", false, 100);
			checkitem("S_SYM3_ABSTRACT", "TEXT", "Paper 3: Abstract", true, 0);
			wordcount("S_SYM3_ABSTRACT", "Paper 3: Abstract", 50, 150);
		}
		ptitle = document.getElementById("S_SYM4_TITLE").value;
		if (!(ptitle == "" || ptitle == null)) {
			checkitem("S_SYM4_TITLE", "TEXT", "Title 2", true, 300);
			checkitem("S_SYM4_AUTHOR_1_F", "TEXT", "Paper 4: Presenting Author First Name", true, 60);
			checkitem("S_SYM4_AUTHOR_1_L", "TEXT", "Paper 4: Presenting Author Last Name", true, 60);
			checkitem("S_SYM4_AFFILIATION_1", "TEXT", "Paper 4: Presenting Author's Affiliation", true, 100);
			checkitem("S_SYM4_AUTHOR_2_F", "TEXT", "Paper 4: Author 2 First Name", false, 60);
			checkitem("S_SYM4_AUTHOR_2_L", "TEXT", "Paper 4: Author 2 Last Name", false, 60);
			checkitem("S_SYM4_AFFILIATION_2", "TEXT", "Paper 4: Author 2 Affiliation", false, 100);
			checkitem("S_SYM4_AUTHOR_3_F", "TEXT", "Paper 4: Author 3 First Name", false, 60);
			checkitem("S_SYM4_AUTHOR_3_L", "TEXT", "Paper 4: Author 3 Last Name", false, 60);
			checkitem("S_SYM4_AFFILIATION_3", "TEXT", "Paper 4: Author 3 Affiliation", false, 100);
			checkitem("S_SYM4_AUTHOR_4_F", "TEXT", "Paper 4: Author 4 First Name", false, 60);
			checkitem("S_SYM4_AUTHOR_4_L", "TEXT", "Paper 4: Author 4 Last Name", false, 60);
			checkitem("S_SYM4_AFFILIATION_4", "TEXT", "Paper 4: Author 4 Affiliation", false, 100);
			checkitem("S_SYM4_AUTHOR_5_F", "TEXT", "Paper 4: Author 5 First Name", false, 60);
			checkitem("S_SYM4_AUTHOR_5_L", "TEXT", "Paper 4: Author 5 Last Name", false, 60);
			checkitem("S_SYM4_AFFILIATION_5", "TEXT", "Paper 4: Author 5 Affiliation", false, 100);
			checkitem("S_SYM4_AUTHOR_6_F", "TEXT", "Paper 4: Author 6 First Name", false, 60);
			checkitem("S_SYM4_AUTHOR_6_L", "TEXT", "Paper 4: Author 6 Last Name", false, 60);
			checkitem("S_SYM4_AFFILIATION_6", "TEXT", "Paper 4: Author 6 Affiliation", false, 100);
			checkitem("S_SYM4_ABSTRACT", "TEXT", "Paper 4: Abstract", true, 0);
			wordcount("S_SYM4_ABSTRACT", "Paper 4: Abstract", 50, 150);
		}
	}
	
	if (stype == "PAPER") {
		checkitem("PPS_OBJECTIVE_1", "TEXT", "Objective 1", true, 400);
		wordcount("PPS_OBJECTIVE_1", "Objective 1", 0, 20);
		checkitem("PPS_OBJECTIVE_2", "TEXT", "Objective 2", true, 400);
		wordcount("PPS_OBJECTIVE_2", "Objective 2", 0, 20);
		checkitem("PPS_OBJECTIVE_3", "TEXT", "Objective 3", true, 400);
		wordcount("PPS_OBJECTIVE_3", "Objective 3", 0, 20);
	}
	
	if (stype == "SYMPOSIUM") {
		checkitem("SYMS_OBJECTIVE_1", "TEXT", "Objective 1", true, 400);
		wordcount("SYMS_OBJECTIVE_1", "Objective 1", 0, 20);
		checkitem("SYMS_OBJECTIVE_2", "TEXT", "Objective 2", true, 400);
		wordcount("SYMS_OBJECTIVE_2", "Objective 2", 0, 20);
		checkitem("SYMS_OBJECTIVE_3", "TEXT", "Objective 3", true, 400);
		wordcount("SYMS_OBJECTIVE_3", "Objective 3", 0, 20);
	
	}
	
	if (stype == "PANEL") {
		checkitem("PANS_AUTHOR_1_F", "TEXT", "Presenter 1 First Name", true, 60);
		checkitem("PANS_AUTHOR_1_L", "TEXT", "Presenter 1 Last Name", true, 60);
		checkitem("PANS_AFFILIATION_1", "TEXT", "Presenter 1 Affiliation", true, 100);
		checkitem("PANS_AUTHOR_2_F", "TEXT", "Presenter  2 First Name", false, 60);
		checkitem("PANS_AUTHOR_2_L", "TEXT", "Presenter  2 Last Name", false, 60);
		checkitem("PANS_AFFILIATION_2", "TEXT", "Presenter 2 Affiliation", false, 100);
		checkitem("PANS_AUTHOR_3_F", "TEXT", "Presenter  3 First Name", false, 60);
		checkitem("PANS_AUTHOR_3_L", "TEXT", "Presenter  3 Last Name", false, 60);
		checkitem("PANS_AFFILIATION_3", "TEXT", "Presenter 3 Affiliation", false, 100);
		checkitem("PANS_AUTHOR_4_F", "TEXT", "Presenter  4 First Name", false, 60);
		checkitem("PANS_AUTHOR_4_L", "TEXT", "Presenter  4 Last Name", false, 60);
		checkitem("PANS_AFFILIATION_4", "TEXT", "Presenter 4 Affiliation", false, 100);
		checkitem("PANS_AUTHOR_5_F", "TEXT", "Presenter  5 First Name", false, 60);
		checkitem("PANS_AUTHOR_5_L", "TEXT", "Presenter  5 Last Name", false, 60);
		checkitem("PANS_AFFILIATION_5", "TEXT", "Presenter 5 Affiliation", false, 100);
		checkitem("PANS_AUTHOR_6_F", "TEXT", "Presenter  6 First Name", false, 60);
		checkitem("PANS_AUTHOR_6_L", "TEXT", "Presenter  6 Last Name", false, 60);
		checkitem("PANS_AFFILIATION_6", "TEXT", "Presenter 6 Affiliation", false, 100);
		checkitem("PANS_OBJECTIVE_1", "TEXT", "Objective 1", true, 400);
		wordcount("PANS_OBJECTIVE_1", "Objective 1", 0, 20);
		checkitem("PANS_OBJECTIVE_2", "TEXT", "Objective 2", true, 400);
		wordcount("PANS_OBJECTIVE_2", "Objective 2", 0, 20);
		checkitem("PANS_OBJECTIVE_3", "TEXT", "Objective 3", true, 400);
		wordcount("PANS_OBJECTIVE_3", "Objective 3", 0, 20);
	}

	if (stype == "WORKSHOP") {
		checkitem("WSS_AUTHOR_1_F", "TEXT", "Presenter 1 First Name", true, 60);
		checkitem("WSS_AUTHOR_1_L", "TEXT", "Presenter 1 Last Name", true, 60);
		checkitem("WSS_AFFILIATION_1", "TEXT", "Presenter 1 Affiliation", true, 100);
		checkitem("WSS_AUTHOR_2_F", "TEXT", "Presenter  2 First Name", false, 60);
		checkitem("WSS_AUTHOR_2_L", "TEXT", "Presenter  2 Last Name", false, 60);
		checkitem("WSS_AFFILIATION_2", "TEXT", "Presenter 2 Affiliation", false, 100);
		checkitem("WSS_AUTHOR_3_F", "TEXT", "Presenter  3 First Name", false, 60);
		checkitem("WSS_AUTHOR_3_L", "TEXT", "Presenter  3 Last Name", false, 60);
		checkitem("WSS_AFFILIATION_3", "TEXT", "Presenter 3 Affiliation", false, 100);
		checkitem("WSS_AUTHOR_4_F", "TEXT", "Presenter  4 First Name", false, 60);
		checkitem("WSS_AUTHOR_4_L", "TEXT", "Presenter  4 Last Name", false, 60);
		checkitem("WSS_AFFILIATION_4", "TEXT", "Presenter 4 Affiliation", false, 100);
		checkitem("WSS_AUTHOR_5_F", "TEXT", "Presenter  5 First Name", false, 60);
		checkitem("WSS_AUTHOR_5_L", "TEXT", "Presenter  5 Last Name", false, 60);
		checkitem("WSS_AFFILIATION_5", "TEXT", "Presenter 5 Affiliation", false, 100);
		checkitem("WSS_AUTHOR_6_F", "TEXT", "Presenter  6 First Name", false, 60);
		checkitem("WSS_AUTHOR_6_L", "TEXT", "Presenter  6 Last Name", false, 60);
		checkitem("WSS_AFFILIATION_6", "TEXT", "Presenter 6 Affiliation", false, 100);
		checkitem("WS3S_OBJECTIVE_1", "TEXT", "Objective 1", true, 400);
		wordcount("WS3S_OBJECTIVE_1", "Objective 1", 0, 20);
		checkitem("WS3S_OBJECTIVE_2", "TEXT", "Objective 2", true, 400);
		wordcount("WS3S_OBJECTIVE_2", "Objective 2", 0, 20);
		checkitem("WS3S_OBJECTIVE_3", "TEXT", "Objective 3", true, 400);
		wordcount("WS3S_OBJECTIVE_3", "Objective 3", 0, 20);
		checkitem("WS3S_OBJECTIVE_4", "TEXT", "Objective 4", true, 400);
		wordcount("WS3S_OBJECTIVE_4", "Objective 4", 0, 20);
		checkitem("WS3S_OBJECTIVE_5", "TEXT", "Objective 5", true, 400);
		wordcount("WS3S_OBJECTIVE_5", "Objective 5", 0, 20);
		checkitem("S_BIO", "TEXT", "Short Biography", true, 800);
	
	
	}
	checkitem(frm.Presentation_Agreement, "MENU", "Agreement to Terms", true, 0);

	if (val_errors != "") {
		err_title = "<font size='+1'>Correct the following errors before submitting the presentation.</font><br />";
		document.getElementById("errors").innerHTML = "<font color='red'>" + err_title + val_errors + "</font><br />";
		document.getElementById("h_error").value = err_title + val_errors;
	}
	else {
		if (stype == "IGNITE" || stype == "POSTER") {
			app_msg = '<div id="APPROVAL">Your presentation has been successfully submitted for review.<br>The deadline for changes is June 10, 2011. <br><br>';
			app_msg += '<input id="submit2" class="conf-text" type="submit" name="submit2"  onClick="return setnewrec(0)" value="New Presentation"><br /><br /></div>';
		}
		else {
			email = document.getElementById("S_EMAIL").value;
			sid = document.getElementById("S_ID").value;
			locurl = "form-ceapp.php?email=" + email +"&sid=" + sid;
			app_msg = '<div id="APPROVAL">Your presentation has been saved. In order for it to submitted for review, the Continuing Education Application must be completed.<br>The deadline for changes is June 10, 2011. <br><br>';
			app_msg += 'If you have not completed the CE Application,<br>click on CONTINUING EDUCATION APPLICATION.<br /><br /><a href="' + locurl + '">CONTINUING EDUCATION APPLICATION</a><br /><br />';
			//<input id="submit3" class="conf-text" type="button" name="submit3"  onClick="gotoceapp(); return false;" value="Continuing Education Application">
			
			app_msg += '<input id="submit2" class="conf-text" type="submit" name="submit2"  onClick="return setnewrec(0)" value="Create New Presentation"><br /></div>';
		}
		document.getElementById("h_error").value = app_msg;
	}
	if (major_errors == "") return true;
	else {
 		alert("The form cannot be saved without Agreement to Terms and a valid email address.");
		return false;
	}
}

function echeck(id) {
	str = document.getElementById(id).value;
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at) == -1) {
		val_errors += "Invalid Email Address<br/>";
		return false
	}
	
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		val_errors += "Invalid Email Address<br/>";
		return false
	}
	
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		val_errors += "Invalid Email Address<br/>";
		return false
	}
	
	if (str.indexOf(at,(lat+1))!=-1){
		val_errors += "Invalid Email Address<br/>";
		return false
	}
	
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		val_errors += "Invalid Email Address<br/>";
		return false
	}
	
	if (str.indexOf(dot,(lat+2))==-1){
		val_errors += "Invalid Email Address<br/>";
		return false
	}
	
	if (str.indexOf(" ")!=-1){
		val_errors += "Invalid Email Address<br/>";
		return false
	}
	
	return true					
}


function checkitem(id, type, name, required, length) {
	switch (type) {
		case "RADIO":
			// id contains the element
			myOption = -1;
			for (i = id.length - 1; i > -1; i--) {
				if (id[i].checked) {
					myOption = i;
					i = -1;
				}
			}
			if (myOption == -1) {
				val_errors += name + " is required<br/>";
			}
			break;
		case "MENU":
			// id contains the element
			var myindex=id.selectedIndex;
			if (myindex == 0) {
				val_errors += name + " is required<br/>";
			}
			break;
		case "CHECKBOX":
			// id contains the element
			if (!id.checked) {
				val_errors += name + " is required<br/>";
			}
			break;
		case "TEXT":
			txt = document.getElementById(id).value;
			if (required) {
				if (txt == "" || txt == null) {
					val_errors += name + " is required<br/>";
				}
			}
			if (length > 0) {
				if (txt.length > length) {
					val_errors += name + " is limited to " + length + " characters.";
				}
			}
			break;
		case "NUMBER":
			txt = document.getElementById(id).value;
			if (required) {
				if (txt == "" || txt == null) {
					val_errors += name + " is required<br/>";
					if (parseInt(txt) == 0 || parseInt(txt) == NaN) {
						val_errors += name + " must be a number<br/>";
					}
				}
			}
			if (length > 0) {
				if (txt.length > length) {
					val_errors += name + " is limited to " + length + " characters.";
				}
			}
			break;
	}


}
function wordcount(id, name, minlen, maxlen) {
	txt = document.getElementById(id).value;
	txt = txt.replace("  ", " ");
	txt = txt.replace("  ", " ");
	txt = txt.replace("  ", " ");
	
	wc = txt.split(' ').length;
	if (wc < minlen - 5) val_errors += name + " should be at least " + minlen + " words.<br/>";
	if (wc > maxlen) val_errors += name + " should be at less than " + maxlen + " words.<br/>";
}

function getcriteriatype(frm) {
	var val = 0;
	
	for( i = 0; i < frm.CEU_INSTRUCT_CRITERION.length; i++ ) {
		if( frm.CEU_INSTRUCT_CRITERION[i].checked == true )
			val = frm.CEU_INSTRUCT_CRITERION[i].value;
	}
	return val;
}

function getsubmissiontype(frm) {
	var val = 0;
	
	for( i = 0; i < frm.S_TYPE.length; i++ ) {
		if( frm.S_TYPE[i].checked == true )
			val = frm.S_TYPE[i].value;
	}
	return val;
}

function getduration(frm) {
	var val = 0;
	
	for( i = 0; i < frm.S_DURATION.length; i++ ) {
		if( frm.S_DURATION[i].selected == true )
			val = frm.S_DURATION[i].value;
	}
	return val;
}

								

