<!--


function val_reg_student(){
	var f = frm('reg_student');
	reset_fields('reg_student');
	var errors = new Array();
	
	if(trim(f.wInput_Firstname.value)=='')
		errors.push(f.wInput_Firstname);
	if(trim(f.wInput_Lastname.value)=='')
		errors.push(f.wInput_Lastname);
	if(trim(f.wInput_EMail.value)=='')
		errors.push(f.wInput_EMail);
	else{
		if(!isEMail(trim(f.wInput_EMail.value))){
			alert("Invalid E-Mail Address!");
			errors.push(f.wInput_EMail);
		}
	}
	if(trim(f.wInput_SBI.value)=='')
		errors.push(f.wInput_SBI);
	if(trim(f.wInput_Year.value)=='')
		errors.push(f.wInput_Year);
	if(trim(f.wInput_Username.value)=='')
		errors.push(f.wInput_Username);
	if(trim(f.wInput_Password1.value)=='')
		errors.push(f.wInput_Password1);
	if(trim(f.wInput_Password2.value)=='')
		errors.push(f.wInput_Password2);
	if(trim(f.wInput_Password1.value)!=trim(f.wInput_Password2.value)){
		alert("Passwords didnt match!");
		errors.push(f.wInput_Password1);
		errors.push(f.wInput_Password2);
	}
	if(trim(f.wInput_Address.value)=='')
		errors.push(f.wInput_Address);
	if(trim(f.wInput_City.value)=='')
		errors.push(f.wInput_City);
	if(trim(f.wInput_State.value)=='')
		errors.push(f.wInput_State);
	if(trim(f.wInput_ZIP.value)=='')
		errors.push(f.wInput_ZIP);
	if(trim(f.wInput_Country.value)=='')
		errors.push(f.wInput_Country);
	if(trim(f.wInput_Phone.value)=='')
		errors.push(f.wInput_Phone);
	
		
	show_errors(errors);
	if(errors.length>0) return false;
	else return true;
}

function val_reg_corporate_user(){
	var f = frm('reg_corporate_user');
	reset_fields('reg_corporate_user');
	var errors = new Array();
	
	if(trim(f.wInput_Firstname.value)=='')
		errors.push(f.wInput_Firstname);
	if(trim(f.wInput_Lastname.value)=='')
		errors.push(f.wInput_Lastname);
	if(trim(f.wInput_Corporate.value)=='')
		errors.push(f.wInput_Corporate);
	if(trim(f.wInput_Role.value)=='')
		errors.push(f.wInput_Role);
	if(trim(f.wInput_EMail.value)=='')
		errors.push(f.wInput_EMail);
	else{
		if(!isEMail(trim(f.wInput_EMail.value))){
			alert("Invalid E-Mail Address!");
			errors.push(f.wInput_EMail);
		}
	}
	if(trim(f.wInput_Password1.value)=='')
		errors.push(f.wInput_Password1);
	if(trim(f.wInput_Password2.value)=='')
		errors.push(f.wInput_Password2);
	if(trim(f.wInput_Password1.value)!=trim(f.wInput_Password2.value)){
		alert("Passwords didnt match!");
		errors.push(f.wInput_Password1);
		errors.push(f.wInput_Password2);
	}
	if(trim(f.wInput_Address.value)=='')
		errors.push(f.wInput_Address);
	if(trim(f.wInput_City.value)=='')
		errors.push(f.wInput_City);
	if(trim(f.wInput_State.value)=='')
		errors.push(f.wInput_State);
	if(trim(f.wInput_ZIP.value)=='')
		errors.push(f.wInput_ZIP);
	if(trim(f.wInput_Country.value)=='')
		errors.push(f.wInput_Country);
	if(trim(f.wInput_Phone.value)=='')
		errors.push(f.wInput_Phone);
	
		
	show_errors(errors);
	if(errors.length>0) return false;
	else return true;
}

function val_reg_school_employee(){
	var f = frm('reg_school_employee');
	reset_fields('reg_school_employee');
	var errors = new Array();
	
	if(trim(f.wInput_Firstname.value)=='')
		errors.push(f.wInput_Firstname);
	if(trim(f.wInput_Lastname.value)=='')
		errors.push(f.wInput_Lastname);
	if(trim(f.wInput_School.value)=='')
		errors.push(f.wInput_School);
	if(trim(f.wInput_Role.value)=='')
		errors.push(f.wInput_Role);
	if(trim(f.wInput_EMail.value)=='')
		errors.push(f.wInput_EMail);
	else{
		if(!isEMail(trim(f.wInput_EMail.value))){
			alert("Invalid E-Mail Address!");
			errors.push(f.wInput_EMail);
		}
	}
	if(trim(f.wInput_Password1.value)=='')
		errors.push(f.wInput_Password1);
	if(trim(f.wInput_Password2.value)=='')
		errors.push(f.wInput_Password2);
	if(trim(f.wInput_Password1.value)!=trim(f.wInput_Password2.value)){
		alert("Passwords didnt match!");
		errors.push(f.wInput_Password1);
		errors.push(f.wInput_Password2);
	}
	if(trim(f.wInput_Address.value)=='')
		errors.push(f.wInput_Address);
	if(trim(f.wInput_City.value)=='')
		errors.push(f.wInput_City);
	if(trim(f.wInput_State.value)=='')
		errors.push(f.wInput_State);
	if(trim(f.wInput_ZIP.value)=='')
		errors.push(f.wInput_ZIP);
	if(trim(f.wInput_Country.value)=='')
		errors.push(f.wInput_Country);
	if(trim(f.wInput_Phone.value)=='')
		errors.push(f.wInput_Phone);
	
		
	show_errors(errors);
	if(errors.length>0) return false;
	else return true;
}

function val_student_application(){
	var f = frm('student_application');
	reset_fields('student_application');
	var errors = new Array();

	if (f.reg_program_type.value != 'ENG') {
		if (doc("reg_sbi1").value == '' && doc("reg_sbi2").value == '' && doc("reg_sbi3").value == '' && doc("reg_sbi4").value == '' && doc("reg_sbi5").value == '') {
			alert("Select at least one SBI.");
			errors.push(f.reg_sbi1);
		}
		
		if (!doc("reg_pursuitY").checked && !doc("reg_pursuitN").checked) {
			errors.push(f.reg_pursuitY);
		}

	}

	if(trim(f.reg_lname.value)=='')
		errors.push(f.reg_lname);
	if(trim(f.reg_fname.value)=='')
		errors.push(f.reg_fname);
	if(trim(f.reg_address.value)=='')
		errors.push(f.reg_address);
	if(trim(f.reg_city.value)=='')
		errors.push(f.reg_city);
	if(trim(f.reg_state.value)=='')
		errors.push(f.reg_state);
	if(trim(f.reg_zip.value)=='')
		errors.push(f.reg_zip);
	if(trim(f.reg_phone.value)=='')
		errors.push(f.reg_phone);
	if(trim(f.reg_email.value)=='')
		errors.push(f.reg_email);
	else{
		if(!isEMail(trim(f.reg_email.value))){
			alert("Invalid E-Mail Address!");
			errors.push(f.reg_email);
		}
	}
	if(f.action.value=='new'){
		if(trim(f.reg_password1.value)=='')
			errors.push(f.reg_password1);
		if(trim(f.reg_password2.value)=='')
			errors.push(f.reg_password2);
		if(trim(f.reg_password1.value)!=trim(f.reg_password2.value)){
			alert("Passwords Didnt match!");
			errors.push(f.reg_password1);
			errors.push(f.reg_password2);
		}
	}
	else if(f.action.value=='edit'){
		if(trim(f.reg_password1.value)!=trim(f.reg_password2.value)){
			alert("Passwords Didnt match!");
			errors.push(f.reg_password1);
			errors.push(f.reg_password2);
		}
	}
	if(trim(f.reg_bdate.value)=='')
		errors.push(f.reg_bdate);
		
	if(!(doc("reg_genderM").checked || doc("reg_genderF").checked)){
		errors.push(doc("reg_genderM"));
		errors.push(doc("reg_genderF"));		
	}
	
	if(!(doc("reg_citizenY").checked || doc("reg_citizenN").checked)){
		errors.push(doc("reg_citizenY"));
		errors.push(doc("reg_citizenN"));		
	}
	if(doc("reg_citizenN").checked){
		if(trim(f.reg_origin.value)=='')
			errors.push(f.reg_origin);	
		if(trim(f.reg_prn.value)=='')
			errors.push(f.reg_prn);	
	}

	if(!(doc("reg_ethnic1").checked || doc("reg_ethnic2").checked || doc("reg_ethnic3").checked || doc("reg_ethnic4").checked || doc("reg_ethnic5").checked || doc("reg_ethnic6").checked || doc("reg_ethnic7").checked || doc("reg_ethnic8").checked || doc("reg_ethnic9").checked || doc("reg_ethnic10").checked || doc("reg_ethnic11").checked)){
		errors.push(doc("reg_ethnic1"));
		errors.push(doc("reg_ethnic2"));
		errors.push(doc("reg_ethnic3"));
		errors.push(doc("reg_ethnic4"));
		errors.push(doc("reg_ethnic5"));
		errors.push(doc("reg_ethnic6"));
		errors.push(doc("reg_ethnic7"));
		errors.push(doc("reg_ethnic8"));
		errors.push(doc("reg_ethnic9"));
		errors.push(doc("reg_ethnic10"));
		errors.push(doc("reg_ethnic11"));
	}
	if(doc("reg_ethnic2").checked && (trim(doc("reg_ethnic2_spec").value)=='')){
		errors.push(doc("reg_ethnic2"));
		errors.push(doc("reg_ethnic2_spec"));
	}
	if(doc("reg_ethnic8").checked && (trim(doc("reg_ethnic8_spec").value)=='')){
		errors.push(doc("reg_ethnic8"));
		errors.push(doc("reg_ethnic8_spec"));
	}
	if(doc("reg_ethnic9").checked && (trim(doc("reg_ethnic9_spec").value)=='')){
		errors.push(doc("reg_ethnic9"));
		errors.push(doc("reg_ethnic9_spec"));
	}
	if(doc("reg_ethnic10").checked && (trim(doc("reg_ethnic10a_spec").value)=='') && (trim(doc("reg_ethnic10b_spec").value)=='')){
		errors.push(doc("reg_ethnic10"));
		errors.push(doc("reg_ethnic10a_spec"));
		errors.push(doc("reg_ethnic10b_spec"));
	}
	if(doc("reg_ethnic11").checked && (trim(doc("reg_ethnic11_spec").value)=='')){
		errors.push(doc("reg_ethnic11"));
		errors.push(doc("reg_ethnic11_spec"));
	}
	
	if(!(doc("reg_learn1").checked || doc("reg_learn2").checked || doc("reg_learn4").checked || doc("reg_learn5").checked)){
		errors.push(doc("reg_learn1"));
		errors.push(doc("reg_learn2"));
		errors.push(doc("reg_learn4"));
		errors.push(doc("reg_learn5"));
	}	
	if(doc("reg_learn2").checked && (trim(doc("reg_learn2_spec").value)=='')){
		errors.push(doc("reg_learn2"));
		errors.push(doc("reg_learn2_spec"));
	}
	if(doc("reg_learn4").checked && (trim(doc("reg_learn4_spec").value)=='')){
		errors.push(doc("reg_learn4"));
		errors.push(doc("reg_learn4_spec"));
	}
	if(doc("reg_learn5").checked && (trim(doc("reg_learn5_spec").value)=='')){
		errors.push(doc("reg_learn5"));
		errors.push(doc("reg_learn5_spec"));
	}
	
	if(!(doc("reg_citizenY").checked || doc("reg_citizenN").checked)){
		errors.push(doc("reg_citizenY"));
		errors.push(doc("reg_citizenN"));		
	}

	if(trim(f.reg_hs.value)=='')
		errors.push(f.reg_hs);
	if(trim(f.reg_counselor.value)=='')
		errors.push(f.reg_counselor);
	if(f.reg_parentMarital.value!=undefined){
		if(trim(f.reg_parentMarital.value)=='')
			errors.push(f.reg_parentMarital);
	}
	
	if(trim(doc("reg_activity0").value)==''){
		alert("Please input at least one (1) activity.");
		errors.push(doc("reg_activity0"));
		errors.push(doc("reg_act_hours0"));
		errors.push(doc("reg_act_position0"));
	}
	
	if(!(doc("reg_parentMarital1").checked || doc("reg_parentMarital2").checked || doc("reg_parentMarital3").checked || doc("reg_parentMarital4").checked || doc("reg_parentMarital5").checked)){
		errors.push(doc("reg_parentMarital1"));
		errors.push(doc("reg_parentMarital2"));
		errors.push(doc("reg_parentMarital3"));
		errors.push(doc("reg_parentMarital4"));
		errors.push(doc("reg_parentMarital5"));
	}
	
	if(trim(f.reg_brothers.value)=='')
		errors.push(f.reg_brothers);
	if(trim(f.reg_brothers_ages.value)=='')
		errors.push(f.reg_brothers_ages);
	if(trim(f.reg_sisters.value)=='')
		errors.push(f.reg_sisters);
	if(trim(f.reg_sisters_ages.value)=='')
		errors.push(f.reg_sisters_ages);
	if(trim(f.reg_guardian_living.value)=='')
		errors.push(f.reg_guardian_living);

	if(trim(f.reg_essay1.value)=='')
		errors.push(f.reg_essay1);
	if(trim(f.reg_essay2.value)=='')
		errors.push(f.reg_essay2);

	if(trim(f.reg_hs.value)=='') {
		alert("Please add your High School");
		errors.push(f.reg_hs);
	}
	
	if(trim(f.reg_currentgrade.value)=='') {
		alert("Please enter your Current Grade");
		errors.push(f.reg_currentgrade);
	}

	if (f.reg_program_type.value == 'ENG') {
		// verify courses are selected.
		// must have one from each math/science for each year.
		if ((!(doc("algebra8").checked) && !(doc("geometry8").checked) && !(doc("prealgebra8").checked) && trim(f.otherm8.value)=='') || (!(doc("algebra9").checked) && !(doc("algebra29").checked) && !(doc("geometry9").checked) && trim(f.otherm9.value)=='') || (!(doc("algebra210").checked) && !(doc("geometry10").checked) && !(doc("trigprecalc10").checked) && trim(f.otherm10.value)=='') || (!(doc("biology8").checked) && !(doc("lifescience8").checked) && !(doc("physicalscience8").checked) && trim(f.others8.value)=='') || (!(doc("biology9").checked) && !(doc("physicalscience9").checked) && !(doc("chemistry9").checked) && trim(f.others9.value)=='') || (!(doc("biology10").checked) && !(doc("chemistry10").checked) && !(doc("physics10").checked) && trim(f.others10.value)=='')) {
			alert("Please select the courses you have taken.");
			errors.push(f.otherm9);
		}
	}

	show_errors(errors);
	if(errors.length>0) return false;
	else return true;
}

function show_errors(arrErrors){
	if(arrErrors.length>0)
		alert("Please fill-out required fields with valid data!");
	for(var i = 0; i < arrErrors.length; i++){
		try{
//		alert(arrErrors[i]);
		arrErrors[i].style.backgroundColor = "#FFFFCC";
		} catch (err){}
	}
}

function reset_fields(form_name){
	var f = frm(form_name);
	for(var i=0; i<f.elements.length; i++){
		var typeName = (isIE)?f.elements[i].getAttribute("type"):f.elements[i].type;
		switch(typeName){
			case 'text':
			case 'password':
			case 'textarea':
			case 'select-one':
			case 'select-multiple':
				f.elements[i].style.backgroundColor = "#FFFFFF";
				break;
			case 'radio':
			case 'checkbox':
				f.elements[i].style.backgroundColor = "#DDDDDD";
				break;
		}
		
	}
}


-->
