showing and hiding the loader image when appropriate