function validate_field(object){
	document.getElementById(object).style.backgroundColor = '#FFFFFF';
}

function data_validate(object){

	if(object == "gpa")
	{
		re = /\D/g; // remove any characters that are not numbers
		socnum=document.search_form.gpa_str.value.replace(re,"")
		
		sslen=socnum.length
		if(sslen>1&&sslen<4)
		{
			ssa=socnum.slice(0,1)
			ssb=socnum.slice(1,3)
			document.search_form.gpa_str.value=ssa+"."+ssb
		}
		else
		{
			document.search_form.gpa_str.value=socnum
		}
	}
}

function show_other_info(object){
	if(object == 'us_citizen')
	{
		document.search_form.state.disabled = false;
		document.search_form.county.disabled = false;
		document.search_form.city.disabled = false;
		document.search_form.high_school.disabled = false;
		
		document.search_form.state.style.backgroundColor = "#FFFFFF";
		document.search_form.county.style.backgroundColor = "#FFFFFF";
		document.search_form.city.style.backgroundColor = "#FFFFFF";
		document.search_form.high_school.style.backgroundColor = "#FFFFFF";
				
		document.getElementById('state_label').style.color = "#3E3A35";
		document.getElementById('county_label').style.color = "#3E3A35";
		document.getElementById('city_label').style.color = "#3E3A35";
		document.getElementById('school_label').style.color = "#3E3A35";
		
		document.getElementById('state_span').style.color = "red";
		document.getElementById('county_span').style.color = "red";
		document.getElementById('city_span').style.color = "red";
		document.getElementById('hs_span').style.color = "red";
		
		document.getElementById('state').style.backgroundColor = "#FFFFFF";
		document.getElementById('county').style.backgroundColor = "#FFFFFF";
		document.getElementById('city').style.backgroundColor = "#FFFFFF";
		document.getElementById('high_school').style.backgroundColor = "#FFFFFF";
		
		document.getElementById('error_info_msg').style.display = "none";
	}
	else if(object == 'non_citizen')
	{
		document.search_form.state.disabled = true;
		document.search_form.county.disabled = true;
		document.search_form.city.disabled = true;
		document.search_form.high_school.disabled = true;
		
		document.search_form.state.selectedIndex = 0;
		document.search_form.county.value = "";
		document.search_form.city.value = "";
		document.search_form.high_school.value = "";
		
		document.search_form.state.style.backgroundColor = "#EFEFEF";
		document.search_form.county.style.backgroundColor = "#EFEFEF";
		document.search_form.city.style.backgroundColor = "#EFEFEF";
		document.search_form.high_school.style.backgroundColor = "#EFEFEF";
		
		document.getElementById('state_label').style.color = "#C0C0C0";
		document.getElementById('county_label').style.color = "#C0C0C0";
		document.getElementById('city_label').style.color = "#C0C0C0";
		document.getElementById('school_label').style.color = "#C0C0C0";
		
		document.getElementById('state_span').style.color = "#C0C0C0";
		document.getElementById('county_span').style.color = "#C0C0C0";
		document.getElementById('city_span').style.color = "#C0C0C0";
		document.getElementById('hs_span').style.color = "#C0C0C0";
		
		document.getElementById('state').style.backgroundColor = "#FFFFFF";
		document.getElementById('county').style.backgroundColor = "#FFFFFF";
		document.getElementById('city').style.backgroundColor = "#FFFFFF";
		document.getElementById('high_school').style.backgroundColor = "#FFFFFF";
		
		document.getElementById('error_info_msg').style.display = "none";
	}
}

function list_schools()
	{
		var selIndex = document.search_form.college.selectedIndex;
		
		if(document.search_form.college.options[selIndex].value == 'College of Arts and Sciences')
		{
			document.search_form.school.options.length = 0;
			document.search_form.school.options[document.search_form.school.options.length] = new Option('', '');
			document.search_form.school.options[document.search_form.school.options.length] = new Option('N/A', 'N/A');
			document.search_form.school.options[document.search_form.school.options.length] = new Option('School of Art', 'School of Art');
			document.search_form.school.options[document.search_form.school.options.length] = new Option('School of Communication Studies', 'School of Communication Studies');
			document.search_form.school.options[document.search_form.school.options.length] = new Option('School of Earth Environment and Society', 'School of Earth Environment and Society');
			document.getElementById('school').style.display = 'block';
		}
		else if(document.search_form.college.options[selIndex].value == 'College of Business Administration')
		{
			document.search_form.school.options.length = 0;
			document.search_form.school.options[document.search_form.school.options.length] = new Option('Not Applicable', 'N/A');
			document.getElementById('school').style.display = 'none';
		}
		else if(document.search_form.college.options[selIndex].value == 'College of Education and Human Development')
		{
			document.search_form.school.options.length = 0;
			document.search_form.school.options[document.search_form.school.options.length] = new Option('', '');
			document.search_form.school.options[document.search_form.school.options.length] = new Option('N/A', 'N/A');
			document.search_form.school.options[document.search_form.school.options.length] = new Option('School of Family and Consumer Science', 'School of Family and Consumer Science');
			document.search_form.school.options[document.search_form.school.options.length] = new Option('School of Human Movement Sport and Leisure Studies', 'School of Human Movement Sport and Leisure Studies');
			document.search_form.school.options[document.search_form.school.options.length] = new Option('School of Intervention Services', 'School of Intervention Services');
			document.search_form.school.options[document.search_form.school.options.length] = new Option('School of Teaching and Learning', 'School of Teaching and Learning');
			document.getElementById('school').style.display = 'block';
		}
		else if(document.search_form.college.options[selIndex].value == 'College of Health and Human Services')
		{
			document.search_form.school.options.length = 0;
			document.search_form.school.options[document.search_form.school.options.length] = new Option('N/A', 'N/A');
			document.getElementById('school').style.display = 'none';
		}
		else if(document.search_form.college.options[selIndex].value == 'College of Musical Arts')
		{
			document.search_form.school.options.length = 0;
			document.search_form.school.options[document.search_form.school.options.length] = new Option('N/A', 'N/A');
			document.getElementById('school').style.display = 'none';
		}
		else if(document.search_form.college.options[selIndex].value == 'College of Technology')
		{
			document.search_form.school.options.length = 0;
			document.search_form.school.options[document.search_form.school.options.length] = new Option('Not Applicable', 'N/A');
			document.getElementById('school').style.display = 'none';
		}
		else if(document.search_form.college.options[selIndex].value == 'Firelands College')
		{
			document.search_form.school.options.length = 0;
			document.search_form.school.options[document.search_form.school.options.length] = new Option('N/A', 'N/A');
			document.getElementById('school').style.display = 'none';
		}
		else if(document.search_form.college.options[selIndex].value == 'Graduate College')
		{
			document.search_form.school.options.length = 0;
			document.search_form.school.options[document.search_form.school.options.length] = new Option('N/A', 'N/A');
			document.getElementById('school').style.display = 'none';
		}
	}

function val_input(e)
{
	var unicode=e.charCode? e.charCode : e.keyCode;
		
	if (unicode!=8&&unicode!=9&&unicode!=190&&unicode!=110&&unicode!=46)
	{ //if the key isn't the backspace key (which we should allow)
		
		if (unicode<48) //if not a number
		{
			return false; //disable key press
		}
		else if(unicode>57&&unicode<96)
		{
			return false;
		}
		else if(unicode>105)
		{
			return false;
		}
	}
}

function checkform(){
	var message
	var message_id
	var allow_submit
	var focus_section
	var show_message
	var focus_form_element
	var element_name
	var skip_check
	var close_link
	var close_link_name

	allow_submit = 'true'
	skip_check = 'false'
	
	document.search_form.check_pass.value = 'false';
	
	if(!document.search_form.gn[0].checked && !document.search_form.gn[1].checked && skip_check != "true"){
		focus_section = 'error_info';
		show_message = 'error_info_msg';
		message_id = 'err_msg0'
		message = '<b>Please choose your gender.</b>';
		focus_form_element = 'false';
		element_name = 'gn';
		allow_submit = 'false';
		close_link = '<a href="javascript:close_alert('+"'"+'error_info_msg'+"','"+'false'+"'"+');" class="ok_msg">OK</a>';
		close_link_name = 'close_link0';		
		skip_check = 'true';
	}
		
	if(document.search_form.c_standing.selectedIndex == 0 && skip_check != "true"){
		focus_section = 'error_info';
		show_message = 'error_info_msg';
		message_id = 'err_msg0'
		message = '<b>Please choose your class standing.</b>';
		focus_form_element = 'false';
		element_name = 'c_standing';
		allow_submit = 'false';
		close_link = '<a href="javascript:close_alert('+"'"+'error_info_msg'+"','"+'false'+"'"+');" class="ok_msg">OK</a>';
		close_link_name = 'close_link0';		
		skip_check = 'true';
	}
	
	if(document.search_form.college.selectedIndex == 0 && skip_check != "true"){
		focus_section = 'error_info';
		show_message = 'error_info_msg';
		message_id = 'err_msg0'
		message = '<b>Please choose your college.</b>';
		focus_form_element = 'false';
		element_name = 'college';
		allow_submit = 'false';
		close_link = '<a href="javascript:close_alert('+"'"+'error_info_msg'+"','"+'false'+"'"+');" class="ok_msg">OK</a>';
		close_link_name = 'close_link0';		
		skip_check = 'true';
	}
	
	var selIndex = document.search_form.school.selectedIndex;
	
	if(document.search_form.school.options[selIndex].value == '' && skip_check != "true"){
		focus_section = 'error_info';
		show_message = 'error_info_msg';
		message_id = 'err_msg0'
		message = '<b>Please choose your school.</b>';
		focus_form_element = 'false';
		element_name = 'school';
		allow_submit = 'false';
		close_link = '<a href="javascript:close_alert('+"'"+'error_info_msg'+"','"+'false'+"'"+');" class="ok_msg">OK</a>';
		close_link_name = 'close_link0';		
		skip_check = 'true';
	}
	
	if(!document.search_form.tran_student[0].checked && !document.search_form.tran_student[1].checked && skip_check != "true"){
		focus_section = 'error_info';
		show_message = 'error_info_msg';
		message_id = 'err_msg0'
		message = '<b>Are you a transfer student?</b>';
		focus_form_element = 'false';
		element_name = 'tran_student';
		allow_submit = 'false';
		close_link = '<a href="javascript:close_alert('+"'"+'error_info_msg'+"','"+'false'+"'"+');" class="ok_msg">OK</a>';
		close_link_name = 'close_link0';		
		skip_check = 'true';
	}
	
	if(!document.search_form.citizen[0].checked && !document.search_form.citizen[1].checked && skip_check != "true")
	{
		focus_section = 'error_info';
		show_message = 'error_info_msg';
		message_id = 'err_msg0'
		message = '<b>Are you a U.S. citizen?</b>';
		focus_form_element = 'false';
		element_name = 'citizen';
		allow_submit = 'false';
		close_link = '<a href="javascript:close_alert('+"'"+'error_info_msg'+"','"+'false'+"'"+');" class="ok_msg">OK</a>';
		close_link_name = 'close_link0';		
		skip_check = 'true';
	}
	
	if(document.search_form.citizen[0].checked && skip_check != "true")
	{
		if(document.search_form.state.selectedIndex == 0 && skip_check != "true"){
			focus_section = 'error_info';
			show_message = 'error_info_msg';
			message_id = 'err_msg0'
			message = '<b>Please choose the state where you currently reside.</b>';
			focus_form_element = 'false';
			element_name = 'state';
			allow_submit = 'false';
			close_link = '<a href="javascript:close_alert('+"'"+'error_info_msg'+"','"+'false'+"'"+');" class="ok_msg">OK</a>';
			close_link_name = 'close_link0';		
			skip_check = 'true';
		}
		
		if(document.search_form.county.value == '' && skip_check != "true"){
			focus_section = 'error_info';
			show_message = 'error_info_msg';
			message_id = 'err_msg0'
			message = '<b>Please enter the county where you currently reside.</b>';
			focus_form_element = 'false';
			element_name = 'county';
			allow_submit = 'false';
			close_link = '<a href="javascript:close_alert('+"'"+'error_info_msg'+"','"+'false'+"'"+');" class="ok_msg">OK</a>';
			close_link_name = 'close_link0';		
			skip_check = 'true';
		}
		
		if(document.search_form.city.value == '' && skip_check != "true"){
			focus_section = 'error_info';
			show_message = 'error_info_msg';
			message_id = 'err_msg0'
			message = '<b>Please enter the city where you currently reside.</b>';
			focus_form_element = 'false';
			element_name = 'city';
			allow_submit = 'false';
			close_link = '<a href="javascript:close_alert('+"'"+'error_info_msg'+"','"+'false'+"'"+');" class="ok_msg">OK</a>';
			close_link_name = 'close_link0';		
			skip_check = 'true';
		}
		
		if(document.search_form.high_school.value == '' && skip_check != "true"){
			focus_section = 'error_info';
			show_message = 'error_info_msg';
			message_id = 'err_msg0'
			message = '<b>Please enter the high school from which you graduated.</b>';
			focus_form_element = 'false';
			element_name = 'high_school';
			allow_submit = 'false';
			close_link = '<a href="javascript:close_alert('+"'"+'error_info_msg'+"','"+'false'+"'"+');" class="ok_msg">OK</a>';
			close_link_name = 'close_link0';		
			skip_check = 'true';
		}
	}
	
	if(document.search_form.gpa_str.value == '' && skip_check != "true"){
		focus_section = 'error_info';
		show_message = 'error_info_msg';
		message_id = 'err_msg0'
		message = '<b>Please enter your current gpa.</b>';
		focus_form_element = 'false';
		element_name = 'gpa';
		allow_submit = 'false';
		close_link = '<a href="javascript:close_alert('+"'"+'error_info_msg'+"','"+'false'+"'"+');" class="ok_msg">OK</a>';
		close_link_name = 'close_link0';		
		skip_check = 'true';
	}
	
	if(document.search_form.act_q[0].checked && skip_check != "true"){
		var show_error;
		
		for (i=0, n=document.search_form.act.length; i<n; i++){
			if(document.search_form.act[i].value == '')
			{
				show_error = true;
				break;
			}
		}
		
		if(document.search_form.act.value == ''){
			show_error = true;
		}
			
		if(show_error == true){
			focus_section = 'error_info';
			show_message = 'error_info_msg';
			message_id = 'err_msg0'
			message = '<b>Please enter Activity(s).</b>';
			focus_form_element = 'false';
			element_name = 'act_list_box';
			allow_submit = 'false';
			close_link = '<a href="javascript:close_alert('+"'"+'error_info_msg'+"','"+'false'+"'"+');" class="ok_msg">OK</a>';
			close_link_name = 'close_link0';		
			skip_check = 'true';
		}
	}
	
	if(allow_submit == 'true')
	{
		return true;
	}
	else
	{
		document.getElementById(show_message).style.display = 'block';
		document.getElementById(message_id).innerHTML = message;
		document.getElementById(close_link_name).innerHTML = close_link;
		document.getElementById(focus_section).focus();
		document.getElementById(focus_section).blur();
		document.getElementById(element_name).style.backgroundColor = '#FFDDDE';
		
		if(focus_form_element == 'true')
		{
			document.getElementById(element_name).focus();
		}
		return false;
	}
}

function close_alert(object,field){
	document.getElementById(object).style.display = 'none';
	
	if(field != "false")
	{
		document.getElementById(field).focus();	
	}
}

function clear_input(object){
	document.getElementById(object).innerHTML = '<input type="text" name="act" value="" size="50" class="input_txt"><span id="act_span"></span>'
}