
// Make sure filter fits to its table on item-lists
// And same with listactions
$(document).ready(
	function() {
		$('table.list').each(
			function() {
				var w = $(this).width();
				var df = $(this).prev('div.filter');
				var da;
				if (df.size() > 0) {
					da = df.prev('div.listactions');
				}
				else {
					da = $(this).prev('div.listactions');
				}
				if (w > 540) {
					df.width(w);
					da.width(w);
				}
				else {
					df.width(540 - 2);
					da.width(540 - 2);
					$(this).width(540);
				}
			}
		);
	}
);

// Auto-submit form when filter dropdown is changed
$(document).ready(
	function() {
		$('div.filter > form > select').change(
			function() {
				$(this).parent()[0].submit();
			}
		);
	}
);
