Is it possible to inject code to have a UI similar to gmail gtalk ( or yahoo mail chat ) which can show "Connecting to chat server" and then if not present "not available" ?

Right now, is the server is not avaliable, it throws up a prompt every X secs. It would be great if we have the flexiblity of handling such cases so that so we have custom error messages and their formatting