Right, first of all, I wouldn't use OnClientClick to do this, rather I would use jQuery and use the click event to trigger this instead. This means you would have some code that looks like this:
$("#ID_OF_BUTTON").click(function() {
shouldConfirm = GetMyCondition();
if (shouldConfirm)
ShowConfirmBox();
});
Obviously, you would need to add the client ID of your button here, but that's the basic flow for setting the click handler.