jQuery(document).ready(function(){
elements = jQuery('#browser-degree');if(elements.is('form')) handler = 'submit'; else if(elements.is('select')) handler = 'change'; else handler = 'click'; elements.bind(handler, function() { jQuery.ajax({url: '/offer/updateBrowserCurriculumfield.html', async: false, data: 'degree=' + $('#browser-degree').attr("value"), success: function(response) { jQuery('#browser-curriculum').html(response) }, complete: function() { $('#browser-curriculum option:first').attr('selected','selected'); $('#browser-specialization').html('<option value="all" SELECTED>All specializations</option>')}}); return false }); ;
elements = jQuery('#browser-curriculum');if(elements.is('form')) handler = 'submit'; else if(elements.is('select')) handler = 'change'; else handler = 'click'; elements.bind(handler, function() { jQuery.ajax({url: '/offer/updateBrowserSpecializationfield.html', async: false, data: 'degree=' + $('#browser-degree').attr("value") + '&curriculum=' + $('#browser-curriculum').attr("value"), success: function(response) { jQuery('#browser-specialization').html(response) }, complete: function() { $('#browser-specialization option:first').attr('selected','selected')}}); return false }); ;
jQuery('#browser-online').click(function() { $('#browser-zip').hide() });
jQuery('#browser-campus').click(function() { $('#browser-zip').show() });
jQuery('#browser-submit').click(function() { if($("#browser-specialization").attr("value") == null || $("#browser-specialization").attr("value") == "all") { window.location = "/offer/search.html?degree=" + $("#browser-degree").attr("value") + "&curriculum=" + $("#browser-curriculum").attr("value") + "&result_type=" + $("input[@name=browser-online-campus]:checked").val() + "&zip=" + $("#b-zip").val()} else { window.location = "/offer/search.html?degree=" + $("#browser-degree").attr("value") + "&curriculum=" + $("#browser-specialization").attr("value") + "&result_type=" + $("input[@name=browser-online-campus]:checked").val() + "&zip=" + $("#b-zip").val()} });
elements = jQuery('#degree');if(elements.is('form')) handler = 'submit'; else if(elements.is('select')) handler = 'change'; else handler = 'click'; elements.bind(handler, function() { jQuery.ajax({url: '/offer/updateCurriculumfield.html', async: false, data: 'degree=' + $('#degree').attr("value"), success: function(response) { jQuery('#curriculum').html(response) }, complete: function() { $('#curriculum option:first').attr('selected','selected');}}); return false }); ;
jQuery('#degree').change(function() { if($('#degree').val() == ''){
						$('#curriculum,.search-buttons,#search-radio').hide();
						$('#curriculum').val('');
						$('#degree').val('');
					} else {
						$('#curriculum').show('slow');
						$('#search-radio').hide();
					} });
jQuery('#curriculum').change(function() { if($('#curriculum').val() == ''){
						$('.search-buttons,#search-radio').hide();
						$('#search-radio').hide();
					} else {
						$('.search-buttons').show();
						$('#search-radio').animate({
							left: 50, opacity: 'show'
						}, 500);
					} });
jQuery('#result_type_online').click(function() { $('#search-zip').hide() });
jQuery('#result_type_campus').click(function() { $('#search-zip').show() });
jQuery('#result_type_both').click(function() { $('#search-zip').show() });
jQuery('.negative').click(function() { $('#curriculum,.search-buttons,#search-zip,#search-radio').hide();$('#degree').val('');$('#result_type_online').attr('checked', 'checked');$('#result_type_campus').attr('checked', ''); });
(function($) {

$.fn.innerfade = function(options) {

	this.each(function(){ 	
		
		var settings = {
			animationtype: 'fade',
			speed: 'normal',
			timeout: 4000,
			type: 'sequence',
			containerheight: 'auto',
			runningclass: 'innerfade'
		};

		if(options)
			$.extend(settings, options);
		
		var elements = $(this).children();
	
		if (elements.length > 1) {
		
			$(this).css('position', 'relative');
	
			$(this).css('height', settings.containerheight);
			$(this).addClass(settings.runningclass);
			
			for ( var i = 0; i < elements.length; i++ ) {
				$(elements[i]).css('z-index', String(elements.length-i)).css('position', 'absolute');
				$(elements[i]).hide();
			};
		
			if ( settings.type == 'sequence' ) {
				setTimeout(function(){
					$.innerfade.next(elements, settings, 1, 0);
				}, settings.timeout);
				$(elements[0]).show();
			} else if ( settings.type == 'random' ) {
				setTimeout(function(){
					do { current = Math.floor ( Math.random ( ) * ( elements.length ) ); } while ( current == 0 )
					$.innerfade.next(elements, settings, current, 0);
				}, settings.timeout);
				$(elements[0]).show();
			}	else {
				alert('type must either be \'sequence\' or \'random\'');
			}
			
		}
		
	});
};


$.innerfade = function() {}
$.innerfade.next = function (elements, settings, current, last) {

	if ( settings.animationtype == 'slide' ) {
		$(elements[last]).slideUp(settings.speed, $(elements[current]).slideDown(settings.speed));
	} else if ( settings.animationtype == 'fade' ) {
		$(elements[last]).fadeOut(settings.speed);
		$(elements[current]).fadeIn(settings.speed);
	} else {
		alert('animationtype must either be \'slide\' or \'fade\'');
	};
	
	if ( settings.type == 'sequence' ) {
		if ( ( current + 1 ) < elements.length ) {
			current = current + 1;
			last = current - 1;
		} else {
			current = 0;
			last = elements.length - 1;
		};
	}	else if ( settings.type == 'random' ) {
		last = current;
		while (	current == last ) {
			current = Math.floor ( Math.random ( ) * ( elements.length ) );
		};
	}	else {
		alert('type must either be \'sequence\' or \'random\'');
	};
	setTimeout((function(){$.innerfade.next(elements, settings, current, last);}), settings.timeout);
};
})(jQuery);
			   
;
 })
