if (confirm("Are you sure you want to insert this new record ?") == false) {
hide();
return false;
}

would be run immediately after the confirm box

if(confirm("Are you sure you want to continue?")==false){
hide();
continue;
}

But i want it to be halted until the user clicks something on the first confirm box. Can u please let me know how to do this? Also Can u let me know any other way to do this, if I'm approaching it in wrong way?

within your AJAX callback if you want it to run after the first dialog. Currently, you set the callback, and then call the code above. If your internet connection was really slow, the first dialog you are seeing could theoretically come after the second you are seeing.