I am sorry friend but can you just place whole code you have with you.
I am not getting exactly what you want to do. what i understood is,
you have to show user confirm message box on click of image button only when checkbox(s) is /are checked. and when user click cancel button on confirm box; you want to avoid redirection to default.aspx..
if is it so then following code will help you
function test()
{
return confirm("Do you want to proceed??");
}