Agree with Teja's comment. Unless you are doing the submit asynchronously then whether or not the gif display's is really based upon how quickly the browser starts loading the next page (or postbacked page).
What you could do if you really want to show the gif (will have to be ajax of some description though) is...
$("#btnSubmit").click(function(e){
e.preventDefault(); // stops any 'immediate' post back or re-direction
$("#loader").hide()
.html("<img src='<?= url::base() ?>themes/img/loading.gif' border='0' />")
.delay(1000).fadeIn(200, function(){
// submit form using $.ajax or whatever suits - rebuild page on callback or navigate to new page
});
});
Fundamentally speaking though as both Jonas and Teja have alluded to, if you are not doing ajax - then the user feedback is already there (ie the browser's version of a 'loader gif' will display because it's trying to load a new page) - so why bother going round the houses just to get a loader gif on your page and make it look "Web 2.0"?
Either do ajax, or let the browser give the user it's visual feedback.