It's clear that you have malware. In addition to taking the appropriate steps to remove the infection, you should take the proper steps to prevent this from happening again. Firefox has many nice extensions that can protect your browser from such things such as NoScript, which can be downloaded through the add-ons section of your browser. I would also of course suggest Adblock Plus, which I think any Firefox install is naked without.