$(document).ready(function(){
    
	$('#educationLevel').change(function () {
		var selected = $('#educationLevel option:selected').val();
		$.ajax({
			type: 'POST',
			url: '/ajax.php?action=LU_program',
			data: 'selected='+selected,
			success: function(response){
				$('select#program').html(response);
			}
		});
	});
	
	$('#program').change(function () {
		program();
	});

	$('#state').change(function () {
		stateCheck();
	});
	
	program();

});

function stateCheck() {
		var program = $('#program option:selected').val();
		var state = $('#state option:selected').val();
		if ((program == 'COEX-MA-D' || program == 'COMF-MA-D' || program == 'COUN-MA-D') && (state == 'MO' || state == 'KS' || state == 'IL' || state == 'CA' || state == 'AR')) {
			alert('Unfortunately, your state does not accept either external schools or online degrees for licensure. Please check with your state licensure board for further clarification');
		}
}

function program() {
	var selected = $('#program option:selected').val();
	$.ajax({
		type: 'POST',
		url: '/ajax.php?action=LU_right_content',
		data: 'selected='+selected,
		success: function(response){
			if (response != '') {
				$('#right_content_update').html(response);
			}
		}
	});
	if (selected == 'NURS-BSN-D') {
		alert('You must be a registered nurse to apply for this degree');
	}
	/*if (selected == 'MBAA-MBA-D' || selected == 'MBAG-MBA-D' || selected == 'MBAH-MBA-D' || selected == 'MBAI-MBA-D' || selected == 'MBAL-MBA-D') {
		alert('You must have an undergraduate degree or minor in business or a related field');
	}*/
	stateCheck();
}

