After an extended manic episode I started getting paranoid and was underperforming at work. I ended up seeking help and was diagnosed. I told HR and my boss and was put on a performance improvement plan shortly afterwards. It’s just a round about way of slowly getting fired which is way more stressful. I worked for one of the major internet companies.
My advice would be not to tell anyone at work, let them fire you if you have to, it’s not the end of the world. Then make the lifestyle changes needed to manage your condition and build your new life around that. Unfortunately there is a stigma that will be impossible to get rid of and people will talk. This will impact future employment prospects worse than underperforming for a short period. The odds are you’ll be in the industry for a while and you’ll be better off eating a temporary setback than a more permanent one.
If you need an excuse to take time off it’s way better to blame burnout. I’d recommend taking a week of vacation citing burnout. Get some sun, go surfing. If they say no, I’d go anyway, and see if they change their mind by the time your back.
BTW HR is there to protect the company from lawsuits, not to help you in anyway.
But seriously; do what ever you have to to make lifestyle changes.
EDIT: I’m also a foreigner so I lost my work visa when I was let go. This was in 2009 and it was my first job. Few places were hiring in 2009 and I had diminishing savings. I stayed in the US as a tourist and did a visa run to Canada a couple of times. The third time they said I couldn’t do that anymore and only gave me a few weeks to pack my things and go back to my country. In my final week I got a job at different major internet company so I hung out in Canada until a new work visa came through. Looking back it was probably a good thing. It’s hard to leave a bad situation especially when your judgement is being clouded.