var select_all_check = function(){
	if($("#"+$(this).attr('id')+":checked").length > 0){
		$(".category_check_"+$(this).attr('id').split("_")[2]).attr("disabled","disabled");
	}else{
		$(".category_check_"+$(this).attr('id').split("_")[2]).removeAttr('disabled');
	}
};
$(document).ready(function(){
	$("#DirectoryPersonSearchString").hint();
	$("#advanced_link").click(function(){
		$("#advanced_options").toggle();
		if($("#DirectoryPersonAdvancedGo").val() == 1){
			$("#DirectoryPersonAdvancedGo").val(0);
		}else{
			$("#DirectoryPersonAdvancedGo").val(1);
		}
	});
	$(".select_all").click(select_all_check).each(select_all_check);
	// block control of the submit button unless the keywords have been changed
	$("#search_submit").click(function(){
		if($("#DirectoryPersonSearchString").val()=="Keywords" || $("#DirectoryPersonSearchString").val().replace(/^\s+/g, '').replace(/\s+$/g, '').length == 0){
			$("#DirectoryPersonSearchString").css("border", '2px solid red');
			return false;				
		}else{
			return true;
		}
	});
});

