$(function(){
		$('input.action').attr("disabled", "disabled");

		$('input.action').click(function(){
				return confirm('Are you sure you want to ' + $(this).val() + ' the selected item(s)?');
		});

		//toggle optional panel
		$('input#all_checkbox').click(function(){
				if ($(this).attr("checked")) {
					$('input.checkbox').attr("checked","checked");
					$('input.action').removeAttr("disabled");
				} else {
					$('input.checkbox').removeAttr("checked");
					$('input.action').attr("disabled", "disabled");
				}
		});
		$('input.checkbox').click(function(){
				if ($(this).attr("checked")) {
					$('input.action').removeAttr("disabled");
				} else {
					$('input#all_checkbox').removeAttr("checked");
					if ($('input.checkbox:checked').size() <= 0) {
						$('input.action').attr("disabled", "disabled");
					}
				}
		});
});