Here is some javascript for ya. I had this going before on my site until I switched to SSH. If you implement this script I suggest you force people to login through SSL so that the usernames and passwords are not floating around out there unencrypted.