//jQuery won't conflict with other libraries that might use $
jQuery.noConflict();

jQuery(function($) {
	//jQuery Document Ready

	// on single post view, make any related things tiles the same height
	if ($('#widget_recipe_type_select').length) {
		$('#widget_recipe_type_select').niceSelect();
		// tweak nice-select so that the dropdown is the same width as the imitation select it's coming from
		$('#apicius_widget .nice-select ul.list').each(function() {
			var width = $(this).parents('.nice-select').css('width');
			$(this).css('width', width);
		});

		var archive_url = $('#widget_recipe_type_select').data('archive');
		$('#widget_recipe_type_select').on('change', function() {
			var hash = $('#widget_recipe_type_select option:selected').attr('value');
			if (hash != "") {
				window.location.href = archive_url + '#' + hash.replace('.', '');
			}
		});
	}


});

