function validateStep2(form){
	if(!validateSchoolFormCO(form)){
		return false;
	}
	with(form) {
		var prgId = programId.options[programId.selectedIndex].value;
		if(programValues[prgId] == '-1') {
			alert('Please select a program');
			return false;
		}	
		if(!validateDropDown(credits)){
			alert("Please specify how many semester credits you plan to transfer");
			return false;
		}
		if(!validateRadioButtonCondition(custom7)){
			alert("Please specify if  you or your spouse are affiliated with the military or you are a military veteran?");
			return false;
		}
		if(!validateProgramSpecificInputsStep1(form)) {
			return false;
		}		
		if(!validateProgramSpecificInputsStep2(form)) {
			return false;
		}
	}
	if ( ! validateStartDate123Months ('custom12') ) {
		return false;
	}
	if ( ! validateCommentBox ('comments') ) {
		return false;
	}
	if(! validateJoiningReason ('reasonForJoining') ) { return false; } if(! validateContactQuestion ('contactForQuality') ) { return false;}if(! validateMotivationQuestion ('motivationForQuality') ) {
			return false;
	}
	return true;
}

function validateStep1(form) {
	if(!validateSchoolFormCO(form)){
		return false;
	}
	with(form){
		if(!validateDropDown(educationLevel)){
			alert("Please specify your education level");
			return false;
		}
		
		if(highSchoolGradYear.options[highSchoolGradYear.selectedIndex].value=='2009' || highSchoolGradYear.options[highSchoolGradYear.selectedIndex].value=='2010'){
			alert('Ashford University currently does not accept 2009+ High School Graduation Year, please try again later');
			return false;
		}
	
		if(highSchoolGradYear.options[highSchoolGradYear.selectedIndex].value==''){
			alert('Please select for High School Graduation Year');
			return false;
		}
	}
		
	return true;
}

function validateThankYou(form) {
	with(form) {
		var prgId = programId.options[programId.selectedIndex].value;
		if(!validateDropDown(educationLevel)){
			alert("Please specify your education level");
			return false;
		}

		if(prgId == '-1') {
			alert('Please select a program');
			return false;
		}
		
		if(!validateDropDown(programId)){
			alert("Please select a degree program you are interested in.");
			return false;
		}
		
		if(!validateProgramSpecificInputsStep1(form)) {
			return false;
		}
		if(!validateThankYouProgramSpecificInputsStep2(form)) {
			return false;
		}
		if(!validateDropDown(credits)){
			alert("Please specify how many semester credits you plan to transfer");
			return false;
		}
		if(!validateRadioButtonCondition(custom7)){
			alert("Please specify if  you or your spouse are affiliated with the military or you are a military veteran?");
			return false;
		}
		
		if(highSchoolGradYear.options[highSchoolGradYear.selectedIndex].value=='2009'){
			alert('Ashford University currently does not accept 2009+ High School Graduation Year, please try again later');
			return false;
	    }

	    if(highSchoolGradYear.options[highSchoolGradYear.selectedIndex].value==''){
			alert('Please select for High School Graduation Year');
			return false;
	    }
	
		return true;
	}
}

function validateProgramSpecificInputsStep1(form) {
	with(form) {
		var prgId = programId.options[programId.selectedIndex].value;
		var prgValue = programValues[prgId];
		var education = '';
		if(educationLvl != ''){
			education = educationLvl
		}else{
			education = educationLevel.options[educationLevel.selectedIndex].value;
		}
		if(prgValue.indexOf('B') != 0 && prgValue.indexOf('A') != 0 && (education != 'BACH' && education != 'MAST' && education != 'DOCT')) {
			alert("To select Master's degree, must have Bachelor's Degree.");
			return false;
		}
		if((prgValue.indexOf('B') == 0 || prgValue.indexOf('A') == 0) && 
				(education == 'BACH' || education == 'MAST' || education == 'DOCT')) {
			alert("Anyone who already has a Bachelor's degree or higher is not eligible for the program");
			return false;
		}
	}
	return true;
}

function validateProgramSpecificInputsStep2(form) {
	with(form) {
		var prgId = programId.options[programId.selectedIndex].value;
		var progValue = programValues[prgId];
		if(progValue == 'AAB') {
			if(!validateRadioButtonCondition(age)) {
				alert("Please specify whether you are 17+");
				return false;
			}
			if(validateRadioButton(age,2)) {
				alert('You must be age 17+ to enroll');
				return false;
			}
		}
		else {
			if(!validateRadioButtonCondition(age)) {
				alert("Please specify whether you are 22 or older");
				return false;
			}
			if(validateRadioButton(age,4) || validateRadioButton(age,5)) {
				alert('You must be age 22 or older to enroll');
				return false;
			}
		}
	}
	return true;
}

function validateThankYouProgramSpecificInputsStep2(form) {
	with(form) {
		var prgId = programId.options[programId.selectedIndex].value;
		if(prgId == '-1' || prgId == '') {
			return false;
		}
		if(programValues[prgId] == 'AAB') {
			if(!validateRadioButtonCondition(age)) {
				alert("Please specify whether you are 17+");
				return false;
			}
			if(validateRadioButton(age,2)) {
				alert('You must be age 17+ to enroll');
				return false;
			}
		}
		else {
			if(!validateRadioButtonCondition(age)) {
				alert("Please specify whether you are 22 or older");
				return false;
			}
			if(validateRadioButton(age,4) || validateRadioButton(age,5)) {
				alert('You must be age 22 or older to enroll');
				return false;
			}
		}
	}
	return true;
}

function onProgramChange(programId) {
	var prgId = programId.options[programId.selectedIndex].value;
	
	hideLevel('other');
	hideLevel('aa');
		
	if(programValues[prgId] == '-1' || programValues[prgId] == '') {
		return;
	}
	if(programValues[prgId] == 'AAB') {
		showLevel('aa');
	}
	else {
		showLevel('other');
	}
}

function onProgramChanged(programId) {
	var prgId = programId.options[programId.selectedIndex].value;
	
	hideLevel('other1');
	hideLevel('other2');
	hideLevel('aa1');
	hideLevel('aa2');
		
	if(programValues[prgId] == '-1' || programValues[prgId] == '') {
		return;
	}
	if(programValues[prgId] == 'AAB') {
		showLevel('aa1');
		showLevel('aa2');
	}
	else {
		showLevel('other1');
		showLevel('other2');
	}
}
