$(function(){
	
	$("#DocumentSearchSubmit").click(function(){
		if(	$("select[@name='searchstate']").val() == ""
			&& $("select[@name='searchcategory']").val() == ""
			&& $("select[@name='searchtype']").val() == ""
			&& $("input[@name='searchkeywords']").val() == ""){
			alert("Please select a least one of the criteria.");
			return false;
		}
	});
	
	$(".MakeSureRecord").click(function(){
		return MakeSure('record');
	});
	
	$(".MakeSureUnpublish").click(function(){
		return MakeSure('unpublish');
	});

});

function MakeSure(item)
{
	var msg = "";
	switch(item)
	{
		case "record": msg = "WARNING!\nDeleting a record is irreversible.\nIf you are sure you want to delete this record, click \"OK\"";
		break;
	
		case "cart": msg = "Are you sure you would like to remove this item from your shopping cart?";
		break;
		
		case "unpublish": msg = "WARNING!\nYou are about to un-publish content from the website homepage.\nIf you are sure you want to do this, click \"OK\"";
		break;
		
		case "deactivate": msg = "Are you sure you would like to deactivate this member?";
		break;
		
		case "vacant": msg = "Are you sure you would like to mark this membership as vacant?";
		break;
	}
	
	if(confirm(msg)){
		return true; 
	}else{
		return false;
	}

}