function bindCheckBox(mainInputSelector, subInputsSelector){
		$(mainInputSelector).click(function() {
			if($(this).attr("checked")) {
				$(subInputsSelector).attr("checked", "checked");
			} else {
				$(subInputsSelector).removeAttr("checked");
			}
	});
}

$(function() {
	$("form.need_to_wait").submit(function() {
		var row = $('.submit-row', this);
		setTimeout(function () {row.html('Please wait...')}, 100);
	});
	
	bindCheckBox("#select-all", "input.selectable[type=checkbox]");
	
	function checkAutoExpand(selector){
		if ($(this).val()) {
			$(this).addClass("non_empty");
		}
		else {
			$(this).removeClass("non_empty");
		}
	};

	$('textarea.resizable').keyup(checkAutoExpand).change(checkAutoExpand).focus();

});
